about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2016-04-14 14:49:09 -0400
committerSteve Klabnik <steve@steveklabnik.com>2016-04-14 14:49:09 -0400
commitd1f1f38c0e9e8311bae50608eeaeb44fa83c1ffe (patch)
treea318a390b3145c45432adcfae853743ea93290fa /src/bootstrap
parenteae0b72ad830526f2492f554b70242e4d6df3ed4 (diff)
parent7dd0bebff406dae343b8ae1b242940284986526d (diff)
Rollup merge of #32865 - caipre:llvm-ninja, r=alexcrichton
Add rustbuild option to use Ninja for LLVM build

This change adds support for a `ninja` option in the `[llvm]` section of rustbuild's `config.toml`. When `true`, the option enables use of the Ninja build tool. Note that this change does not add support for Ninja to the old makefile based build system.

Closes https://github.com/rust-lang/rust/issues/32809

r? @alexcrichton
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/Cargo.lock4
-rw-r--r--src/bootstrap/Cargo.toml2
-rw-r--r--src/bootstrap/build/config.rs4
-rw-r--r--src/bootstrap/build/native.rs3
-rw-r--r--src/bootstrap/build/sanity.rs3
5 files changed, 12 insertions, 4 deletions
diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock
index c33838a146c..9bb3e79744b 100644
--- a/src/bootstrap/Cargo.lock
+++ b/src/bootstrap/Cargo.lock
@@ -3,7 +3,7 @@ name = "bootstrap"
 version = "0.0.0"
 dependencies = [
  "build_helper 0.1.0",
- "cmake 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
  "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -21,7 +21,7 @@ version = "0.1.0"
 
 [[package]]
 name = "cmake"
-version = "0.1.16"
+version = "0.1.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml
index 0d334219b4f..7b379e1c7b6 100644
--- a/src/bootstrap/Cargo.toml
+++ b/src/bootstrap/Cargo.toml
@@ -21,7 +21,7 @@ path = "rustdoc.rs"
 
 [dependencies]
 build_helper = { path = "../build_helper" }
-cmake = "0.1.10"
+cmake = "0.1.17"
 filetime = "0.1"
 num_cpus = "0.2"
 toml = "0.1"
diff --git a/src/bootstrap/build/config.rs b/src/bootstrap/build/config.rs
index 1e67c4a9a3e..98fdaae64a5 100644
--- a/src/bootstrap/build/config.rs
+++ b/src/bootstrap/build/config.rs
@@ -31,6 +31,7 @@ use toml::{Parser, Decoder, Value};
 #[derive(Default)]
 pub struct Config {
     pub ccache: bool,
+    pub ninja: bool,
     pub verbose: bool,
     pub submodules: bool,
     pub compiler_docs: bool,
@@ -107,6 +108,7 @@ struct Build {
 #[derive(RustcDecodable, Default)]
 struct Llvm {
     ccache: Option<bool>,
+    ninja: Option<bool>,
     assertions: Option<bool>,
     optimize: Option<bool>,
     version_check: Option<bool>,
@@ -200,9 +202,9 @@ impl Config {
 
         if let Some(ref llvm) = toml.llvm {
             set(&mut config.ccache, llvm.ccache);
+            set(&mut config.ninja, llvm.ninja);
             set(&mut config.llvm_assertions, llvm.assertions);
             set(&mut config.llvm_optimize, llvm.optimize);
-            set(&mut config.llvm_optimize, llvm.optimize);
             set(&mut config.llvm_version_check, llvm.version_check);
             set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
         }
diff --git a/src/bootstrap/build/native.rs b/src/bootstrap/build/native.rs
index bf0494bcd8c..91bc0924b1f 100644
--- a/src/bootstrap/build/native.rs
+++ b/src/bootstrap/build/native.rs
@@ -43,6 +43,9 @@ pub fn llvm(build: &Build, target: &str) {
 
     // http://llvm.org/docs/CMake.html
     let mut cfg = cmake::Config::new(build.src.join("src/llvm"));
+    if build.config.ninja {
+        cfg.generator("Ninja");
+    }
     cfg.target(target)
        .host(&build.config.build)
        .out_dir(&dst)
diff --git a/src/bootstrap/build/sanity.rs b/src/bootstrap/build/sanity.rs
index 6ce27496388..50fd9c24538 100644
--- a/src/bootstrap/build/sanity.rs
+++ b/src/bootstrap/build/sanity.rs
@@ -48,6 +48,9 @@ pub fn check(build: &mut Build) {
             }
         }
         need_cmd("cmake".as_ref());
+        if build.config.ninja {
+            need_cmd("ninja".as_ref())
+        }
         break
     }