[llvm] 98c6d31 - [gn build] allow setting clang_base_path to a source-absolute path
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 5 09:14:30 PST 2021
Author: Nico Weber
Date: 2021-03-05T12:13:51-05:00
New Revision: 98c6d3194ed90217ca6ce7e451d31ea246d2afff
URL: https://github.com/llvm/llvm-project/commit/98c6d3194ed90217ca6ce7e451d31ea246d2afff
DIFF: https://github.com/llvm/llvm-project/commit/98c6d3194ed90217ca6ce7e451d31ea246d2afff.diff
LOG: [gn build] allow setting clang_base_path to a source-absolute path
With this, you can set `clang_base_path = "//out/gn1"` in `out/gn2/args.gn` and
the build in out/gn2 will use clang and lld from out/gn1.
Setting `clang_base_path` to an absolute path (with e.g.
`clang_base_path = getenv("HOME") + "/src/..."`) should behave as before.
Differential Revision: https://reviews.llvm.org/D97989
Added:
Modified:
llvm/utils/gn/build/toolchain/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
index 0042df8578f7..e1aaae2c35e2 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -25,8 +25,8 @@ template("unix_toolchain") {
cxx = "c++"
if (clang_base_path != "") {
- cc = "$clang_base_path/bin/clang"
- cxx = "$clang_base_path/bin/clang++"
+ cc = rebase_path(clang_base_path, root_build_dir) + "/bin/clang"
+ cxx = rebase_path(clang_base_path, root_build_dir) + "/bin/clang++"
}
ld = cxx # Don't use goma wrapper for linking.
@@ -185,7 +185,7 @@ template("stage2_unix_toolchain") {
toolchain_args = {
forward_variables_from(invoker.toolchain_args, "*")
- clang_base_path = "."
+ clang_base_path = root_build_dir
use_goma = false
}
@@ -244,9 +244,9 @@ toolchain("win") {
link = "link"
if (clang_base_path != "") {
- cl = "$clang_base_path/bin/clang-cl"
+ cl = rebase_path(clang_base_path, root_build_dir) + "/bin/clang-cl"
if (use_lld) {
- link = "$clang_base_path/bin/lld-link"
+ link = rebase_path(clang_base_path, root_build_dir) + "/bin/lld-link"
}
}
More information about the llvm-commits
mailing list