import lit.util
config.have_dia_sdk = lit.util.pythonize_bool("@LLVM_ENABLE_DIA_SDK@")
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.llvm_obj_root = "@LLVM_BINARY_DIR@"
-config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
-config.llvm_libs_dir = lit_config.substitute("@LLVM_LIBS_DIR@")
-config.llvm_shlib_dir = "@SHLIBDIR@"
+config.llvm_src_root = path(r"@LLVM_SOURCE_DIR@")
+config.llvm_obj_root = path(r"@LLVM_BINARY_DIR@")
+config.llvm_tools_dir = lit_config.substitute(path(r"@LLVM_TOOLS_DIR@"))
+config.llvm_libs_dir = lit_config.substitute(path(r"@LLVM_LIBS_DIR@"))
+config.llvm_shlib_dir = path(r"@SHLIBDIR@")
config.llvm_shlib_ext = "@SHLIBEXT@"
-config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
+config.lit_tools_dir = path(r"@LLVM_LIT_TOOLS_DIR@")
config.enable_backtrace = @ENABLE_BACKTRACES@
config.errc_messages = "@LLVM_LIT_ERRC_MESSAGES@"
-config.lld_obj_root = "@LLD_BINARY_DIR@"
-config.lld_libs_dir = lit_config.substitute("@CURRENT_LIBS_DIR@")
-config.lld_tools_dir = lit_config.substitute("@CURRENT_TOOLS_DIR@")
+config.lld_obj_root = path(r"@LLD_BINARY_DIR@")
+config.lld_libs_dir = lit_config.substitute(path(r"@CURRENT_LIBS_DIR@"))
+config.lld_tools_dir = lit_config.substitute(path(r"@CURRENT_TOOLS_DIR@"))
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@LLVM_TARGET_TRIPLE@"
config.python_executable = "@Python3_EXECUTABLE@"
lit.llvm.initialize(lit_config, config)
# Let the main config do the real work.
-lit_config.load_config(config, "@LLD_SOURCE_DIR@/test/lit.cfg.py")
+lit_config.load_config(
+ config, os.path.join(path(r"@LLD_SOURCE_DIR@"), "test/lit.cfg.py"))
write_cmake_config(target_name) {
input = invoker.input
output = invoker.output
+ dir = get_path_info(output, "dir")
values = [
"LIT_SITE_CFG_IN_HEADER=" +
"## Autogenerated from $input, do not edit\n\n" + lit_path_function,
"LLD_BINARY_DIR=" +
- rebase_path(get_label_info("//lld", "target_out_dir")),
- "LLD_SOURCE_DIR=" + rebase_path("//lld"),
+ rebase_path(get_label_info("//lld", "target_out_dir"), dir),
+ "LLD_SOURCE_DIR=" + rebase_path("//lld", dir),
]
+ if (host_os == "win") {
+ # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
+ values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin", dir) ]
+ } else {
+ values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib", dir) ]
+ }
values += invoker.extra_values
}
}
extra_values = [
"CURRENT_LIBS_DIR=", # FIXME: for shared builds only (?)
- "CURRENT_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+ "CURRENT_TOOLS_DIR=" + rebase_path("$root_out_dir/bin", dir),
"ENABLE_BACKTRACES=1",
"LLVM_BINARY_DIR=" +
- rebase_path(get_label_info("//llvm", "target_out_dir")),
+ rebase_path(get_label_info("//llvm", "target_out_dir"), dir),
"LLVM_HOST_TRIPLE=$llvm_current_triple",
"LLVM_LIBS_DIR=", # needed only for shared builds
"LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
- "LLVM_SOURCE_DIR=" + rebase_path("//llvm"),
- "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+ "LLVM_SOURCE_DIR=" + rebase_path("//llvm", dir),
+ "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin", dir),
"Python3_EXECUTABLE=$python_path",
"LLVM_TARGET_TRIPLE=$llvm_target_triple",
"LLVM_LIT_ERRC_MESSAGES=no such file or directory;is a directory;" +
"invalid argument;permission denied",
"LLVM_ENABLE_PLUGINS=0",
-
- # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
- "SHLIBDIR=" + rebase_path("$root_out_dir/bin", dir),
]
} else {
extra_values += [
"LLVM_LIT_ERRC_MESSAGES=",
"LLVM_ENABLE_PLUGINS=1",
- "SHLIBDIR=" + rebase_path("$root_out_dir/lib", dir),
]
}
input = "//lld/test/Unit/lit.site.cfg.py.in"
output = lld_lit_unit_site_cfg_file
extra_values = [ "LLVM_BUILD_MODE=." ]
- dir = get_path_info(output, "dir")
- if (host_os == "win") {
- # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
- extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin", dir) ]
- } else {
- extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib", dir) ]
- }
}
# This target should contain all dependencies of check-lld.