[PATCH] D145619: extend llvm variables for build flexibility
Onur via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 02:56:33 PST 2023
ozkanonur added a comment.
> We've generally tried to move away from the direction of having CMake variables to include/exclude parts of the build, and instead encourage users to only build the specific targets they need instead of the all target. LLVM's CMake has support for distributions to make that more ergonomic. LLVM also exports its targets, so Rust could import them and add a dependency on them directly. Do either of those work for you?
We are already specify only required targets to reduce compilation and it's helping a lot. But still, a lot of compilation happens for things that we absolutely don't need in Rust. And, I don't think any of those really helps.
Here is the part where we configure llvm build https://github.com/rust-lang/rust/blob/66a2d6221069e0d08ceacf2a3201600e2092d2e0/src/bootstrap/native.rs#L248-L520
On top of our existing llvm build flow, with the PR I am proposing here, we will be able to do the following:
diff
@@ -326,10 +319,18 @@ fn run(self, builder: &Builder<'_>) -> LlvmResult {
.define("LLVM_ENABLE_LIBEDIT", "OFF")
.define("LLVM_ENABLE_BINDINGS", "OFF")
.define("LLVM_ENABLE_Z3_SOLVER", "OFF")
+ .define("LLVM_ENABLE_TOOLS", "llvm-bcanalyzer;llvm-cov;llvm-dis;llvm-dwarfdump;llvm-dwp;llvm-nm;llvm-objdump")
+ .define("LLVM_ENABLE_UTILS", "FileCheck")
+ .define("LLVM_ENABLE_LIBS", "only needed libraries will be here")
+ .define("LLVM_ENABLE_WARNINGS", enable_warnings)
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
.define("LLVM_TARGET_ARCH", target_native.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target_native);
Which will help us(not only us for sure, ref stackoverflow topic: https://stackoverflow.com/questions/71614937/llvm-build-only-selected-tools-or-targets) a lot by reducing compilation times.
I understand the design concerns here. But wouldn't be possible if we inform the developer in docs? Like "this might break builds/tests when incorrectly used". If I am not mistaken llvm already warns such things for some of the flags/variables.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145619/new/
https://reviews.llvm.org/D145619
More information about the llvm-commits
mailing list