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