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")
12 if (host_os == "win") {
16 write_cmake_config("lit_common_configured") {
17 input = "lit.common.configured.in"
18 output = "$target_gen_dir/lit.common.configured"
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",
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"),
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",
76 "ANDROID_API_LEVEL=$android_api_level",
77 "ANDROID_SERIAL_FOR_TESTING=$android_serial_for_testing",
80 if (llvm_enable_expensive_checks) {
81 values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=True" ]
83 values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=False" ]
86 if (host_cpu == "x64") {
87 values += [ "HOST_ARCH=x86_64" ]
88 } else if (host_cpu == "arm64") {
89 values += [ "HOST_ARCH=aarch64" ]
91 assert(false, "unimplemented host_cpu " + host_cpu)
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" ]
101 assert(false, "unsupported host_os " + host_os)
104 if (current_os != "win" || llvm_enable_dia_sdk) {
105 values += [ "CAN_SYMBOLIZE=1" ]
107 values += [ "CAN_SYMBOLIZE=0" ]
110 if (current_os == "android") {
111 values += [ "ANDROID_PYBOOL=True" ]
113 values += [ "ANDROID_PYBOOL=False" ]
116 if (llvm_enable_zlib) {
117 # FIXME: Include dir and library are wrong on Windows; look at zlib_path.
119 "ZLIB_FOUND_PYBOOL=1",
120 "ZLIB_INCLUDE_DIR=-I=",
125 "ZLIB_FOUND_PYBOOL=0",