| import("//clang/test/clang_lit_site_cfg_files.gni") |
| import("//lld/test/lld_lit_site_cfg_files.gni") |
| import("//llvm/test/llvm_lit_site_cfg_files.gni") |
| import("//llvm/utils/gn/build/write_cmake_config.gni") |
| |
| write_cmake_config("llvm-lit") { |
| input = "llvm-lit.in" |
| output = "$root_out_dir/bin/llvm-lit" |
| |
| if (host_os == "win") { |
| # llvm-lit needs suffix.py for multiprocess to find a main module. |
| output = "${output}.py" |
| } |
| |
| # lit's lit/llvm/config.py shells out to llvm-config. |
| deps = [ |
| "//llvm/tools/llvm-config", |
| ] |
| |
| # Generate LLVM_LIT_CONFIG_MAP parameter. |
| # llvm-lit contains a mapping from each lit.cfg.py file to the corresponding |
| # generated llvm.site.cfg.py file, so llvm-lit depends on all the targets to |
| # generate the site.cfg.py file. |
| config_map = "" |
| |
| deps += [ |
| "//clang/test:lit_site_cfg", |
| "//clang/test:lit_unit_site_cfg", |
| "//lld/test:lit_site_cfg", |
| "//lld/test:lit_unit_site_cfg", |
| "//llvm/test:lit_site_cfg", |
| "//llvm/test:lit_unit_site_cfg", |
| ] |
| |
| # Note: \n is converted into a newline by write_cmake_config.py, not by gn. |
| config_map += "map_config('" + rebase_path("//clang/test/lit.cfg.py") + |
| "', '" + rebase_path(clang_lit_site_cfg_file) + "')\n" |
| config_map += "map_config('" + rebase_path("//clang/test/Unit/lit.cfg.py") + |
| "', '" + rebase_path(clang_lit_unit_site_cfg_file) + "')\n" |
| config_map += "map_config('" + rebase_path("//lld/test/lit.cfg.py") + "', '" + |
| rebase_path(lld_lit_site_cfg_file) + "')\n" |
| config_map += "map_config('" + rebase_path("//lld/test/Unit/lit.cfg.py") + |
| "', '" + rebase_path(lld_lit_unit_site_cfg_file) + "')\n" |
| config_map += "map_config('" + rebase_path("//llvm/test/lit.cfg.py") + |
| "', '" + rebase_path(llvm_lit_site_cfg_file) + "')\n" |
| config_map += "map_config('" + rebase_path("//llvm/test/Unit/lit.cfg.py") + |
| "', '" + rebase_path(llvm_lit_unit_site_cfg_file) + "')\n" |
| |
| values = [ |
| "LLVM_SOURCE_DIR=" + rebase_path("//llvm"), |
| "LLVM_BINARY_DIR=" + |
| rebase_path(get_label_info("//llvm", "target_out_dir")), |
| "BUILD_MODE=.", |
| "LLVM_LIT_CONFIG_MAP=" + config_map, |
| ] |
| } |