summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--breakpad/BUILD.gn2
-rw-r--r--build/config/BUILDCONFIG.gn26
-rw-r--r--build/toolchain/gcc_toolchain.gni7
-rw-r--r--build/toolchain/linux/BUILD.gn70
4 files changed, 66 insertions, 39 deletions
diff --git a/breakpad/BUILD.gn b/breakpad/BUILD.gn
index 596aea6..2c0ae49 100644
--- a/breakpad/BUILD.gn
+++ b/breakpad/BUILD.gn
@@ -516,7 +516,7 @@ if (is_linux && current_toolchain == host_toolchain) {
if (is_clang) {
# See http://crbug.com/138571#c18
- cflags += [ "-Wno-unused-value" ]
+ cflags = [ "-Wno-unused-value" ]
}
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index e8a9a22..d9559e5 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -31,7 +31,7 @@ declare_args() {
# Set to true when compiling with the Clang compiler. Typically this is used
# to configure warnings.
- is_clang = false
+ is_clang = (os == "mac" || os == "ios")
# Forces a 64-bit build on Windows. Does nothing on other platforms. Normally
# we build 32-bit on Windows regardless of the current host OS bit depth.
@@ -101,9 +101,6 @@ if (os == "win") {
is_nacl = false
is_posix = true
is_win = false
- if (!is_clang) {
- is_clang = true # Always use clang on Mac.
- }
} else if (os == "android") {
is_android = true
is_chromeos = false
@@ -142,10 +139,6 @@ if (os == "win") {
is_nacl = false
is_posix = true
is_win = false
- if (!is_gyp_xcode_generator) {
- # Always use clang on iOS when using ninja
- is_clang = true
- }
} else if (os == "linux") {
is_android = false
is_chromeos = false
@@ -460,11 +453,22 @@ if (is_win) {
set_default_toolchain("//build/toolchain/win:32")
}
} else if (is_android) {
- host_toolchain = "//build/toolchain/linux:$build_cpu_arch"
+ # Use clang for the x86/64 Linux host builds.
+ # (Disabled until the Clang build works properly.)
+ #if (build_cpu_arch == "x86" || build_cpu_arch == "x64") {
+ # host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch"
+ #} else {
+ host_toolchain = "//build/toolchain/linux:$build_cpu_arch"
+ #}
set_default_toolchain("//build/toolchain/android:$cpu_arch")
} else if (is_linux) {
- host_toolchain = "//build/toolchain/linux:$build_cpu_arch"
- set_default_toolchain("//build/toolchain/linux:$cpu_arch")
+ if (is_clang) {
+ host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch"
+ set_default_toolchain("//build/toolchain/linux:clang_$cpu_arch")
+ } else {
+ host_toolchain = "//build/toolchain/linux:$build_cpu_arch"
+ set_default_toolchain("//build/toolchain/linux:$cpu_arch")
+ }
} else if (is_mac) {
host_toolchain = "//build/toolchain/mac:clang"
set_default_toolchain(host_toolchain)
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
index a6d4728..8ca3e8a 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -2,7 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-# This template defines a GCC toolchain.
+# This template defines a toolchain for something that works like gcc
+# (including clang).
#
# It requires the following variables specifying the executables to run:
# - cc
@@ -23,6 +24,7 @@
# at the beginning and end for all targets in a toolchain.
# - deps
# Just fowarded to the toolchain definition.
+# - is_clang
template("gcc_toolchain") {
toolchain(target_name) {
assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value")
@@ -108,6 +110,9 @@ template("gcc_toolchain") {
toolchain_args() {
cpu_arch = invoker.toolchain_cpu_arch
os = invoker.toolchain_os
+ if (defined(invoker.is_clang)) {
+ is_clang = invoker.is_clang
+ }
}
if (defined(invoker.deps)) {
diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn
index dd98cb4..9789454 100644
--- a/build/toolchain/linux/BUILD.gn
+++ b/build/toolchain/linux/BUILD.gn
@@ -15,52 +15,69 @@ gcc_toolchain("arm") {
toolchain_cpu_arch = "arm"
toolchain_os = "linux"
+ is_clang = false
}
-gcc_toolchain("x86") {
- if (is_clang) {
- if (use_clang_type_profiler) {
- prefix = rebase_path("//third_party/llvm-allocated-type/Linux_ia32/bin",
- root_build_dir)
- } else {
- prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
- root_build_dir)
- }
- cc = "$prefix/clang"
- cxx = "$prefix/clang++"
+gcc_toolchain("clang_x86") {
+ if (use_clang_type_profiler) {
+ prefix = rebase_path("//third_party/llvm-allocated-type/Linux_ia32/bin",
+ root_build_dir)
} else {
- cc = "gcc"
- cxx = "g++"
+ prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
+ root_build_dir)
}
+ cc = "$prefix/clang"
+ cxx = "$prefix/clang++"
ar = "ar"
ld = cxx
toolchain_cpu_arch = "x86"
toolchain_os = "linux"
+ is_clang = true
}
-gcc_toolchain("x64") {
- if (is_clang) {
- if (use_clang_type_profiler) {
- prefix = rebase_path("//third_party/llvm-allocated-type/Linux_x64/bin",
- root_build_dir)
- } else {
- prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
- root_build_dir)
- }
- cc = "$prefix/clang"
- cxx = "$prefix/clang++"
+gcc_toolchain("x86") {
+ cc = "gcc"
+ cxx = "g++"
+
+ ar = "ar"
+ ld = cxx
+
+ toolchain_cpu_arch = "x86"
+ toolchain_os = "linux"
+ is_clang = false
+}
+
+gcc_toolchain("clang_x64") {
+ if (use_clang_type_profiler) {
+ prefix = rebase_path("//third_party/llvm-allocated-type/Linux_x64/bin",
+ root_build_dir)
} else {
- cc = "gcc"
- cxx = "g++"
+ prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
+ root_build_dir)
}
+ cc = "$prefix/clang"
+ cxx = "$prefix/clang++"
+
+ ar = "ar"
+ ld = cxx
+
+ toolchain_cpu_arch = "x64"
+ toolchain_os = "linux"
+ is_clang = true
+}
+
+gcc_toolchain("x64") {
+ cc = "gcc"
+ cxx = "g++"
ar = "ar"
ld = cxx
toolchain_cpu_arch = "x64"
toolchain_os = "linux"
+ is_clang = false
}
gcc_toolchain("mipsel") {
@@ -71,4 +88,5 @@ gcc_toolchain("mipsel") {
toolchain_cpu_arch = "mipsel"
toolchain_os = "linux"
+ is_clang = false
}