Skip to content

Commit

Permalink
rustbuild: Sanity-check cmake for sanitizers too
Browse files Browse the repository at this point in the history
It's possible to build the sanitizers when using an external LLVM, but
we still need cmake for this.  Extend the sanity check to look for cmake
whenever sanitizers are enabled too.
  • Loading branch information
cuviper committed May 2, 2017
1 parent 96e2c34 commit 1ed07ba
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/bootstrap/sanity.rs
Expand Up @@ -69,22 +69,21 @@ pub fn check(build: &mut Build) {
need_cmd("git".as_ref());
}

// We need cmake, but only if we're actually building LLVM
for host in build.config.host.iter() {
if let Some(config) = build.config.target_config.get(host) {
if config.llvm_config.is_some() {
continue
}
}
// We need cmake, but only if we're actually building LLVM or sanitizers.
let building_llvm = build.config.host.iter()
.filter_map(|host| build.config.target_config.get(host))
.any(|config| config.llvm_config.is_none());
if building_llvm || build.config.sanitizers {
need_cmd("cmake".as_ref());
if build.config.ninja {
// Some Linux distros rename `ninja` to `ninja-build`.
// CMake can work with either binary name.
if have_cmd("ninja-build".as_ref()).is_none() {
need_cmd("ninja".as_ref());
}
}

// Ninja is currently only used for LLVM itself.
if building_llvm && build.config.ninja {
// Some Linux distros rename `ninja` to `ninja-build`.
// CMake can work with either binary name.
if have_cmd("ninja-build".as_ref()).is_none() {
need_cmd("ninja".as_ref());
}
break
}

if build.config.python.is_none() {
Expand Down

0 comments on commit 1ed07ba

Please sign in to comment.