Index: build/config/BUILDCONFIG.gn |
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn |
index 234332b8547e95b0185e9bc4bcaaf1c1bfedcf63..02618768053ede93ffb208e98eb1748d6102382e 100644 |
--- a/build/config/BUILDCONFIG.gn |
+++ b/build/config/BUILDCONFIG.gn |
@@ -125,12 +125,9 @@ declare_args() { |
is_clang = current_os == "mac" || current_os == "ios" || |
current_os == "linux" || current_os == "chromeos" |
- if (current_os == "chromeos") { |
- # Allows the target toolchain to be injected as arguments. This is needed |
- # to support the CrOS build system which supports per-build-configuration |
- # toolchains. |
- cros_use_custom_toolchain = false |
- } |
+ # Allows the path to a custom target toolchain to be injected as a single |
+ # argument, and set as the default toolchain. |
+ custom_toolchain = "" |
# DON'T ADD MORE FLAGS HERE. Read the comment above. |
} |
@@ -489,6 +486,7 @@ set_defaults("test") { |
# doing cross-compiles. When not cross-compiling, this will be the same as the |
# default toolchain. |
+_default_toolchain = "" |
if (is_win) { |
# On windows we use the same toolchain for host and target by default. |
if (is_clang) { |
@@ -498,11 +496,11 @@ if (is_win) { |
} |
if (current_os == "win") { |
- set_default_toolchain("$host_toolchain") |
+ _default_toolchain = host_toolchain |
} else if (current_cpu == "x64") { # WinRT x64 |
- set_default_toolchain("//build/toolchain/win:winrt_x64") |
+ _default_toolchain = "//build/toolchain/win:winrt_x64" |
} else if (current_cpu == "x86") { # WinRT x86 |
- set_default_toolchain("//build/toolchain/win:winrt_x86") |
+ _default_toolchain = "//build/toolchain/win:winrt_x86" |
} |
} else if (is_android) { |
if (host_os == "linux") { |
@@ -518,27 +516,24 @@ if (is_win) { |
assert(false, "Unknown host for android cross compile") |
} |
if (is_clang) { |
- set_default_toolchain("//build/toolchain/android:clang_$current_cpu") |
+ _default_toolchain = "//build/toolchain/android:clang_$current_cpu" |
} else { |
- set_default_toolchain("//build/toolchain/android:$current_cpu") |
+ _default_toolchain = "//build/toolchain/android:$current_cpu" |
} |
} else if (is_linux) { |
if (is_clang) { |
host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
- set_default_toolchain("//build/toolchain/linux:clang_$current_cpu") |
+ _default_toolchain = "//build/toolchain/linux:clang_$current_cpu" |
} else { |
host_toolchain = "//build/toolchain/linux:$host_cpu" |
- set_default_toolchain("//build/toolchain/linux:$current_cpu") |
- } |
- if (is_chromeos && cros_use_custom_toolchain) { |
- set_default_toolchain("//build/toolchain/cros:target") |
+ _default_toolchain = "//build/toolchain/linux:$current_cpu" |
} |
} else if (is_mac) { |
host_toolchain = "//build/toolchain/mac:clang_x64" |
- set_default_toolchain(host_toolchain) |
+ _default_toolchain = host_toolchain |
} else if (is_ios) { |
host_toolchain = "//build/toolchain/mac:clang_x64" |
- set_default_toolchain("//build/toolchain/mac:ios_clang_arm") |
+ _default_toolchain = "//build/toolchain/mac:ios_clang_arm" |
} else if (is_nacl) { |
# TODO(GYP): This will need to change when we get NaCl working |
# on multiple platforms, but this whole block of code (how we define |
@@ -547,6 +542,14 @@ if (is_win) { |
host_toolchain = "//build/toolchain/linux:clang_x64" |
} |
+# If a custom toolchain has been set in the args, set it as default. Otherwise, |
+# set the default toolchain for the platform (if any). |
+if (custom_toolchain != "") { |
+ set_default_toolchain(custom_toolchain) |
+} else if (_default_toolchain != "") { |
+ set_default_toolchain(_default_toolchain) |
+} |
+ |
# ============================================================================== |
# COMPONENT SETUP |
# ============================================================================== |