[clangd] Fix warnings
[llvm-project.git] / llvm / utils / gn / secondary / compiler-rt / test / BUILD.gn
blob020f3e7d9acd7bb7e667c57f583094656e9d091b
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")
11 ext = ""
12 if (host_os == "win") {
13   ext = ".exe"
16 write_cmake_config("lit_common_configured") {
17   input = "lit.common.configured.in"
18   output = "$target_gen_dir/lit.common.configured"
20   values = [
21     "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
23     "COMPILER_RT_DEFAULT_TARGET_TRIPLE=$llvm_current_triple",
24     "COMPILER_RT_DEFAULT_TARGET_ARCH=$crt_current_target_arch",
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"),
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=",
38     # We don't currently support the multiarch runtime layout.
39     "LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL=False",
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"),
45     "LLVM_LIBCXX_USED=0",
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     "COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG_PYBOOL=True",
57     "COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL=False",
58     "COMPILER_RT_RESOLVED_EXEC_OUTPUT_DIR=" +
59         rebase_path("$root_build_dir/bin"),
60     "COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR=" +
61         rebase_path(crt_current_out_dir),
62     "COMPILER_RT_RESOLVED_OUTPUT_DIR=" + rebase_path(crt_current_out_dir),
63     "COMPILER_RT_EMULATOR=",
64     "COMPILER_RT_ASAN_SHADOW_SCALE=",
65     "COMPILER_RT_MEMPROF_SHADOW_SCALE=",
66     "COMPILER_RT_TEST_STANDALONE_BUILD_LIBS_PYBOOL=False",
67     "COMPILER_RT_TEST_USE_LLD_PYBOOL=False",  # FIXME: base off use_lld?
68     "SANITIZER_CAN_USE_CXXABI_PYBOOL=True",
69     "SANITIZER_USE_STATIC_CXX_ABI_PYBOOL=False",
70     "SANITIZER_USE_STATIC_LLVM_UNWINDER_PYBOOL=False",
71     "COMPILER_RT_HAS_AARCH64_SME_PYBOOL=False",
72     "COMPILER_RT_DARWIN_LINKER_VERSION=",
73     "COMPILER_RT_HAS_LLD_PYBOOL=True",
74     "COMPILER_RT_HAS_GWP_ASAN_PYBOOL=False",
75     "HAVE_RPC_XDR_H=0",
76     "ANDROID_API_LEVEL=$android_api_level",
77     "ANDROID_SERIAL_FOR_TESTING=$android_serial_for_testing",
78   ]
80   if (llvm_enable_expensive_checks) {
81     values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=True" ]
82   } else {
83     values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=False" ]
84   }
86   if (host_cpu == "x64") {
87     values += [ "HOST_ARCH=x86_64" ]
88   } else if (host_cpu == "arm64") {
89     values += [ "HOST_ARCH=aarch64" ]
90   } else {
91     assert(false, "unimplemented host_cpu " + host_cpu)
92   }
94   if (host_os == "mac") {
95     values += [ "HOST_OS=Darwin" ]
96   } else if (host_os == "linux") {
97     values += [ "HOST_OS=Linux" ]
98   } else if (host_os == "win") {
99     values += [ "HOST_OS=Windows" ]
100   } else {
101     assert(false, "unsupported host_os " + host_os)
102   }
104   if (current_os != "win" || llvm_enable_dia_sdk) {
105     values += [ "CAN_SYMBOLIZE=1" ]
106   } else {
107     values += [ "CAN_SYMBOLIZE=0" ]
108   }
110   if (current_os == "android") {
111     values += [ "ANDROID_PYBOOL=True" ]
112   } else {
113     values += [ "ANDROID_PYBOOL=False" ]
114   }
116   if (llvm_enable_zlib) {
117     # FIXME: Include dir and library are wrong on Windows; look at zlib_path.
118     values += [
119       "ZLIB_FOUND_PYBOOL=1",
120       "ZLIB_INCLUDE_DIR=-I=",
121       "ZLIB_LIBRARY=-lz",
122     ]
123   } else {
124     values += [
125       "ZLIB_FOUND_PYBOOL=0",
126       "ZLIB_INCLUDE_DIR=",
127       "ZLIB_LIBRARY=",
128     ]
129   }