Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2870)

Unified Diff: build/toolchain/gcc_toolchain.gni

Issue 1361403002: Move goma/ccache logic to //build/toolchain/gcc_toolchain.gni (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move the invoker param docs Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/toolchain/cros/BUILD.gn ('k') | build/toolchain/linux/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/gcc_toolchain.gni
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
index 41766ce920985f529a5312ef61122ce389739593..74dbf073586502a8ec3899acd8b84be818d52cd8 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -4,6 +4,8 @@
import("//build/config/nacl/config.gni")
import("//build/config/sanitizers/sanitizers.gni")
+import("//build/toolchain/ccache.gni")
+import("//build/toolchain/goma.gni")
import("//build/toolchain/toolchain.gni")
# This value will be inherited in the toolchain below.
@@ -73,6 +75,12 @@ concurrent_links = exec_script("get_concurrent_links.py", [], "value")
# default setting.
# - is_nacl_glibc
# Whether NaCl code is built using Glibc instead of Newlib.
+# - use_ccache
+# Override the global use_ccache setting, useful to opt-out of ccache in
+# a particular toolchain by setting use_ccache = false in it.
+# - use_goma
+# Override the global use_goma setting, useful to opt-out of goma in a
+# particular toolchain by setting use_gome = false in it.
template("gcc_toolchain") {
toolchain(target_name) {
assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
@@ -84,6 +92,21 @@ template("gcc_toolchain") {
assert(defined(invoker.toolchain_os),
"gcc_toolchain() must specify a \"toolchain_os\"")
+ if (defined(invoker.use_ccache)) {
+ use_ccache = invoker.use_ccache
+ }
+ if (defined(invoker.use_goma)) {
+ use_goma = invoker.use_goma
+ }
+ if (use_goma) {
+ assert(!use_ccache, "Goma and ccache can't be used together.")
+ compiler_prefix = "$goma_dir/gomacc "
+ } else if (use_ccache) {
+ compiler_prefix = "ccache "
+ } else {
+ compiler_prefix = ""
+ }
+
# This define changes when the toolchain changes, forcing a rebuild.
# Nothing should ever use this define.
if (defined(invoker.rebuild_define)) {
@@ -92,11 +115,8 @@ template("gcc_toolchain") {
rebuild_string = ""
}
- # We can't do string interpolation ($ in strings) on things with dots in
- # them. To allow us to use $cc below, for example, we create copies of
- # these values in our scope.
- cc = invoker.cc
- cxx = invoker.cxx
+ cc = compiler_prefix + invoker.cc
+ cxx = compiler_prefix + invoker.cxx
ar = invoker.ar
ld = invoker.ld
if (defined(invoker.readelf)) {
« no previous file with comments | « build/toolchain/cros/BUILD.gn ('k') | build/toolchain/linux/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698