mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
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
This commit is contained in:
commit
d1f1f38c0e
4
src/bootstrap/Cargo.lock
generated
4
src/bootstrap/Cargo.lock
generated
@ -3,7 +3,7 @@ name = "bootstrap"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build_helper 0.1.0",
|
"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)",
|
"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)",
|
"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)",
|
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -21,7 +21,7 @@ version = "0.1.0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cmake"
|
name = "cmake"
|
||||||
version = "0.1.16"
|
version = "0.1.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -21,7 +21,7 @@ path = "rustdoc.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
build_helper = { path = "../build_helper" }
|
build_helper = { path = "../build_helper" }
|
||||||
cmake = "0.1.10"
|
cmake = "0.1.17"
|
||||||
filetime = "0.1"
|
filetime = "0.1"
|
||||||
num_cpus = "0.2"
|
num_cpus = "0.2"
|
||||||
toml = "0.1"
|
toml = "0.1"
|
||||||
|
@ -31,6 +31,7 @@ use toml::{Parser, Decoder, Value};
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub ccache: bool,
|
pub ccache: bool,
|
||||||
|
pub ninja: bool,
|
||||||
pub verbose: bool,
|
pub verbose: bool,
|
||||||
pub submodules: bool,
|
pub submodules: bool,
|
||||||
pub compiler_docs: bool,
|
pub compiler_docs: bool,
|
||||||
@ -107,6 +108,7 @@ struct Build {
|
|||||||
#[derive(RustcDecodable, Default)]
|
#[derive(RustcDecodable, Default)]
|
||||||
struct Llvm {
|
struct Llvm {
|
||||||
ccache: Option<bool>,
|
ccache: Option<bool>,
|
||||||
|
ninja: Option<bool>,
|
||||||
assertions: Option<bool>,
|
assertions: Option<bool>,
|
||||||
optimize: Option<bool>,
|
optimize: Option<bool>,
|
||||||
version_check: Option<bool>,
|
version_check: Option<bool>,
|
||||||
@ -200,9 +202,9 @@ impl Config {
|
|||||||
|
|
||||||
if let Some(ref llvm) = toml.llvm {
|
if let Some(ref llvm) = toml.llvm {
|
||||||
set(&mut config.ccache, llvm.ccache);
|
set(&mut config.ccache, llvm.ccache);
|
||||||
|
set(&mut config.ninja, llvm.ninja);
|
||||||
set(&mut config.llvm_assertions, llvm.assertions);
|
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_optimize, llvm.optimize);
|
|
||||||
set(&mut config.llvm_version_check, llvm.version_check);
|
set(&mut config.llvm_version_check, llvm.version_check);
|
||||||
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,9 @@ pub fn llvm(build: &Build, target: &str) {
|
|||||||
|
|
||||||
// http://llvm.org/docs/CMake.html
|
// http://llvm.org/docs/CMake.html
|
||||||
let mut cfg = cmake::Config::new(build.src.join("src/llvm"));
|
let mut cfg = cmake::Config::new(build.src.join("src/llvm"));
|
||||||
|
if build.config.ninja {
|
||||||
|
cfg.generator("Ninja");
|
||||||
|
}
|
||||||
cfg.target(target)
|
cfg.target(target)
|
||||||
.host(&build.config.build)
|
.host(&build.config.build)
|
||||||
.out_dir(&dst)
|
.out_dir(&dst)
|
||||||
|
@ -48,6 +48,9 @@ pub fn check(build: &mut Build) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
need_cmd("cmake".as_ref());
|
need_cmd("cmake".as_ref());
|
||||||
|
if build.config.ninja {
|
||||||
|
need_cmd("ninja".as_ref())
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user