Debian Codegraph @

llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn

raw
1 import("//compiler-rt/target.gni")
2 import("//compiler-rt/test/test.gni")
3 import("//llvm/lib/DebugInfo/PDB/enable_dia.gni")
4 import("//llvm/triples.gni")
5 import("//llvm/utils/gn/build/buildflags.gni")
6 import("//llvm/utils/gn/build/libs/zlib/enable.gni")
7 import("//llvm/utils/gn/build/toolchain/compiler.gni")
8 import("//llvm/utils/gn/build/write_cmake_config.gni")
9 import("//llvm/version.gni")
10
11 ext = ""
12 if (host_os == "win") {
13 ext = ".exe"
14 }
15
16 write_cmake_config("lit_common_configured") {
17 input = "lit.common.configured.in"
18 output = "$target_gen_dir/lit.common.configured"
19
20 values = [
21 "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
22
23 "COMPILER_RT_DEFAULT_TARGET_TRIPLE=$llvm_current_triple",
24 "COMPILER_RT_DEFAULT_TARGET_ARCH=$crt_current_target_arch",
25
26 "COMPILER_RT_TEST_COMPILER_CFLAGS=$target_flags_string",
27 "LLVM_BUILD_MODE=.",
28 "LLVM_MAIN_SRC_DIR=" + rebase_path("//llvm"),
29 "LLVM_BINARY_DIR=" + rebase_path(root_build_dir),
30 "COMPILER_RT_SOURCE_DIR=" + rebase_path("//compiler-rt"),
31
32 # This is only used by tsan to find the path to an instrumented libc++.
33 # Since we don't currently support running the tsan tests, leave it empty
34 # for now. Eventually it should probably be replaced with some mechanism
35 # where the libraries are found in a toolchain dir.
36 "COMPILER_RT_BINARY_DIR=",
37
38 # We don't currently support the multiarch runtime layout.
39 "LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL=False",
40
41 "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
42 "LLVM_TOOLS_DIR=" + rebase_path("$root_build_dir/bin"),
43 "LLVM_LIBRARY_OUTPUT_INTDIR=" + rebase_path("$root_build_dir/lib"),
44
45 "LLVM_LIBCXX_USED=0",
46
47 "GOLD_EXECUTABLE=ld",
48 "GNU_LD_EXECUTABLE=ld",
49 "COMPILER_RT_RESOLVED_TEST_COMPILER=" +
50 rebase_path("$root_build_dir/bin/clang") + ext,
51 "COMPILER_RT_TEST_COMPILER_ID=Clang",
52 "Python3_EXECUTABLE=$python_path",
53 "COMPILER_RT_BUILD_STANDALONE_LIBATOMIC_PYBOOL=False",
54 "COMPILER_RT_DEBUG_PYBOOL=False",
55 "COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER_PYBOOL=False",
56 "SANITIZER_DISABLE_SYMBOLIZER_PATH_SEARCH_PYBOOL=False",
57 "COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG_PYBOOL=True",
58 "COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL=False",
59 "COMPILER_RT_RESOLVED_EXEC_OUTPUT_DIR=" +
60 rebase_path("$root_build_dir/bin"),
61 "COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR=" +
62 rebase_path(crt_current_out_dir),
63 "COMPILER_RT_RESOLVED_OUTPUT_DIR=" + rebase_path(crt_current_out_dir),
64 "COMPILER_RT_EMULATOR=",
65 "COMPILER_RT_ASAN_SHADOW_SCALE=",
66 "COMPILER_RT_MEMPROF_SHADOW_SCALE=",
67 "COMPILER_RT_TEST_STANDALONE_BUILD_LIBS_PYBOOL=False",
68 "COMPILER_RT_TEST_USE_LLD_PYBOOL=False", # FIXME: base off use_lld?
69 "SANITIZER_CAN_USE_CXXABI_PYBOOL=True",
70 "SANITIZER_USE_STATIC_CXX_ABI_PYBOOL=False",
71 "SANITIZER_USE_STATIC_LLVM_UNWINDER_PYBOOL=False",
72 "COMPILER_RT_HAS_AARCH64_SME_PYBOOL=False",
73 "COMPILER_RT_DARWIN_LINKER_VERSION=",
74 "COMPILER_RT_HAS_LLD_PYBOOL=True",
75 "COMPILER_RT_HAS_GWP_ASAN_PYBOOL=False",
76 "HAVE_RPC_XDR_H=0",
77 "ANDROID_API_LEVEL=$android_api_level",
78 "ANDROID_SERIAL_FOR_TESTING=$android_serial_for_testing",
79 ]
80
81 if (llvm_enable_expensive_checks) {
82 values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=True" ]
83 } else {
84 values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=False" ]
85 }
86
87 if (host_cpu == "x64") {
88 values += [ "HOST_ARCH=x86_64" ]
89 } else if (host_cpu == "arm64") {
90 values += [ "HOST_ARCH=aarch64" ]
91 } else {
92 assert(false, "unimplemented host_cpu " + host_cpu)
93 }
94
95 if (host_os == "mac") {
96 values += [ "HOST_OS=Darwin" ]
97 } else if (host_os == "linux") {
98 values += [ "HOST_OS=Linux" ]
99 } else if (host_os == "win") {
100 values += [ "HOST_OS=Windows" ]
101 } else {
102 assert(false, "unsupported host_os " + host_os)
103 }
104
105 if (current_os != "win" || llvm_enable_dia_sdk) {
106 values += [ "CAN_SYMBOLIZE=1" ]
107 } else {
108 values += [ "CAN_SYMBOLIZE=0" ]
109 }
110
111 if (current_os == "android") {
112 values += [ "ANDROID_PYBOOL=True" ]
113 } else {
114 values += [ "ANDROID_PYBOOL=False" ]
115 }
116
117 if (llvm_enable_zlib) {
118 # FIXME: Include dir and library are wrong on Windows; look at zlib_path.
119 values += [
120 "ZLIB_FOUND_PYBOOL=1",
121 "ZLIB_INCLUDE_DIR=-I=",
122 "ZLIB_LIBRARY=-lz",
123 ]
124 } else {
125 values += [
126 "ZLIB_FOUND_PYBOOL=0",
127 "ZLIB_INCLUDE_DIR=",
128 "ZLIB_LIBRARY=",
129 ]
130 }
131 }