1 import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
2 import("//llvm/triples.gni")
3 import("//llvm/utils/gn/build/write_cmake_config.gni")
4 import("clang_tools_extra_lit_site_cfg_files.gni")
6 template("write_lit_config") {
7 write_cmake_config(target_name) {
9 output = invoker.output
11 "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
12 "CLANG_TOOLS_BINARY_DIR=" +
13 rebase_path(get_label_info("//clang-tools-extra", "target_out_dir")),
14 "CLANG_TOOLS_SOURCE_DIR=" + rebase_path("//clang-tools-extra"),
15 "LLVM_LIBS_DIR=", # needed only for shared builds
16 "TARGET_TRIPLE=$llvm_target_triple",
18 if (host_os == "win") {
19 # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
20 values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
22 values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
24 values += invoker.extra_values
28 write_lit_config("lit_site_cfg") {
29 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
30 input = "//clang-tools-extra/test/lit.site.cfg.py.in"
31 output = clang_tools_extra_lit_site_cfg_file
34 "CLANG_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
35 "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
36 "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
37 "PYTHON_EXECUTABLE=$python_path",
40 if (clang_enable_static_analyzer) {
41 extra_values += [ "CLANG_ENABLE_STATIC_ANALYZER=1" ]
43 extra_values += [ "CLANG_ENABLE_STATIC_ANALYZER=0" ]
47 write_lit_config("lit_unit_site_cfg") {
48 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
49 input = "//clang-tools-extra/test/Unit/lit.site.cfg.py.in"
50 output = clang_tools_extra_lit_unit_site_cfg_file
54 # This target should contain all dependencies of check-clang-tools.
55 # //:default depends on it, so that ninja's default target builds all
56 # prerequisites for check-clang but doesn't run check-clang itself.
61 "//clang-tools-extra/clang-apply-replacements/tool:clang-apply-replacements",
62 "//clang-tools-extra/clang-change-namespace/tool:clang-change-namespace",
63 "//clang-tools-extra/clang-doc/tool:clang-doc",
64 "//clang-tools-extra/clang-include-fixer/find-all-symbols/tool:find-all-symbols",
65 "//clang-tools-extra/clang-include-fixer/tool:clang-include-fixer",
66 "//clang-tools-extra/clang-move/tool:clang-move",
67 "//clang-tools-extra/clang-query/tool:clang-query",
68 "//clang-tools-extra/clang-reorder-fields/tool:clang-reorder-fields",
69 "//clang-tools-extra/clang-tidy/tool:clang-tidy",
70 "//clang-tools-extra/modularize",
71 "//clang-tools-extra/pp-trace",
72 "//clang-tools-extra/unittests",
73 "//clang/lib/Headers",
74 "//clang/tools/c-index-test",
75 "//clang/tools/clang-rename",
76 "//clang/tools/driver:symlinks",
77 "//llvm/tools/llvm-bcanalyzer",
78 "//llvm/utils/FileCheck",
80 "//llvm/utils/llvm-lit",
86 action("check-clang-tools") {
87 script = "$root_out_dir/bin/llvm-lit"
88 if (host_os == "win") {
94 "clang_site_config=" +
95 rebase_path(clang_tools_extra_lit_site_cfg_file, root_out_dir),
97 "clang_unit_site_config=" +
98 rebase_path(clang_tools_extra_lit_unit_site_cfg_file, root_out_dir),
99 rebase_path(".", root_out_dir),
102 "$target_gen_dir/run-lit", # Non-existing, so that ninja runs it each time.
105 # Since check-clang-tools is always dirty, //:default doesn't depend on it so
106 # that it's not part of the default ninja target. Hence, check-clang-tools
107 # shouldn't have any deps except :test. so that the default target is sure to
108 # build all the deps.