mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
add two new build flags to build clang and enable llvm plugins
This commit is contained in:
parent
29f8de06d1
commit
8f6827ffb7
@ -68,6 +68,9 @@ changelog-seen = 2
|
||||
# Indicates whether the LLVM assertions are enabled or not
|
||||
#assertions = false
|
||||
|
||||
# Indicates whether the LLVM plugin is enabled or not
|
||||
#plugins = false
|
||||
|
||||
# Indicates whether ccache is used when building LLVM
|
||||
#ccache = false
|
||||
# or alternatively ...
|
||||
@ -145,6 +148,9 @@ changelog-seen = 2
|
||||
# Whether to include the Polly optimizer.
|
||||
#polly = false
|
||||
|
||||
# Whether to build the clang compiler.
|
||||
#clang = false
|
||||
|
||||
# =============================================================================
|
||||
# General build configuration options
|
||||
# =============================================================================
|
||||
|
@ -90,6 +90,7 @@ pub struct Config {
|
||||
// llvm codegen options
|
||||
pub llvm_skip_rebuild: bool,
|
||||
pub llvm_assertions: bool,
|
||||
pub llvm_plugins: bool,
|
||||
pub llvm_optimize: bool,
|
||||
pub llvm_thin_lto: bool,
|
||||
pub llvm_release_debuginfo: bool,
|
||||
@ -104,6 +105,7 @@ pub struct Config {
|
||||
pub llvm_use_linker: Option<String>,
|
||||
pub llvm_allow_old_toolchain: bool,
|
||||
pub llvm_polly: bool,
|
||||
pub llvm_clang: bool,
|
||||
pub llvm_from_ci: bool,
|
||||
|
||||
pub use_lld: bool,
|
||||
@ -415,6 +417,7 @@ struct Llvm {
|
||||
thin_lto: Option<bool>,
|
||||
release_debuginfo: Option<bool>,
|
||||
assertions: Option<bool>,
|
||||
plugins: Option<bool>,
|
||||
ccache: Option<StringOrBool>,
|
||||
version_check: Option<bool>,
|
||||
static_libstdcpp: Option<bool>,
|
||||
@ -432,6 +435,7 @@ struct Llvm {
|
||||
use_linker: Option<String>,
|
||||
allow_old_toolchain: Option<bool>,
|
||||
polly: Option<bool>,
|
||||
clang: Option<bool>,
|
||||
download_ci_llvm: Option<StringOrBool>,
|
||||
}
|
||||
|
||||
@ -702,6 +706,7 @@ impl Config {
|
||||
// Store off these values as options because if they're not provided
|
||||
// we'll infer default values for them later
|
||||
let mut llvm_assertions = None;
|
||||
let mut llvm_plugins = None;
|
||||
let mut debug = None;
|
||||
let mut debug_assertions = None;
|
||||
let mut debug_assertions_std = None;
|
||||
@ -724,6 +729,7 @@ impl Config {
|
||||
}
|
||||
set(&mut config.ninja_in_file, llvm.ninja);
|
||||
llvm_assertions = llvm.assertions;
|
||||
llvm_plugins = llvm.plugins;
|
||||
llvm_skip_rebuild = llvm_skip_rebuild.or(llvm.skip_rebuild);
|
||||
set(&mut config.llvm_optimize, llvm.optimize);
|
||||
set(&mut config.llvm_thin_lto, llvm.thin_lto);
|
||||
@ -744,6 +750,7 @@ impl Config {
|
||||
config.llvm_use_linker = llvm.use_linker.clone();
|
||||
config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.unwrap_or(false);
|
||||
config.llvm_polly = llvm.polly.unwrap_or(false);
|
||||
config.llvm_clang = llvm.clang.unwrap_or(false);
|
||||
config.llvm_from_ci = match llvm.download_ci_llvm {
|
||||
Some(StringOrBool::String(s)) => {
|
||||
assert!(s == "if-available", "unknown option `{}` for download-ci-llvm", s);
|
||||
@ -790,6 +797,8 @@ impl Config {
|
||||
check_ci_llvm!(llvm.use_linker);
|
||||
check_ci_llvm!(llvm.allow_old_toolchain);
|
||||
check_ci_llvm!(llvm.polly);
|
||||
check_ci_llvm!(llvm.clang);
|
||||
check_ci_llvm!(llvm.plugins);
|
||||
|
||||
// CI-built LLVM can be either dynamic or static.
|
||||
let ci_llvm = config.out.join(&*config.build.triple).join("ci-llvm");
|
||||
@ -952,6 +961,7 @@ impl Config {
|
||||
|
||||
config.llvm_skip_rebuild = llvm_skip_rebuild.unwrap_or(false);
|
||||
config.llvm_assertions = llvm_assertions.unwrap_or(false);
|
||||
config.llvm_plugins = llvm_plugins.unwrap_or(false);
|
||||
config.rust_optimize = optimize.unwrap_or(true);
|
||||
|
||||
let default = debug == Some(true);
|
||||
|
@ -57,6 +57,7 @@ o("cargo-native-static", "build.cargo-native-static", "static native libraries i
|
||||
o("profiler", "build.profiler", "build the profiler runtime")
|
||||
o("full-tools", None, "enable all tools")
|
||||
o("lld", "rust.lld", "build lld")
|
||||
o("clang", "llvm.clang", "build clang")
|
||||
o("missing-tools", "dist.missing-tools", "allow failures when building tools")
|
||||
o("use-libcxx", "llvm.use-libcxx", "build LLVM with libc++")
|
||||
o("control-flow-guard", "rust.control-flow-guard", "Enable Control Flow Guard")
|
||||
@ -72,6 +73,7 @@ v("llvm-libunwind", "rust.llvm-libunwind", "use LLVM libunwind")
|
||||
o("optimize", "rust.optimize", "build optimized rust code")
|
||||
o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
|
||||
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
|
||||
o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface")
|
||||
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
|
||||
o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger metadata")
|
||||
v("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code")
|
||||
|
@ -169,10 +169,12 @@ impl Step for Llvm {
|
||||
};
|
||||
|
||||
let assertions = if builder.config.llvm_assertions { "ON" } else { "OFF" };
|
||||
let plugins = if builder.config.llvm_plugins { "ON" } else { "OFF" };
|
||||
|
||||
cfg.out_dir(&out_dir)
|
||||
.profile(profile)
|
||||
.define("LLVM_ENABLE_ASSERTIONS", assertions)
|
||||
.define("LLVM_ENABLE_PLUGINS", plugins)
|
||||
.define("LLVM_TARGETS_TO_BUILD", llvm_targets)
|
||||
.define("LLVM_EXPERIMENTAL_TARGETS_TO_BUILD", llvm_exp_targets)
|
||||
.define("LLVM_INCLUDE_EXAMPLES", "OFF")
|
||||
@ -265,6 +267,10 @@ impl Step for Llvm {
|
||||
enabled_llvm_projects.push("polly");
|
||||
}
|
||||
|
||||
if builder.config.llvm_clang {
|
||||
enabled_llvm_projects.push("clang");
|
||||
}
|
||||
|
||||
// We want libxml to be disabled.
|
||||
// See https://github.com/rust-lang/rust/pull/50104
|
||||
cfg.define("LLVM_ENABLE_LIBXML2", "OFF");
|
||||
|
Loading…
Reference in New Issue
Block a user