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