From 98c6d3194ed90217ca6ce7e451d31ea246d2afff Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 5 Mar 2021 12:13:51 -0500 Subject: [PATCH] [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 --- llvm/utils/gn/build/toolchain/BUILD.gn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn index 0042df8..e1aaae2 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" } } -- 2.7.4