Skip to content

Commit 6225eed

Browse files
tmandrycatap
authored andcommitted
Add llvm.build-config option
1 parent 84eb651 commit 6225eed

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ changelog-seen = 2
145145
# Whether to include the Polly optimizer.
146146
#polly = false
147147

148+
# Custom CMake defines to set when building LLVM.
149+
#build-config = {}
150+
148151
# =============================================================================
149152
# General build configuration options
150153
# =============================================================================

src/bootstrap/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub struct Config {
104104
pub llvm_allow_old_toolchain: bool,
105105
pub llvm_polly: bool,
106106
pub llvm_from_ci: bool,
107+
pub llvm_build_config: HashMap<String, String>,
107108

108109
pub use_lld: bool,
109110
pub lld_enabled: bool,
@@ -432,6 +433,7 @@ struct Llvm {
432433
allow_old_toolchain: Option<bool>,
433434
polly: Option<bool>,
434435
download_ci_llvm: Option<StringOrBool>,
436+
build_config: Option<HashMap<String, String>>,
435437
}
436438

437439
#[derive(Deserialize, Default, Clone, Merge)]
@@ -743,6 +745,7 @@ impl Config {
743745
config.llvm_use_linker = llvm.use_linker.clone();
744746
config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.unwrap_or(false);
745747
config.llvm_polly = llvm.polly.unwrap_or(false);
748+
config.llvm_build_config = llvm.build_config.clone().unwrap_or(Default::default());
746749
config.llvm_from_ci = match llvm.download_ci_llvm {
747750
Some(StringOrBool::String(s)) => {
748751
assert!(s == "if-available", "unknown option `{}` for download-ci-llvm", s);
@@ -789,6 +792,7 @@ impl Config {
789792
check_ci_llvm!(llvm.use_linker);
790793
check_ci_llvm!(llvm.allow_old_toolchain);
791794
check_ci_llvm!(llvm.polly);
795+
check_ci_llvm!(llvm.build_config);
792796

793797
// CI-built LLVM can be either dynamic or static.
794798
let ci_llvm = config.out.join(&*config.build.triple).join("ci-llvm");

src/bootstrap/native.rs

+4
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ impl Step for Llvm {
317317

318318
configure_cmake(builder, target, &mut cfg, true);
319319

320+
for (key, val) in &builder.config.llvm_build_config {
321+
cfg.define(key, val);
322+
}
323+
320324
// FIXME: we don't actually need to build all LLVM tools and all LLVM
321325
// libraries here, e.g., we just want a few components and a few
322326
// tools. Figure out how to filter them down and only build the right

0 commit comments

Comments
 (0)