• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import("//clang/lib/ARCMigrate/enable.gni")
2import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
3import("//llvm/utils/gn/build/libs/xml/enable.gni")
4import("//llvm/utils/gn/build/write_cmake_config.gni")
5import("//llvm/version.gni")
6
7config("Config_config") {
8  visibility = [ ":Config" ]
9  include_dirs = [ "$target_gen_dir/clang/include" ]
10}
11
12write_cmake_config("Config") {
13  input = "config.h.cmake"
14  output = "$target_gen_dir/config.h"
15  values = [
16    "BUG_REPORT_URL=https://bugs.llvm.org/",
17    "CLANG_DEFAULT_LINKER=",
18    "CLANG_DEFAULT_STD_C=",
19    "CLANG_DEFAULT_STD_CXX=",
20    "CLANG_DEFAULT_CXX_STDLIB=",
21    "CLANG_DEFAULT_RTLIB=",
22    "CLANG_DEFAULT_OBJCOPY=objcopy",
23    "CLANG_DEFAULT_OPENMP_RUNTIME=libomp",
24    "CLANG_DEFAULT_UNWINDLIB=",
25    "CLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_35",
26    "CLANG_LIBDIR_SUFFIX=",
27    "CLANG_RESOURCE_DIR=",
28    "C_INCLUDE_DIRS=",
29    "CLANG_CONFIG_FILE_SYSTEM_DIR=",
30    "CLANG_CONFIG_FILE_USER_DIR=",
31    "CLANG_SPAWN_CC1=",
32    "DEFAULT_SYSROOT=",
33    "GCC_INSTALL_PREFIX=",
34    "BACKEND_PACKAGE_STRING=LLVM ${llvm_version}git",
35    "ENABLE_LINKER_BUILD_ID=",
36    "ENABLE_X86_RELAX_RELOCATIONS=1",
37    "CLANG_ENABLE_OBJC_REWRITER=1",  # FIXME: flag?
38    "CLANG_SYSTEMZ_DEFAULT_ARCH=z10",
39  ]
40
41  if (clang_enable_arcmt) {
42    values += [ "CLANG_ENABLE_ARCMT=1" ]
43  } else {
44    values += [ "CLANG_ENABLE_ARCMT=" ]
45  }
46
47  if (clang_enable_static_analyzer) {
48    values += [ "CLANG_ENABLE_STATIC_ANALYZER=1" ]
49  } else {
50    values += [ "CLANG_ENABLE_STATIC_ANALYZER=" ]
51  }
52
53  if (host_os != "win") {
54    values += [ "CLANG_HAVE_RLIMITS=1" ]
55  } else {
56    values += [ "CLANG_HAVE_RLIMITS=" ]
57  }
58
59  if (llvm_enable_libxml2) {
60    values += [ "CLANG_HAVE_LIBXML=1" ]
61  } else {
62    values += [ "CLANG_HAVE_LIBXML=" ]
63  }
64
65  if (host_os == "mac") {
66    # FIXME: Hardcoding this isn't great, but assuming that the host ld version
67    # has anything to do with the ld version where the built clang will run
68    # isn't either. Probably want to make this a declare_args.
69    values += [ "HOST_LINK_VERSION=305" ]
70  } else {
71    values += [ "HOST_LINK_VERSION=" ]
72  }
73
74  # Let targets depending on this find the generated file.
75  public_configs = [ ":Config_config" ]
76}
77