1 import("//llvm/lib/DebugInfo/PDB/enable_dia.gni")
2 import("//llvm/triples.gni")
3 import("//llvm/utils/gn/build/libs/xar/enable.gni")
4 import("//llvm/utils/gn/build/libs/xml/enable.gni")
5 import("//llvm/utils/gn/build/libs/zlib/enable.gni")
6 import("//llvm/utils/gn/build/write_cmake_config.gni")
7 import("lld_lit_site_cfg_files.gni")
9 # The bits common to writing lit.site.cfg.py.in and Unit/lit.site.cfg.py.in.
10 template("write_lit_cfg") {
11 write_cmake_config(target_name) {
13 output = invoker.output
15 "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
17 rebase_path(get_label_info("//lld", "target_out_dir")),
18 "LLD_LIBS_DIR=", # FIXME: for shared builds only (?)
19 "LLD_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
20 "LLD_SOURCE_DIR=" + rebase_path("//lld"),
22 rebase_path(get_label_info("//llvm", "target_out_dir")),
23 "LLVM_LIBS_DIR=", # needed only for shared builds
24 "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
25 "LLVM_SOURCE_DIR=" + rebase_path("//llvm"),
26 "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
27 "Python3_EXECUTABLE=$python_path",
28 "TARGET_TRIPLE=$llvm_target_triple",
30 values += invoker.extra_values
34 write_lit_cfg("lit_site_cfg") {
35 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
36 input = "//lld/test/lit.site.cfg.py.in"
37 output = lld_lit_site_cfg_file
39 extra_values = [ "LLD_DEFAULT_LD_LLD_IS_MINGW=0" ] # Must be 0.
41 if (host_os == "win") {
43 [ "LLVM_LIT_ERRC_MESSAGES=no such file or directory;is a directory;" +
44 "invalid argument;permission denied" ]
46 extra_values += [ "LLVM_LIT_ERRC_MESSAGES=" ]
49 if (llvm_enable_dia_sdk) {
50 extra_values += [ "LLVM_ENABLE_DIA_SDK=1" ]
52 extra_values += [ "LLVM_ENABLE_DIA_SDK=0" ] # Must be 0.
55 if (llvm_enable_libxar) {
56 extra_values += [ "LLVM_HAVE_LIBXAR=1" ]
58 extra_values += [ "LLVM_HAVE_LIBXAR=0" ] # Must be 0.
61 if (llvm_enable_libxml2) {
62 extra_values += [ "LLVM_ENABLE_LIBXML2=1" ]
64 extra_values += [ "LLVM_ENABLE_LIBXML2=0" ] # Must be 0.
67 if (llvm_enable_zlib) {
68 extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
70 extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
73 if (current_cpu == "x64" || current_cpu == "arm64" ||
74 current_cpu == "ppc64") {
75 extra_values += [ "CMAKE_SIZEOF_VOID_P=8" ]
77 extra_values += [ "CMAKE_SIZEOF_VOID_P=4" ]
81 write_lit_cfg("lit_unit_site_cfg") {
82 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
83 input = "//lld/test/Unit/lit.site.cfg.py.in"
84 output = lld_lit_unit_site_cfg_file
85 extra_values = [ "LLVM_BUILD_MODE=." ]
88 # This target should contain all dependencies of check-lld.
89 # //:default depends on it, so that ninja's default target builds all
90 # prerequisites for check-lld but doesn't run check-lld itself.
95 "//lld/tools/lld:symlinks",
97 "//llvm/tools/dsymutil",
99 "//llvm/tools/llvm-ar:symlinks",
100 "//llvm/tools/llvm-as",
101 "//llvm/tools/llvm-bcanalyzer",
102 "//llvm/tools/llvm-cvtres",
103 "//llvm/tools/llvm-dis",
104 "//llvm/tools/llvm-dwarfdump",
105 "//llvm/tools/llvm-lipo",
106 "//llvm/tools/llvm-mc",
107 "//llvm/tools/llvm-nm:symlinks",
108 "//llvm/tools/llvm-objcopy:symlinks",
109 "//llvm/tools/llvm-objdump:symlinks",
110 "//llvm/tools/llvm-pdbutil",
111 "//llvm/tools/llvm-readobj:symlinks",
112 "//llvm/tools/llvm-symbolizer:symlinks",
113 "//llvm/tools/obj2yaml",
115 "//llvm/tools/split-file",
116 "//llvm/tools/yaml2obj",
117 "//llvm/utils/FileCheck",
118 "//llvm/utils/count",
119 "//llvm/utils/llvm-lit",
125 # This is the action that runs all of lld's tests, check-lld.
126 action("check-lld") {
127 script = "$root_out_dir/bin/llvm-lit"
128 if (host_os == "win") {
133 rebase_path(".", root_out_dir),
135 outputs = [ "$target_gen_dir/run-lit" ] # Non-existing, so that ninja runs it
138 # Since check-lld is always dirty, //:default doesn't depend on it so that
139 # it's not part of the default ninja target. Hence, check-lld shouldn't
140 # have any deps except :test, so that the default target is sure to build