add ccache support to gn builds
This can be used to inject icecc also, via the CCACHE_PREFIX environment variable. BUG=394501 Review URL: https://codereview.chromium.org/742953007 Cr-Original-Commit-Position: refs/heads/master@{#305912} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 50ff7a9494412cdab84c472db73d1e148fcec761
This commit is contained in:
Родитель
11e434817e
Коммит
ac484dd023
|
@ -10,6 +10,8 @@ if (is_posix) {
|
|||
import("//build/config/gcc/gcc_version.gni")
|
||||
}
|
||||
|
||||
import("//build/toolchain/ccache.gni")
|
||||
|
||||
declare_args() {
|
||||
# Normally, Android builds are lightly optimized, even for debug builds, to
|
||||
# keep binary size down. Setting this flag to true disables such optimization
|
||||
|
@ -30,7 +32,7 @@ if (!is_win) {
|
|||
# with some utilities such as icecc and ccache. Requires gold and
|
||||
# gcc >= 4.8 or clang.
|
||||
# http://gcc.gnu.org/wiki/DebugFission
|
||||
use_debug_fission = use_gold && linux_use_bundled_binutils
|
||||
use_debug_fission = use_gold && linux_use_bundled_binutils && !use_ccache
|
||||
}
|
||||
|
||||
# default_include_dirs ---------------------------------------------------------
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/sysroot.gni") # Imports android/config.gni.
|
||||
import("//build/toolchain/ccache.gni")
|
||||
import("//build/toolchain/clang.gni")
|
||||
import("//build/toolchain/goma.gni")
|
||||
import("//build/toolchain/gcc_toolchain.gni")
|
||||
|
@ -36,13 +37,16 @@ template("android_gcc_toolchain") {
|
|||
tool_prefix = rebase_path(invoker.tool_prefix, root_build_dir)
|
||||
|
||||
if (use_goma) {
|
||||
goma_prefix = "$goma_dir/gomacc "
|
||||
assert(!use_ccache, "Goma and ccache can't be used together.")
|
||||
compiler_prefix = "$goma_dir/gomacc "
|
||||
} else if (use_ccache) {
|
||||
compiler_prefix = "ccache "
|
||||
} else {
|
||||
goma_prefix = ""
|
||||
compiler_prefix = ""
|
||||
}
|
||||
|
||||
cc = goma_prefix + tool_prefix + "gcc"
|
||||
cxx = goma_prefix + tool_prefix + "g++"
|
||||
cc = compiler_prefix + tool_prefix + "gcc"
|
||||
cxx = compiler_prefix + tool_prefix + "g++"
|
||||
ar = tool_prefix + "ar"
|
||||
ld = cxx
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Defines the configuration of ccache - a c/c++ compiler cache which can
|
||||
# greatly reduce recompilation times.
|
||||
#
|
||||
# TIPS:
|
||||
#
|
||||
# Set clang_use_chrome_plugins=false if using ccache 3.1.9 or earlier, since
|
||||
# these versions don't support -Xclang. (3.1.10 and later will silently
|
||||
# ignore -Xclang, so it doesn't matter if you disable clang_use_chrome_plugins
|
||||
# or not).
|
||||
#
|
||||
# Use ccache 3.2 or later to avoid clang unused argument warnings:
|
||||
# https://bugzilla.samba.org/show_bug.cgi?id=8118
|
||||
#
|
||||
# To avoid -Wparentheses-equality clang warnings, at some cost in terms of
|
||||
# speed, you can do:
|
||||
# export CCACHE_CPP2=yes
|
||||
|
||||
declare_args() {
|
||||
# Set to true to enable ccache. Probably doesn't work on windows.
|
||||
use_ccache = false
|
||||
}
|
|
@ -3,19 +3,23 @@
|
|||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/sysroot.gni")
|
||||
import("//build/toolchain/ccache.gni")
|
||||
import("//build/toolchain/clang.gni")
|
||||
import("//build/toolchain/gcc_toolchain.gni")
|
||||
import("//build/toolchain/goma.gni")
|
||||
|
||||
if (use_goma) {
|
||||
goma_prefix = "$goma_dir/gomacc "
|
||||
assert(!use_ccache, "Goma and ccache can't be used together.")
|
||||
compiler_prefix = "$goma_dir/gomacc "
|
||||
} else if (use_ccache) {
|
||||
compiler_prefix = "ccache "
|
||||
} else {
|
||||
goma_prefix = ""
|
||||
compiler_prefix = ""
|
||||
}
|
||||
|
||||
gcc_toolchain("arm") {
|
||||
cc = "${goma_prefix}arm-linux-gnueabi-gcc"
|
||||
cxx = "${goma_prefix}arm-linux-gnueabi-g++"
|
||||
cc = "${compiler_prefix}arm-linux-gnueabi-gcc"
|
||||
cxx = "${compiler_prefix}arm-linux-gnueabi-g++"
|
||||
|
||||
ar = "arm-linux-gnueabi-ar"
|
||||
ld = cxx
|
||||
|
@ -33,8 +37,8 @@ gcc_toolchain("clang_x86") {
|
|||
prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
|
||||
root_build_dir)
|
||||
}
|
||||
cc = "${goma_prefix}$prefix/clang"
|
||||
cxx = "${goma_prefix}$prefix/clang++"
|
||||
cc = "${compiler_prefix}$prefix/clang"
|
||||
cxx = "${compiler_prefix}$prefix/clang++"
|
||||
|
||||
ar = "ar"
|
||||
ld = cxx
|
||||
|
@ -45,8 +49,8 @@ gcc_toolchain("clang_x86") {
|
|||
}
|
||||
|
||||
gcc_toolchain("x86") {
|
||||
cc = "${goma_prefix}gcc"
|
||||
cxx = "$goma_prefix}g++"
|
||||
cc = "${compiler_prefix}gcc"
|
||||
cxx = "$compiler_prefix}g++"
|
||||
|
||||
ar = "ar"
|
||||
ld = cxx
|
||||
|
@ -64,8 +68,8 @@ gcc_toolchain("clang_x64") {
|
|||
prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
|
||||
root_build_dir)
|
||||
}
|
||||
cc = "${goma_prefix}$prefix/clang"
|
||||
cxx = "${goma_prefix}$prefix/clang++"
|
||||
cc = "${compiler_prefix}$prefix/clang"
|
||||
cxx = "${compiler_prefix}$prefix/clang++"
|
||||
|
||||
ar = "ar"
|
||||
ld = cxx
|
||||
|
@ -76,8 +80,8 @@ gcc_toolchain("clang_x64") {
|
|||
}
|
||||
|
||||
gcc_toolchain("x64") {
|
||||
cc = "${goma_prefix}gcc"
|
||||
cxx = "${goma_prefix}g++"
|
||||
cc = "${compiler_prefix}gcc"
|
||||
cxx = "${compiler_prefix}g++"
|
||||
|
||||
ar = "ar"
|
||||
ld = cxx
|
||||
|
|
Загрузка…
Ссылка в новой задаче