[llvm] 13aff21 - [gn build] port 48e4b0f (__config_site revert)
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 06:46:20 PDT 2020
Author: Nico Weber
Date: 2020-10-23T09:45:34-04:00
New Revision: 13aff21f0da7007c42d407b4ec5c1f6b24cb6831
URL: https://github.com/llvm/llvm-project/commit/13aff21f0da7007c42d407b4ec5c1f6b24cb6831
DIFF: https://github.com/llvm/llvm-project/commit/13aff21f0da7007c42d407b4ec5c1f6b24cb6831.diff
LOG: [gn build] port 48e4b0f (__config_site revert)
This reverts commit b3ca53e14274642274be8fe7db8b43dc3c146366.
This reverts commit 8b7dac81d378c339d3e55f6f51cd0c42803903ad.
This reverts commit 37c030f81a9fdd7a7e1b6fa5407b277c1ab1afa1.
Added:
Modified:
llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn
llvm/utils/gn/secondary/libcxx/include/BUILD.gn
llvm/utils/gn/secondary/libcxx/src/BUILD.gn
llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn b/llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn
index 24a95e1968be..a91ee25224d8 100644
--- a/llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/tools/driver/BUILD.gn
@@ -86,7 +86,7 @@ executable("clang") {
# clang. This is
diff erent 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:copy_headers" ]
+ deps += [ "//libcxx/include" ]
}
sources = [
"cc1_main.cpp",
diff --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 1a59c562c79f..bf1da70220fb 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -1,3 +1,4 @@
+import("//clang/resource_dir.gni")
import("//libcxx/config.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
@@ -6,264 +7,252 @@ declare_args() {
libcxx_install_support_headers = true
}
-libcxx_generated_include_dir = "$root_build_dir/include/c++/v1"
+libcxx_needs_site_config =
+ libcxx_abi_version != 1 || libcxx_abi_namespace != "" || libcxx_abi_unstable
-# 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") {
+if (libcxx_needs_site_config) {
+ write_cmake_config("write_config") {
input = "__config_site.in"
- output = "$libcxx_generated_include_dir/__config_site"
+ output = "$target_gen_dir/__config_site"
- values = [
- "_LIBCPP_ABI_FORCE_ITANIUM=",
- "_LIBCPP_ABI_FORCE_MICROSOFT=",
- "_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT=",
- "_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE=",
- "_LIBCPP_HAS_NO_STDIN=",
- "_LIBCPP_HAS_NO_STDOUT=",
- "_LIBCPP_HAS_NO_THREADS=",
- "_LIBCPP_HAS_NO_MONOTONIC_CLOCK=",
- "_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS=",
- "_LIBCPP_HAS_MUSL_LIBC=",
- "_LIBCPP_HAS_THREAD_API_PTHREAD=",
- "_LIBCPP_HAS_THREAD_API_EXTERNAL=",
- "_LIBCPP_HAS_THREAD_API_WIN32=",
- "_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL=",
- "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=",
- "_LIBCPP_NO_VCRUNTIME=",
- "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=",
- "_LIBCPP_HAS_PARALLEL_ALGORITHMS=",
- "_LIBCPP_HAS_NO_RANDOM_DEVICE=",
- "_LIBCPP_ABI_DEFINES=",
- ]
+ values = []
if (libcxx_abi_version != 1) {
values += [ "_LIBCPP_ABI_VERSION=$libcxx_abi_version" ]
- } else {
- values += [ "_LIBCPP_ABI_VERSION=" ]
}
- values += [ "_LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace" ]
+ if (libcxx_abi_namespace != "") {
+ values += [ "_LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace" ]
+ }
if (libcxx_abi_unstable) {
values += [ "_LIBCPP_ABI_UNSTABLE=1" ]
- } else {
- values += [ "_LIBCPP_ABI_UNSTABLE=" ]
}
}
- copy("copy_headers") {
- sources = [
- "__bit_reference",
- "__bsd_locale_defaults.h",
- "__bsd_locale_fallbacks.h",
+ # 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",
- "__debug",
- "__errc",
- "__functional_03",
- "__functional_base",
- "__functional_base_03",
- "__hash_table",
- "__libcpp_version",
- "__locale",
- "__mutex_base",
- "__node_handle",
- "__nullptr",
- "__split_buffer",
- "__sso_allocator",
- "__std_stream",
- "__string",
- "__threading_support",
- "__tree",
- "__tuple",
- "__undef_macros",
- "algorithm",
- "any",
- "array",
- "atomic",
- "barrier",
- "bit",
- "bitset",
- "cassert",
- "ccomplex",
- "cctype",
- "cerrno",
- "cfenv",
- "cfloat",
- "charconv",
- "chrono",
- "cinttypes",
- "ciso646",
- "climits",
- "clocale",
- "cmath",
- "codecvt",
- "compare",
- "complex",
- "complex.h",
- "condition_variable",
- "csetjmp",
- "csignal",
- "cstdarg",
- "cstdbool",
- "cstddef",
- "cstdint",
- "cstdio",
- "cstdlib",
- "cstring",
- "ctgmath",
- "ctime",
- "ctype.h",
- "cwchar",
- "cwctype",
- "deque",
- "errno.h",
- "exception",
- "experimental/__config",
- "experimental/__memory",
- "experimental/algorithm",
- "experimental/coroutine",
- "experimental/deque",
- "experimental/filesystem",
- "experimental/forward_list",
- "experimental/functional",
- "experimental/iterator",
- "experimental/list",
- "experimental/map",
- "experimental/memory_resource",
- "experimental/propagate_const",
- "experimental/regex",
- "experimental/set",
- "experimental/simd",
- "experimental/string",
- "experimental/type_traits",
- "experimental/unordered_map",
- "experimental/unordered_set",
- "experimental/utility",
- "experimental/vector",
- "ext/__hash",
- "ext/hash_map",
- "ext/hash_set",
- "fenv.h",
- "filesystem",
- "float.h",
- "forward_list",
- "fstream",
- "functional",
- "future",
- "initializer_list",
- "inttypes.h",
- "iomanip",
- "ios",
- "iosfwd",
- "iostream",
- "istream",
- "iterator",
- "latch",
- "limits",
- "limits.h",
- "list",
- "locale",
- "locale.h",
- "map",
- "math.h",
- "memory",
- "module.modulemap",
- "mutex",
- "new",
- "numeric",
- "optional",
- "ostream",
- "queue",
- "random",
- "ratio",
- "regex",
- "scoped_allocator",
- "semaphore",
- "set",
- "setjmp.h",
- "shared_mutex",
- "span",
- "sstream",
- "stack",
- "stdbool.h",
- "stddef.h",
- "stdexcept",
- "stdint.h",
- "stdio.h",
- "stdlib.h",
- "streambuf",
- "string",
- "string.h",
- "string_view",
- "strstream",
- "system_error",
- "tgmath.h",
- "thread",
- "tuple",
- "type_traits",
- "typeindex",
- "typeinfo",
- "unordered_map",
- "unordered_set",
- "utility",
- "valarray",
- "variant",
- "vector",
- "version",
- "wchar.h",
- "wctype.h",
]
- 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
- # "libstdc++", "libsupc++", "libcxxabi", "libcxxrt", but not if it's "none",
- # "default", or "vcruntime". So on Windows, these don't get copied due to
- # LIBCXX_CXX_ABI_HEADER_TARGET not being set.
- # On macOS, libcxx/CMakeLists.txt sets LIBCXX_CXX_ABI_SYSTEM to 1, which
- # causes an empty header list to be passed to setup_abi_lib, so these
- # don't get copied on macOS due to that.
- deps += [ "//libcxxabi/include" ]
- }
- if (libcxx_install_support_headers) {
- sources += [
- "support/android/locale_bionic.h",
- "support/fuchsia/xlocale.h",
- "support/ibm/limits.h",
- "support/ibm/locale_mgmt_aix.h",
- "support/ibm/support.h",
- "support/ibm/xlocale.h",
- "support/musl/xlocale.h",
- "support/newlib/xlocale.h",
- "support/solaris/floatingpoint.h",
- "support/solaris/wchar.h",
- "support/solaris/xlocale.h",
- "support/xlocale/__nop_locale_mgmt.h",
- "support/xlocale/__posix_l_fallback.h",
- "support/xlocale/__strtonum_fallback.h",
- ]
- if (target_os == "win") {
- sources += [
- "support/win32/limits_msvc_win32.h",
- "support/win32/locale_win32.h",
- ]
- }
- }
- outputs = [ "$libcxx_generated_include_dir/{{source_target_relative}}" ]
+ outputs = [ "$target_gen_dir/__config" ]
+ args = [
+ "$target_gen_dir/__config_site",
+ "__config",
+ "-o",
+ "$target_gen_dir/__config",
+ ]
+ deps = [ ":write_config" ]
}
-}
-config("include_config") {
- include_dirs = [ libcxx_generated_include_dir ]
+ copy("copy_config") {
+ sources = [ "$target_gen_dir/__config" ]
+ outputs = [ "$clang_resource_dir/include/c++/v1/{{source_file_part}}" ]
+ deps = [ ":concat_config" ]
+ }
}
-group("include") {
- deps = [
- ":copy_headers($default_toolchain)",
+copy("include") {
+ sources = [
+ "__bit_reference",
+ "__bsd_locale_defaults.h",
+ "__bsd_locale_fallbacks.h",
+ "__debug",
+ "__errc",
+ "__functional_03",
+ "__functional_base",
+ "__functional_base_03",
+ "__hash_table",
+ "__libcpp_version",
+ "__locale",
+ "__mutex_base",
+ "__node_handle",
+ "__nullptr",
+ "__split_buffer",
+ "__sso_allocator",
+ "__std_stream",
+ "__string",
+ "__threading_support",
+ "__tree",
+ "__tuple",
+ "__undef_macros",
+ "algorithm",
+ "any",
+ "array",
+ "atomic",
+ "barrier",
+ "bit",
+ "bitset",
+ "cassert",
+ "ccomplex",
+ "cctype",
+ "cerrno",
+ "cfenv",
+ "cfloat",
+ "charconv",
+ "chrono",
+ "cinttypes",
+ "ciso646",
+ "climits",
+ "clocale",
+ "cmath",
+ "codecvt",
+ "compare",
+ "complex",
+ "complex.h",
+ "condition_variable",
+ "csetjmp",
+ "csignal",
+ "cstdarg",
+ "cstdbool",
+ "cstddef",
+ "cstdint",
+ "cstdio",
+ "cstdlib",
+ "cstring",
+ "ctgmath",
+ "ctime",
+ "ctype.h",
+ "cwchar",
+ "cwctype",
+ "deque",
+ "errno.h",
+ "exception",
+ "experimental/__config",
+ "experimental/__memory",
+ "experimental/algorithm",
+ "experimental/coroutine",
+ "experimental/deque",
+ "experimental/filesystem",
+ "experimental/forward_list",
+ "experimental/functional",
+ "experimental/iterator",
+ "experimental/list",
+ "experimental/map",
+ "experimental/memory_resource",
+ "experimental/propagate_const",
+ "experimental/regex",
+ "experimental/set",
+ "experimental/simd",
+ "experimental/string",
+ "experimental/type_traits",
+ "experimental/unordered_map",
+ "experimental/unordered_set",
+ "experimental/utility",
+ "experimental/vector",
+ "ext/__hash",
+ "ext/hash_map",
+ "ext/hash_set",
+ "fenv.h",
+ "filesystem",
+ "float.h",
+ "forward_list",
+ "fstream",
+ "functional",
+ "future",
+ "initializer_list",
+ "inttypes.h",
+ "iomanip",
+ "ios",
+ "iosfwd",
+ "iostream",
+ "istream",
+ "iterator",
+ "latch",
+ "limits",
+ "limits.h",
+ "list",
+ "locale",
+ "locale.h",
+ "map",
+ "math.h",
+ "memory",
+ "module.modulemap",
+ "mutex",
+ "new",
+ "numeric",
+ "optional",
+ "ostream",
+ "queue",
+ "random",
+ "ratio",
+ "regex",
+ "scoped_allocator",
+ "semaphore",
+ "set",
+ "setjmp.h",
+ "shared_mutex",
+ "span",
+ "sstream",
+ "stack",
+ "stdbool.h",
+ "stddef.h",
+ "stdexcept",
+ "stdint.h",
+ "stdio.h",
+ "stdlib.h",
+ "streambuf",
+ "string",
+ "string.h",
+ "string_view",
+ "strstream",
+ "system_error",
+ "tgmath.h",
+ "thread",
+ "tuple",
+ "type_traits",
+ "typeindex",
+ "typeinfo",
+ "unordered_map",
+ "unordered_set",
+ "utility",
+ "valarray",
+ "variant",
+ "vector",
+ "version",
+ "wchar.h",
+ "wctype.h",
]
- public_configs = [ ":include_config" ]
+ deps = []
+ 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
+ # "libstdc++", "libsupc++", "libcxxabi", "libcxxrt", but not if it's "none",
+ # "default", or "vcruntime". So on Windows, these don't get copied due to
+ # LIBCXX_CXX_ABI_HEADER_TARGET not being set.
+ # On macOS, libcxx/CMakeLists.txt sets LIBCXX_CXX_ABI_SYSTEM to 1, which
+ # causes an empty header list to be passed to setup_abi_lib, so these
+ # don't get copied on macOS due to that.
+ deps += [ "//libcxxabi/include" ]
+ }
+ if (!libcxx_needs_site_config) {
+ sources += [ "__config" ]
+ } else {
+ deps += [ ":copy_config" ]
+ }
+ if (libcxx_install_support_headers) {
+ sources += [
+ "support/android/locale_bionic.h",
+ "support/fuchsia/xlocale.h",
+ "support/ibm/limits.h",
+ "support/ibm/locale_mgmt_aix.h",
+ "support/ibm/support.h",
+ "support/ibm/xlocale.h",
+ "support/musl/xlocale.h",
+ "support/newlib/xlocale.h",
+ "support/solaris/floatingpoint.h",
+ "support/solaris/wchar.h",
+ "support/solaris/xlocale.h",
+ "support/xlocale/__nop_locale_mgmt.h",
+ "support/xlocale/__posix_l_fallback.h",
+ "support/xlocale/__strtonum_fallback.h",
+ ]
+ if (target_os == "win") {
+ sources += [
+ "support/win32/limits_msvc_win32.h",
+ "support/win32/locale_win32.h",
+ ]
+ }
+ }
+ outputs = [ "$root_build_dir/include/c++/v1/{{source_target_relative}}" ]
}
diff --git a/llvm/utils/gn/secondary/libcxx/src/BUILD.gn b/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
index d4b43d6808c7..71668b65f72f 100644
--- a/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
@@ -1,5 +1,4 @@
import("//clang/runtimes.gni")
-import("//libcxx/config.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")
declare_args() {
@@ -38,7 +37,10 @@ declare_args() {
}
config("cxx_config") {
- include_dirs = [ "//libcxxabi/include" ]
+ include_dirs = [
+ "//libcxxabi/include",
+ "//libcxx/include",
+ ]
cflags = [
"-Wall",
"-Wextra",
@@ -201,7 +203,6 @@ if (libcxx_enable_shared) {
sources = cxx_sources
deps = [
"//compiler-rt/lib/builtins",
- "//libcxx/include",
"//libcxxabi/src:cxxabi_shared",
"//libunwind/src:unwind_shared",
]
@@ -251,7 +252,6 @@ if (libcxx_enable_static) {
}
deps = [
"//compiler-rt/lib/builtins",
- "//libcxx/include",
"//libcxxabi/src:cxxabi_static",
"//libunwind/src:unwind_static",
]
@@ -268,7 +268,6 @@ 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",
diff --git a/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn b/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
index 7cccf866db2b..3e6063a21175 100644
--- a/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
@@ -59,7 +59,10 @@ if (target_os == "linux" || target_os == "fuchsia") {
}
config("cxxabi_config") {
- include_dirs = [ "//libcxxabi/include" ]
+ include_dirs = [
+ "//libcxxabi/include",
+ "//libcxx/include",
+ ]
cflags_cc = [ "-nostdinc++" ]
defines = [ "_LIBCXXABI_BUILDING_LIBRARY" ]
if (target_os == "win") {
@@ -83,7 +86,6 @@ if (libcxxabi_enable_shared) {
public = cxxabi_headers
deps = [
"//compiler-rt/lib/builtins",
- "//libcxx/include",
"//libunwind/src:unwind_shared",
]
configs += [ ":cxxabi_config" ]
@@ -114,7 +116,6 @@ if (libcxxabi_enable_static) {
}
deps = [
"//compiler-rt/lib/builtins",
- "//libcxx/include",
"//libunwind/src:unwind_static",
]
configs += [ ":cxxabi_config" ]
More information about the llvm-commits
mailing list