Chromium Code Reviews| Index: build/config/BUILDCONFIG.gn |
| diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn |
| index 3eed120832f10c091058706af881c439adc0454c..259006a9e784f78967b0d1c939966368c36823d3 100644 |
| --- a/build/config/BUILDCONFIG.gn |
| +++ b/build/config/BUILDCONFIG.gn |
| @@ -129,6 +129,10 @@ declare_args() { |
| # argument, and set as the default toolchain. |
| custom_toolchain = "" |
| + # This should not normally be set as a build argument. It's here so that |
| + # every toolchain can pass through the "global" value via toolchain_args(). |
| + host_toolchain = "" |
| + |
| # DON'T ADD MORE FLAGS HERE. Read the comment above. |
| } |
| @@ -144,30 +148,43 @@ declare_args() { |
| # We do this before anything else to make sure we complain about any |
| # unsupported os/cpu combinations as early as possible. |
| -if (host_os == "linux") { |
| - if (target_os != "linux") { |
| - # TODO(dpranke) - is_clang normally applies only to the target |
| - # build, and there is no way to indicate that you want to override |
| - # it for both the target build *and* the host build. Do we need to |
| - # support this? |
| - host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| - } else if (is_clang) { |
| - host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| +if (host_toolchain == "") { |
| + # This should only happen in the top level context. |
| + # In a specific toolchain context, the toolchain_args() |
| + # block should have propagated a value down. |
|
Dirk Pranke
2015/11/25 03:48:05
In the top level context (the first time through B
|
| + assert(current_os == host_os, |
| + "All toolchains must plumb through host_toolchain in toolchain_args()") |
| + if (host_os == "win") { |
| + # TODO(crbug.com/467159): win cross-compiles don't actually work yet, so |
| + # use the target_cpu instead of the host_cpu. |
| + assert( |
| + current_cpu == target_cpu, |
| + "All toolchains must plumb through host_toolchain in toolchain_args()") |
| } else { |
| - host_toolchain = "//build/toolchain/linux:$host_cpu" |
| + assert( |
| + current_cpu == host_cpu, |
| + "All toolchains must plumb through host_toolchain in toolchain_args()") |
| } |
| -} else if (host_os == "mac") { |
| - host_toolchain = "//build/toolchain/mac:clang_$host_cpu" |
| -} else if (host_os == "win") { |
| - # TODO(crbug.com/467159): win cross-compiles don't actually work yet, so |
| - # use the target_cpu instead of the host_cpu. |
| - if (is_clang) { |
| - host_toolchain = "//build/toolchain/win:clang_$target_cpu" |
| + |
| + if (host_os == "linux") { |
| + if (is_clang) { |
| + host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| + } else { |
| + host_toolchain = "//build/toolchain/linux:$host_cpu" |
| + } |
| + } else if (host_os == "mac") { |
| + host_toolchain = "//build/toolchain/mac:clang_$host_cpu" |
| + } else if (host_os == "win") { |
| + # TODO(crbug.com/467159): win cross-compiles don't actually work yet, so |
| + # use the target_cpu instead of the host_cpu. |
| + if (is_clang) { |
| + host_toolchain = "//build/toolchain/win:clang_$target_cpu" |
| + } else { |
| + host_toolchain = "//build/toolchain/win:$target_cpu" |
| + } |
| } else { |
| - host_toolchain = "//build/toolchain/win:$target_cpu" |
| + assert(false, "Unsupported host_os: $host_os") |
| } |
| -} else { |
| - assert(false, "Unsupported host_os: $host_os") |
| } |
| _default_toolchain = "" |