1
Fork 0

Rollup merge of #37690 - TimNN:llvm-rel-dbg, r=alexcrichton

rustbuild: support RelWithDebInfo for llvm

r? @alexcrichton
This commit is contained in:
Eduard-Mihai Burtescu 2016-11-12 10:38:41 +02:00 committed by GitHub
commit 220ff76e0b
3 changed files with 14 additions and 1 deletions

View file

@ -50,6 +50,7 @@ pub struct Config {
// llvm codegen options // llvm codegen options
pub llvm_assertions: bool, pub llvm_assertions: bool,
pub llvm_optimize: bool, pub llvm_optimize: bool,
pub llvm_release_debuginfo: bool,
pub llvm_version_check: bool, pub llvm_version_check: bool,
pub llvm_static_stdcpp: bool, pub llvm_static_stdcpp: bool,
@ -137,6 +138,7 @@ struct Llvm {
ninja: Option<bool>, ninja: Option<bool>,
assertions: Option<bool>, assertions: Option<bool>,
optimize: Option<bool>, optimize: Option<bool>,
release_debuginfo: Option<bool>,
version_check: Option<bool>, version_check: Option<bool>,
static_libstdcpp: Option<bool>, static_libstdcpp: Option<bool>,
} }
@ -243,6 +245,7 @@ impl Config {
set(&mut config.ninja, llvm.ninja); 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_release_debuginfo, llvm.release_debuginfo);
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);
} }

View file

@ -17,6 +17,9 @@
# Indicates whether the LLVM build is a Release or Debug build # Indicates whether the LLVM build is a Release or Debug build
#optimize = true #optimize = true
# Indicates whether an LLVM Release build should include debug info
#release-debuginfo = false
# Indicates whether the LLVM assertions are enabled or not # Indicates whether the LLVM assertions are enabled or not
#assertions = false #assertions = false

View file

@ -67,10 +67,17 @@ pub fn llvm(build: &Build, target: &str) {
if build.config.ninja { if build.config.ninja {
cfg.generator("Ninja"); cfg.generator("Ninja");
} }
let profile = match (build.config.llvm_optimize, build.config.llvm_release_debuginfo) {
(false, _) => "Debug",
(true, false) => "Release",
(true, true) => "RelWithDebInfo",
};
cfg.target(target) cfg.target(target)
.host(&build.config.build) .host(&build.config.build)
.out_dir(&dst) .out_dir(&dst)
.profile(if build.config.llvm_optimize {"Release"} else {"Debug"}) .profile(profile)
.define("LLVM_ENABLE_ASSERTIONS", assertions) .define("LLVM_ENABLE_ASSERTIONS", assertions)
.define("LLVM_TARGETS_TO_BUILD", "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend") .define("LLVM_TARGETS_TO_BUILD", "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend")
.define("LLVM_INCLUDE_EXAMPLES", "OFF") .define("LLVM_INCLUDE_EXAMPLES", "OFF")