1 import("//llvm/lib/DebugInfo/PDB/enable_dia.gni")
2 import("//llvm/triples.gni")
3 import("//llvm/utils/gn/build/libs/xml/enable.gni")
4 import("//llvm/utils/gn/build/libs/zlib/enable.gni")
5 import("//llvm/utils/gn/build/write_cmake_config.gni")
6 import("lld_lit_site_cfg_files.gni")
8 # The bits common to writing lit.site.cfg.py.in and Unit/lit.site.cfg.py.in.
9 template("write_lit_cfg") {
10 write_cmake_config(target_name) {
12 output = invoker.output
14 "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
16 rebase_path(get_label_info("//lld", "target_out_dir")),
17 "LLD_SOURCE_DIR=" + rebase_path("//lld"),
19 rebase_path(get_label_info("//llvm", "target_out_dir")),
20 "LLVM_LIBRARY_OUTPUT_INTDIR=", # FIXME: for shared builds only (?)
21 "LLVM_LIBS_DIR=", # needed only for shared builds
22 "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
23 "LLVM_RUNTIME_OUTPUT_INTDIR=" + rebase_path("$root_out_dir/bin"),
24 "LLVM_SOURCE_DIR=" + rebase_path("//llvm"),
25 "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
26 "PYTHON_EXECUTABLE=$python_path",
27 "TARGET_TRIPLE=$llvm_target_triple",
29 values += invoker.extra_values
33 write_lit_cfg("lit_site_cfg") {
34 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
35 input = "//lld/test/lit.site.cfg.py.in"
36 output = lld_lit_site_cfg_file
39 if (llvm_enable_dia_sdk) {
40 extra_values += [ "LLVM_ENABLE_DIA_SDK=1" ]
42 extra_values += [ "LLVM_ENABLE_DIA_SDK=0" ] # Must be 0.
45 if (llvm_enable_libxml2) {
46 extra_values += [ "LLVM_LIBXML2_ENABLED=1" ]
48 extra_values += [ "LLVM_LIBXML2_ENABLED=0" ] # Must be 0.
51 if (llvm_enable_zlib) {
52 extra_values += [ "HAVE_LIBZ=1" ]
54 extra_values += [ "HAVE_LIBZ=0" ] # Must be 0.
57 if (current_cpu == "x64" || current_cpu == "arm64" ||
58 current_cpu == "ppc64") {
59 extra_values += [ "CMAKE_SIZEOF_VOID_P=8" ]
61 extra_values += [ "CMAKE_SIZEOF_VOID_P=4" ]
65 write_lit_cfg("lit_unit_site_cfg") {
66 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
67 input = "//lld/test/Unit/lit.site.cfg.py.in"
68 output = lld_lit_unit_site_cfg_file
69 extra_values = [ "LLVM_BUILD_MODE=." ]
72 # This target should contain all dependencies of check-lld.
73 # //:default depends on it, so that ninja's default target builds all
74 # prerequisites for check-lld but doesn't run check-lld itself.
79 "//lld/tools/lld:symlinks",
82 "//llvm/tools/llvm-ar:symlinks",
83 "//llvm/tools/llvm-as",
84 "//llvm/tools/llvm-bcanalyzer",
85 "//llvm/tools/llvm-cvtres",
86 "//llvm/tools/llvm-dis",
87 "//llvm/tools/llvm-dwarfdump",
88 "//llvm/tools/llvm-mc",
89 "//llvm/tools/llvm-nm:symlinks",
90 "//llvm/tools/llvm-objcopy:symlinks",
91 "//llvm/tools/llvm-objdump:symlinks",
92 "//llvm/tools/llvm-pdbutil",
93 "//llvm/tools/llvm-readobj:symlinks",
94 "//llvm/tools/obj2yaml",
96 "//llvm/tools/yaml2obj",
97 "//llvm/utils/FileCheck",
99 "//llvm/utils/llvm-lit",
105 # This is the action that runs all of lld's tests, check-lld.
106 action("check-lld") {
107 script = "$root_out_dir/bin/llvm-lit"
108 if (host_os == "win") {
114 "lld_site_config=" + rebase_path(lld_lit_site_cfg_file, root_out_dir),
116 "lld_unit_site_config=" +
117 rebase_path(lld_lit_unit_site_cfg_file, root_out_dir),
118 rebase_path(".", root_out_dir),
121 "$target_gen_dir/run-lit", # Non-existing, so that ninja runs it each time.
124 # Since check-lld is always dirty, //:default doesn't depend on it so that
125 # it's not part of the default ninja target. Hence, check-lld shouldn't
126 # have any deps except :test, so that the default target is sure to build