Skip to content

Commit d79e19f

Browse files
committed
Don't require cmake and ninja when the LLVM backend is not used
1 parent 16f69b5 commit d79e19f

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

src/bootstrap/sanity.rs

+20-16
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use std::process::Command;
1717

1818
use build_helper::{output, t};
1919

20+
use crate::cache::INTERNER;
2021
use crate::config::Target;
2122
use crate::Build;
2223

@@ -79,18 +80,19 @@ pub fn check(build: &mut Build) {
7980
}
8081

8182
// We need cmake, but only if we're actually building LLVM or sanitizers.
82-
let building_llvm = build
83-
.hosts
84-
.iter()
85-
.map(|host| {
86-
build
87-
.config
88-
.target_config
89-
.get(host)
90-
.map(|config| config.llvm_config.is_none())
91-
.unwrap_or(true)
92-
})
93-
.any(|build_llvm_ourselves| build_llvm_ourselves);
83+
let building_llvm = build.config.rust_codegen_backends.contains(&INTERNER.intern_str("llvm"))
84+
&& build
85+
.hosts
86+
.iter()
87+
.map(|host| {
88+
build
89+
.config
90+
.target_config
91+
.get(host)
92+
.map(|config| config.llvm_config.is_none())
93+
.unwrap_or(true)
94+
})
95+
.any(|build_llvm_ourselves| build_llvm_ourselves);
9496
if building_llvm || build.config.any_sanitizers_enabled() {
9597
cmd_finder.must_have("cmake");
9698
}
@@ -147,10 +149,12 @@ pub fn check(build: &mut Build) {
147149
}
148150
}
149151

150-
// Externally configured LLVM requires FileCheck to exist
151-
let filecheck = build.llvm_filecheck(build.build);
152-
if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests {
153-
panic!("FileCheck executable {:?} does not exist", filecheck);
152+
if build.config.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) {
153+
// Externally configured LLVM requires FileCheck to exist
154+
let filecheck = build.llvm_filecheck(build.build);
155+
if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests {
156+
panic!("FileCheck executable {:?} does not exist", filecheck);
157+
}
154158
}
155159

156160
for target in &build.targets {

0 commit comments

Comments
 (0)