1 import("//llvm/triples.gni")
2 import("//llvm/utils/gn/build/write_cmake_config.gni")
3 import("clang_pseudo_lit_site_cfg_files.gni")
5 template("write_lit_config") {
6 write_cmake_config(target_name) {
8 output = invoker.output
10 "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
11 "LLVM_LIBS_DIR=", # needed only for shared builds
13 values += invoker.extra_values
17 write_lit_config("lit_site_cfg") {
18 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
19 input = "//clang-tools-extra/pseudo/test/lit.site.cfg.py.in"
20 output = clang_pseudo_lit_site_cfg_file
23 "CMAKE_CURRENT_BINARY_DIR=" +
24 rebase_path(get_label_info("//clang-tools-extra/pseudo/test",
26 "CMAKE_CURRENT_SOURCE_DIR=" +
27 rebase_path("//clang-tools-extra/pseudo/test"),
30 "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
31 "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
32 "TARGET_TRIPLE=$llvm_target_triple",
33 "Python3_EXECUTABLE=$python_path",
37 write_lit_config("lit_unit_site_cfg") {
38 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
39 input = "//clang-tools-extra/pseudo/test/Unit/lit.site.cfg.py.in"
40 output = clang_pseudo_lit_unit_site_cfg_file
42 "CMAKE_CURRENT_BINARY_DIR=" +
43 rebase_path(get_label_info("//clang-tools-extra/pseudo/unittests",
45 "CMAKE_CURRENT_SOURCE_DIR=" +
46 rebase_path("//clang-tools-extra/pseudo/test"),
48 if (host_os == "win") {
49 # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
50 extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
52 extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
56 # This target should contain all dependencies of check-pseudo.
57 # //:default depends on it, so that ninja's default target builds all
58 # prerequisites for check-clang but doesn't run check-clang itself.
63 "//clang-tools-extra/pseudo/tool:clang-pseudo",
64 "//clang-tools-extra/pseudo/unittests:ClangPseudoTests",
65 "//llvm/utils/FileCheck",
66 "//llvm/utils/llvm-lit",
72 action("check-clang-pseudo") {
73 script = "$root_out_dir/bin/llvm-lit"
74 if (host_os == "win") {
79 rebase_path(get_path_info(clang_pseudo_lit_site_cfg_file, "dir"),
82 outputs = [ "$target_gen_dir/run-lit" ] # Non-existing, so that ninja runs it
85 # Since check-clang-pseudo is always dirty, //:default doesn't depend on it so
86 # that it's not part of the default ninja target. Hence, check-clang-pseudo
87 # shouldn't have any deps except :test. so that the default target is sure to