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