bootstrap: Configure cmake when building sanitizer runtimes
This commit is contained in:
parent
2ed25f0697
commit
33e2c1d863
1 changed files with 19 additions and 9 deletions
|
@ -262,7 +262,7 @@ impl Step for Llvm {
|
||||||
cfg.define("PYTHON_EXECUTABLE", python);
|
cfg.define("PYTHON_EXECUTABLE", python);
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_cmake(builder, target, &mut cfg);
|
configure_cmake(builder, target, &mut cfg, true);
|
||||||
|
|
||||||
// FIXME: we don't actually need to build all LLVM tools and all LLVM
|
// FIXME: we don't actually need to build all LLVM tools and all LLVM
|
||||||
// libraries here, e.g., we just want a few components and a few
|
// libraries here, e.g., we just want a few components and a few
|
||||||
|
@ -301,7 +301,12 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
|
||||||
panic!("\n\nbad LLVM version: {}, need >=7.0\n\n", version)
|
panic!("\n\nbad LLVM version: {}, need >=7.0\n\n", version)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure_cmake(builder: &Builder<'_>, target: Interned<String>, cfg: &mut cmake::Config) {
|
fn configure_cmake(
|
||||||
|
builder: &Builder<'_>,
|
||||||
|
target: Interned<String>,
|
||||||
|
cfg: &mut cmake::Config,
|
||||||
|
use_compiler_launcher: bool,
|
||||||
|
) {
|
||||||
// Do not print installation messages for up-to-date files.
|
// Do not print installation messages for up-to-date files.
|
||||||
// LLVM and LLD builds can produce a lot of those and hit CI limits on log size.
|
// LLVM and LLD builds can produce a lot of those and hit CI limits on log size.
|
||||||
cfg.define("CMAKE_INSTALL_MESSAGE", "LAZY");
|
cfg.define("CMAKE_INSTALL_MESSAGE", "LAZY");
|
||||||
|
@ -372,9 +377,11 @@ fn configure_cmake(builder: &Builder<'_>, target: Interned<String>, cfg: &mut cm
|
||||||
} else {
|
} else {
|
||||||
// If ccache is configured we inform the build a little differently how
|
// If ccache is configured we inform the build a little differently how
|
||||||
// to invoke ccache while also invoking our compilers.
|
// to invoke ccache while also invoking our compilers.
|
||||||
if let Some(ref ccache) = builder.config.ccache {
|
if use_compiler_launcher {
|
||||||
cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache)
|
if let Some(ref ccache) = builder.config.ccache {
|
||||||
.define("CMAKE_CXX_COMPILER_LAUNCHER", ccache);
|
cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache)
|
||||||
|
.define("CMAKE_CXX_COMPILER_LAUNCHER", ccache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc))
|
cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc))
|
||||||
.define("CMAKE_CXX_COMPILER", sanitize_cc(cxx));
|
.define("CMAKE_CXX_COMPILER", sanitize_cc(cxx));
|
||||||
|
@ -458,7 +465,7 @@ impl Step for Lld {
|
||||||
t!(fs::create_dir_all(&out_dir));
|
t!(fs::create_dir_all(&out_dir));
|
||||||
|
|
||||||
let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld"));
|
let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld"));
|
||||||
configure_cmake(builder, target, &mut cfg);
|
configure_cmake(builder, target, &mut cfg, true);
|
||||||
|
|
||||||
// This is an awful, awful hack. Discovered when we migrated to using
|
// This is an awful, awful hack. Discovered when we migrated to using
|
||||||
// clang-cl to compile LLVM/LLD it turns out that LLD, when built out of
|
// clang-cl to compile LLVM/LLD it turns out that LLD, when built out of
|
||||||
|
@ -595,10 +602,7 @@ impl Step for Sanitizers {
|
||||||
let _time = util::timeit(&builder);
|
let _time = util::timeit(&builder);
|
||||||
|
|
||||||
let mut cfg = cmake::Config::new(&compiler_rt_dir);
|
let mut cfg = cmake::Config::new(&compiler_rt_dir);
|
||||||
cfg.target(&self.target);
|
|
||||||
cfg.host(&builder.config.build);
|
|
||||||
cfg.profile("Release");
|
cfg.profile("Release");
|
||||||
|
|
||||||
cfg.define("CMAKE_C_COMPILER_TARGET", self.target);
|
cfg.define("CMAKE_C_COMPILER_TARGET", self.target);
|
||||||
cfg.define("COMPILER_RT_BUILD_BUILTINS", "OFF");
|
cfg.define("COMPILER_RT_BUILD_BUILTINS", "OFF");
|
||||||
cfg.define("COMPILER_RT_BUILD_CRT", "OFF");
|
cfg.define("COMPILER_RT_BUILD_CRT", "OFF");
|
||||||
|
@ -610,6 +614,12 @@ impl Step for Sanitizers {
|
||||||
cfg.define("COMPILER_RT_USE_LIBCXX", "OFF");
|
cfg.define("COMPILER_RT_USE_LIBCXX", "OFF");
|
||||||
cfg.define("LLVM_CONFIG_PATH", &llvm_config);
|
cfg.define("LLVM_CONFIG_PATH", &llvm_config);
|
||||||
|
|
||||||
|
// On Darwin targets the sanitizer runtimes are build as universal binaries.
|
||||||
|
// Unfortunately sccache currently lacks support to build them successfully.
|
||||||
|
// Disable compiler launcher on Darwin targets to avoid potential issues.
|
||||||
|
let use_compiler_launcher = !self.target.contains("apple-darwin");
|
||||||
|
configure_cmake(builder, self.target, &mut cfg, use_compiler_launcher);
|
||||||
|
|
||||||
t!(fs::create_dir_all(&out_dir));
|
t!(fs::create_dir_all(&out_dir));
|
||||||
cfg.out_dir(out_dir);
|
cfg.out_dir(out_dir);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue