forked from OSchip/llvm-project
Reland "[gn build] port 48e4b0f
(__config_site)"
This reverts commit13aff21f0d
, since the CMake part relanded inc06a8f9caa
. The GN part is a bit simpler than last time due to the prior simplifications inacea470c16
.
This commit is contained in:
parent
0b69756110
commit
fb0b19c3de
|
@ -86,7 +86,7 @@ executable("clang") {
|
|||
# clang. This is different from the CMake build, which requires devs to
|
||||
# explicitly build the "libcxx" target (which also needlessly compiles the
|
||||
# libcxx sources) to get a working compiler.
|
||||
deps += [ "//libcxx/include" ]
|
||||
deps += [ "//libcxx/include:copy_headers" ]
|
||||
}
|
||||
sources = [
|
||||
"cc1_main.cpp",
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
import("//libcxx/config.gni")
|
||||
import("//llvm/utils/gn/build/write_cmake_config.gni")
|
||||
|
||||
write_cmake_config("write_config") {
|
||||
libcxx_generated_include_dir = "$root_build_dir/include/c++/v1"
|
||||
|
||||
# This is a bit weird. For now, we assume that __config_site is identical
|
||||
# in all toolchains, and only copy it (and all other libcxx headers)
|
||||
# to 'include' in the root build dir, so that it's the same for all toolchains.
|
||||
# Maybe we wnt to make this per-toolchain eventually (and then use root_out_dir
|
||||
# in libcxx_generated_include_dir) -- e.g. for cross-builds that for example
|
||||
# use for-linux-configured libc++ for the host build but for-windows-configured
|
||||
# libc++ for the target build.
|
||||
if (current_toolchain == default_toolchain) {
|
||||
write_cmake_config("write_config_site") {
|
||||
input = "__config_site.in"
|
||||
output = "$target_gen_dir/__config_site"
|
||||
output = "$libcxx_generated_include_dir/__config_site"
|
||||
|
||||
values = [
|
||||
"_LIBCPP_ABI_FORCE_ITANIUM=",
|
||||
|
@ -47,25 +57,7 @@ write_cmake_config("write_config") {
|
|||
}
|
||||
}
|
||||
|
||||
# Generate a custom __config header. The new header is created
|
||||
# by prepending __config_site to the current __config header.
|
||||
action("concat_config") {
|
||||
script = "//libcxx/utils/cat_files.py"
|
||||
inputs = [
|
||||
"$target_gen_dir/__config_site",
|
||||
"__config",
|
||||
]
|
||||
outputs = [ "$root_build_dir/include/c++/v1/__config" ]
|
||||
args = [
|
||||
rebase_path("$target_gen_dir/__config_site", root_build_dir),
|
||||
rebase_path("__config", root_build_dir),
|
||||
"-o",
|
||||
rebase_path(outputs[0], root_build_dir),
|
||||
]
|
||||
deps = [ ":write_config" ]
|
||||
}
|
||||
|
||||
copy("include") {
|
||||
copy("copy_headers") {
|
||||
sources = [
|
||||
"__availability",
|
||||
"__bit_reference",
|
||||
|
@ -257,7 +249,7 @@ copy("include") {
|
|||
"wchar.h",
|
||||
"wctype.h",
|
||||
]
|
||||
deps = [ ":concat_config" ]
|
||||
deps = [ ":write_config_site" ]
|
||||
if (target_os != "mac" && target_os != "win") {
|
||||
# libcxx/cmake/Modules/HandleLibCXXABI.cmake sets
|
||||
# LIBCXX_CXX_ABI_HEADER_TARGET if the libcxx abi library either of
|
||||
|
@ -271,3 +263,16 @@ copy("include") {
|
|||
}
|
||||
outputs = [ "$root_build_dir/include/c++/v1/{{source_target_relative}}" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("include_config") {
|
||||
include_dirs = [ libcxx_generated_include_dir ]
|
||||
}
|
||||
|
||||
|
||||
group("include") {
|
||||
deps = [
|
||||
":copy_headers($default_toolchain)",
|
||||
]
|
||||
public_configs = [ ":include_config" ]
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import("//clang/runtimes.gni")
|
||||
import("//libcxx/config.gni")
|
||||
import("//llvm/utils/gn/build/symlink_or_copy.gni")
|
||||
|
||||
declare_args() {
|
||||
|
@ -37,10 +38,7 @@ declare_args() {
|
|||
}
|
||||
|
||||
config("cxx_config") {
|
||||
include_dirs = [
|
||||
"//libcxxabi/include",
|
||||
"//libcxx/include",
|
||||
]
|
||||
include_dirs = [ "//libcxxabi/include" ]
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
|
@ -212,6 +210,7 @@ if (libcxx_enable_shared) {
|
|||
sources = cxx_sources
|
||||
deps = [
|
||||
"//compiler-rt/lib/builtins",
|
||||
"//libcxx/include",
|
||||
"//libcxxabi/src:cxxabi_shared",
|
||||
"//libunwind/src:unwind_shared",
|
||||
]
|
||||
|
@ -261,6 +260,7 @@ if (libcxx_enable_static) {
|
|||
}
|
||||
deps = [
|
||||
"//compiler-rt/lib/builtins",
|
||||
"//libcxx/include",
|
||||
"//libcxxabi/src:cxxabi_static",
|
||||
"//libunwind/src:unwind_static",
|
||||
]
|
||||
|
@ -277,6 +277,7 @@ if (libcxx_enable_experimental) {
|
|||
output_dir = runtimes_dir
|
||||
output_name = "c++experimental"
|
||||
sources = [ "experimental/memory_resource.cpp" ]
|
||||
deps = [ "//libcxx/include" ]
|
||||
configs += [ ":cxx_config" ]
|
||||
configs -= [
|
||||
"//llvm/utils/gn/build:no_exceptions",
|
||||
|
|
|
@ -61,7 +61,6 @@ if (target_os == "linux" || target_os == "fuchsia") {
|
|||
config("cxxabi_config") {
|
||||
include_dirs = [
|
||||
"//libcxxabi/include",
|
||||
"//libcxx/include",
|
||||
|
||||
# stdlib_stdexcept.cpp depends on libc++ internals.
|
||||
"//libcxx",
|
||||
|
@ -89,6 +88,7 @@ if (libcxxabi_enable_shared) {
|
|||
public = cxxabi_headers
|
||||
deps = [
|
||||
"//compiler-rt/lib/builtins",
|
||||
"//libcxx/include",
|
||||
"//libunwind/src:unwind_shared",
|
||||
]
|
||||
configs += [ ":cxxabi_config" ]
|
||||
|
@ -119,6 +119,7 @@ if (libcxxabi_enable_static) {
|
|||
}
|
||||
deps = [
|
||||
"//compiler-rt/lib/builtins",
|
||||
"//libcxx/include",
|
||||
"//libunwind/src:unwind_static",
|
||||
]
|
||||
configs += [ ":cxxabi_config" ]
|
||||
|
|
Loading…
Reference in New Issue