Don't require cmake and ninja when the LLVM backend is not used

This commit is contained in:
bjorn3 2020-12-12 18:13:04 +01:00
parent 16f69b5430
commit d79e19f332

View File

@ -17,6 +17,7 @@ use std::process::Command;
use build_helper::{output, t};
use crate::cache::INTERNER;
use crate::config::Target;
use crate::Build;
@ -79,18 +80,19 @@ pub fn check(build: &mut Build) {
}
// We need cmake, but only if we're actually building LLVM or sanitizers.
let building_llvm = build
.hosts
.iter()
.map(|host| {
build
.config
.target_config
.get(host)
.map(|config| config.llvm_config.is_none())
.unwrap_or(true)
})
.any(|build_llvm_ourselves| build_llvm_ourselves);
let building_llvm = build.config.rust_codegen_backends.contains(&INTERNER.intern_str("llvm"))
&& build
.hosts
.iter()
.map(|host| {
build
.config
.target_config
.get(host)
.map(|config| config.llvm_config.is_none())
.unwrap_or(true)
})
.any(|build_llvm_ourselves| build_llvm_ourselves);
if building_llvm || build.config.any_sanitizers_enabled() {
cmd_finder.must_have("cmake");
}
@ -147,10 +149,12 @@ pub fn check(build: &mut Build) {
}
}
// Externally configured LLVM requires FileCheck to exist
let filecheck = build.llvm_filecheck(build.build);
if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests {
panic!("FileCheck executable {:?} does not exist", filecheck);
if build.config.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) {
// Externally configured LLVM requires FileCheck to exist
let filecheck = build.llvm_filecheck(build.build);
if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests {
panic!("FileCheck executable {:?} does not exist", filecheck);
}
}
for target in &build.targets {