1
- import (" //clang/resource_dir.gni" )
2
1
import (" //libcxx/config.gni" )
3
2
import (" //llvm/utils/gn/build/write_cmake_config.gni" )
4
3
5
- libcxx_needs_site_config =
6
- libcxx_abi_version != 1 || libcxx_abi_namespace != " " || libcxx_abi_unstable
4
+ write_cmake_config (" write_config" ) {
5
+ input = " __config_site.in"
6
+ output = " $target_gen_dir /__config_site"
7
7
8
- if (libcxx_needs_site_config ) {
9
- write_cmake_config (" write_config" ) {
10
- input = " __config_site.in"
11
- output = " $target_gen_dir /__config_site"
12
-
13
- values = []
14
- if (libcxx_abi_version != 1 ) {
15
- values += [ " _LIBCPP_ABI_VERSION=$libcxx_abi_version " ]
16
- }
17
- if (libcxx_abi_namespace != " " ) {
18
- values += [ " _LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace " ]
19
- }
20
- if (libcxx_abi_unstable ) {
21
- values += [ " _LIBCPP_ABI_UNSTABLE=1" ]
22
- }
8
+ values = [
9
+ " _LIBCPP_ABI_FORCE_ITANIUM=" ,
10
+ " _LIBCPP_ABI_FORCE_MICROSOFT=" ,
11
+ " _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT=" ,
12
+ " _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE=" ,
13
+ " _LIBCPP_HAS_NO_STDIN=" ,
14
+ " _LIBCPP_HAS_NO_STDOUT=" ,
15
+ " _LIBCPP_HAS_NO_THREADS=" ,
16
+ " _LIBCPP_HAS_NO_MONOTONIC_CLOCK=" ,
17
+ " _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS=" ,
18
+ " _LIBCPP_HAS_MUSL_LIBC=" ,
19
+ " _LIBCPP_HAS_THREAD_API_PTHREAD=" ,
20
+ " _LIBCPP_HAS_THREAD_API_EXTERNAL=" ,
21
+ " _LIBCPP_HAS_THREAD_API_WIN32=" ,
22
+ " _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL=" ,
23
+ " _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=" ,
24
+ " _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS=1" ,
25
+ " _LIBCPP_NO_VCRUNTIME=" ,
26
+ " _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=" ,
27
+ " _LIBCPP_ABI_NAMESPACE=" ,
28
+ " _LIBCPP_HAS_PARALLEL_ALGORITHMS=" ,
29
+ " _LIBCPP_HAS_NO_RANDOM_DEVICE=" ,
30
+ " _LIBCPP_HAS_NO_LOCALIZATION=" ,
31
+ " _LIBCPP_ABI_DEFINES=" ,
32
+ ]
33
+ if (libcxx_abi_version != 1 ) {
34
+ values += [ " _LIBCPP_ABI_VERSION=$libcxx_abi_version " ]
35
+ } else {
36
+ values += [ " _LIBCPP_ABI_VERSION=" ]
23
37
}
24
-
25
- # Generate a custom __config header. The new header is created
26
- # by prepending __config_site to the current __config header.
27
- action (" concat_config" ) {
28
- script = " //libcxx/utils/cat_files.py"
29
- inputs = [
30
- " $target_gen_dir /__config_site" ,
31
- " __config" ,
32
- ]
33
- outputs = [ " $target_gen_dir /__config" ]
34
- args = [
35
- " $target_gen_dir /__config_site" ,
36
- " __config" ,
37
- " -o" ,
38
- " $target_gen_dir /__config" ,
39
- ]
40
- deps = [ " :write_config" ]
38
+ if (libcxx_abi_namespace != " " ) {
39
+ values += [ " _LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace " ]
41
40
}
42
-
43
- copy (" copy_config" ) {
44
- sources = [ " $target_gen_dir /__config" ]
45
- outputs = [ " $clang_resource_dir /include/c++/v1/{{source_file_part}}" ]
46
- deps = [ " :concat_config" ]
41
+ if (libcxx_abi_unstable ) {
42
+ values += [ " _LIBCPP_ABI_UNSTABLE=1" ]
43
+ } else {
44
+ values += [ " _LIBCPP_ABI_UNSTABLE=" ]
47
45
}
48
46
}
49
47
48
+ # Generate a custom __config header. The new header is created
49
+ # by prepending __config_site to the current __config header.
50
+ action (" concat_config" ) {
51
+ script = " //libcxx/utils/cat_files.py"
52
+ inputs = [
53
+ " $target_gen_dir /__config_site" ,
54
+ " __config" ,
55
+ ]
56
+ outputs = [ " $root_build_dir /include/c++/v1/__config" ]
57
+ args = [
58
+ rebase_path (" $target_gen_dir /__config_site" , root_build_dir ),
59
+ rebase_path (" __config" , root_build_dir ),
60
+ " -o" ,
61
+ rebase_path (outputs [0 ], root_build_dir )
62
+ ]
63
+ deps = [ " :write_config" ]
64
+ }
65
+
50
66
copy (" include" ) {
51
67
sources = [
52
68
" __availability" ,
@@ -235,7 +251,7 @@ copy("include") {
235
251
" wchar.h" ,
236
252
" wctype.h" ,
237
253
]
238
- deps = []
254
+ deps = [ " :concat_config " ]
239
255
if (target_os != " mac" && target_os != " win" ) {
240
256
# libcxx/cmake/Modules/HandleLibCXXABI.cmake sets
241
257
# LIBCXX_CXX_ABI_HEADER_TARGET if the libcxx abi library either of
@@ -247,10 +263,5 @@ copy("include") {
247
263
# don't get copied on macOS due to that.
248
264
deps += [ " //libcxxabi/include" ]
249
265
}
250
- if (! libcxx_needs_site_config ) {
251
- sources += [ " __config" ]
252
- } else {
253
- deps += [ " :copy_config" ]
254
- }
255
266
outputs = [ " $root_build_dir /include/c++/v1/{{source_target_relative}}" ]
256
267
}
0 commit comments