Index: build/config/BUILDCONFIG.gn |
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn |
index a554f12dc5b427ddbff8a0fff1116eb9bc6cbbdd..d806a1763a4e2cb35513d9834ace1dcc99c92ab7 100644 |
--- a/build/config/BUILDCONFIG.gn |
+++ b/build/config/BUILDCONFIG.gn |
@@ -16,53 +16,7 @@ |
# KEEP IN ALPHABETICAL ORDER and write a good description for everything. |
# Use "is_*" names for intrinsic platform descriptions and build modes, and |
# "use_*" names for optional features libraries, and configurations. |
- |
-# TODO(dpranke): The os and cpu_arch variables exist for backwards |
-# compatibility and should be deleted once all of the build files and |
-# bots have been updated to use current_cpu/target_cpu and |
-# current_os/target_os instead. |
- |
-if (target_os == "") { |
- if (defined(os)) { |
- # If os is defined, it was set in an args file and needs to be |
- # used for backwards-compatibility. |
- target_os = os |
- } else { |
- target_os = host_os |
- } |
-} |
- |
-if (target_cpu == "") { |
- if (defined(cpu_arch)) { |
- # If cpu_arch is defined, it was set in an args file and needs to be |
- # used for backwards-compatibility. |
- target_cpu = cpu_arch |
- } else if (target_os == "android") { |
- # If we're building for Android, we should assume that we want to |
- # build for ARM by default, not the host_cpu (which is likely x64). |
- # This allows us to not have to specify both target_os and target_cpu |
- # on the command line. |
- target_cpu = "arm" |
- } else { |
- target_cpu = host_cpu |
- } |
-} |
- |
-if (current_cpu == "") { |
- current_cpu = target_cpu |
-} |
-if (current_os == "") { |
- current_os = target_os |
-} |
- |
declare_args() { |
- # TODO(dpranke): These values are here for backwards compatibility and |
- # should be deleted when all of the builders and configs have been updated. |
- cpu_arch = target_cpu |
- os = target_os |
- build_cpu_arch = host_cpu |
- build_os = host_os |
- |
# How many symbols to include in the build. This affects the performance of |
# the build since the symbols are large and dealing with them is slow. |
# 2 means regular build with symbols. |
@@ -78,12 +32,11 @@ declare_args() { |
is_debug = true |
# Whether we're a traditional desktop unix. |
- is_desktop_linux = current_os == "linux" && current_os != "chromeos" |
+ is_desktop_linux = os == "linux" && os != "chromeos" |
# Set to true when compiling with the Clang compiler. Typically this is used |
# to configure warnings. |
- is_clang = current_os == "mac" || current_os == "ios" || |
- current_os == "linux" || current_os == "chromeos" |
+ is_clang = os == "mac" || os == "ios" || os == "linux" || os == "chromeos" |
# Selects the desired build flavor. Official builds get additional |
# processing to prepare for release. Normally you will want to develop and |
@@ -107,23 +60,29 @@ declare_args() { |
# Compile for Thread Sanitizer to find threading bugs. |
is_tsan = false |
- if (current_os == "chromeos") { |
+ if (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 |
} |
+ # TODO(cjhopman): Make target_arch work for all platforms. |
+ |
+ # Architecture of the target device. For Android builds, this will be equal to |
+ # the cpu_arch of the default toolchain. When checking the CPU architecture |
+ # for source files and build dependencies you should almost alway use cpu_arch |
+ # instead. cpu_arch is the architecture of the current toolchain and allows |
+ # cross-compiles (compiling the same target for multiple toolchains in the |
+ # same build) to work. |
+ target_arch = "arm" |
+ |
# TODO(brettw) remove this flag (and therefore enable linking all targets) on |
# Windows when we have sufficient bot capacity. In the meantime, you can |
# enable linking for local compiles. |
link_chrome_on_windows = true |
} |
-# TODO(dpranke): Remove these asserts when os and cpu_arch are removed. |
-assert(current_cpu == cpu_arch) |
-assert(current_os == os) |
- |
# ============================================================================= |
# OS DEFINITIONS |
# ============================================================================= |
@@ -139,10 +98,10 @@ assert(current_os == os) |
# generally too different despite being based on the Linux kernel). |
# |
# Do not add more is_* variants here for random lesser-used Unix systems like |
-# aix or one of the BSDs. If you need to check these, just check the |
-# current_os value directly. |
+# aix or one of the BSDs. If you need to check these, just check the os value |
+# directly. |
-if (current_os == "win") { |
+if (os == "win") { |
is_android = false |
is_chromeos = false |
is_ios = false |
@@ -151,7 +110,7 @@ if (current_os == "win") { |
is_nacl = false |
is_posix = false |
is_win = true |
-} else if (current_os == "mac") { |
+} else if (os == "mac") { |
is_android = false |
is_chromeos = false |
is_ios = false |
@@ -160,7 +119,7 @@ if (current_os == "win") { |
is_nacl = false |
is_posix = true |
is_win = false |
-} else if (current_os == "android") { |
+} else if (os == "android") { |
is_android = true |
is_chromeos = false |
is_ios = false |
@@ -169,7 +128,7 @@ if (current_os == "win") { |
is_nacl = false |
is_posix = true |
is_win = false |
-} else if (current_os == "chromeos") { |
+} else if (os == "chromeos") { |
is_android = false |
is_chromeos = true |
is_ios = false |
@@ -178,10 +137,9 @@ if (current_os == "win") { |
is_nacl = false |
is_posix = true |
is_win = false |
-} else if (current_os == "nacl") { |
- # current_os == "nacl" will be passed by the nacl toolchain definition. |
- # It is not set by default or on the command line. We treat is as a |
- # Posix variant. |
+} else if (os == "nacl") { |
+ # os == "nacl" will be passed by the nacl toolchain definition. It is not |
+ # set by default or on the command line. We treat is as a Posix variant. |
is_android = false |
is_chromeos = false |
is_ios = false |
@@ -190,7 +148,7 @@ if (current_os == "win") { |
is_nacl = true |
is_posix = true |
is_win = false |
-} else if (current_os == "ios") { |
+} else if (os == "ios") { |
is_android = false |
is_chromeos = false |
is_ios = true |
@@ -199,7 +157,7 @@ if (current_os == "win") { |
is_nacl = false |
is_posix = true |
is_win = false |
-} else if (current_os == "linux") { |
+} else if (os == "linux") { |
is_android = false |
is_chromeos = false |
is_ios = false |
@@ -211,6 +169,18 @@ if (current_os == "win") { |
} |
# ============================================================================= |
+# CPU ARCHITECTURE |
+# ============================================================================= |
+ |
+if (is_android) { |
+ # TODO(cjhopman): enable this assert once bots are updated to not set |
+ # cpu_arch. |
+ #assert(cpu_arch == build_cpu_arch, "Android device target architecture should |
+ # be set with 'target_arch', not 'cpu_arch'") |
+ cpu_arch = target_arch |
+} |
+ |
+# ============================================================================= |
# SOURCES FILTERS |
# ============================================================================= |
# |
@@ -471,11 +441,6 @@ if (is_win) { |
_shared_library_configs += _windows_linker_configs |
} else if (is_mac) { |
_shared_library_configs += [ "//build/config/mac:mac_dynamic_flags" ] |
-} else if (is_android) { |
- # Strip native JNI exports from shared libraries by default. Binaries that |
- # want this can remove this config. |
- _shared_library_configs += |
- [ "//build/config/android:hide_native_jni_exports" ] |
} |
set_defaults("shared_library") { |
configs = _shared_library_configs |
@@ -516,28 +481,28 @@ set_defaults("test") { |
if (is_win) { |
# On windows we use the same toolchain for host and target by default. |
- # TODO(dpranke): rename the toolchains to x64 and x86 to match current_cpu. |
- if (current_cpu == "x64") { |
+ # TODO(dpranke): rename the toolchains to x64 and x86 to match cpu_arch. |
+ if (cpu_arch == "x64") { |
host_toolchain = "//build/toolchain/win:64" |
- } else if (current_cpu == "x86") { |
+ } else if (cpu_arch == "x86") { |
host_toolchain = "//build/toolchain/win:32" |
} |
set_default_toolchain("$host_toolchain") |
} else if (is_android) { |
# Use clang for the x86/64 Linux host builds. |
- if (host_cpu == "x86" || host_cpu == "x64") { |
- host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
+ if (build_cpu_arch == "x86" || build_cpu_arch == "x64") { |
+ host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" |
} else { |
- host_toolchain = "//build/toolchain/linux:$host_cpu" |
+ host_toolchain = "//build/toolchain/linux:$build_cpu_arch" |
} |
- set_default_toolchain("//build/toolchain/android:$current_cpu") |
+ set_default_toolchain("//build/toolchain/android:$cpu_arch") |
} else if (is_linux) { |
if (is_clang) { |
- host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
- set_default_toolchain("//build/toolchain/linux:clang_$current_cpu") |
+ host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" |
+ set_default_toolchain("//build/toolchain/linux:clang_$cpu_arch") |
} else { |
- host_toolchain = "//build/toolchain/linux:$host_cpu" |
- set_default_toolchain("//build/toolchain/linux:$current_cpu") |
+ host_toolchain = "//build/toolchain/linux:$build_cpu_arch" |
+ set_default_toolchain("//build/toolchain/linux:$cpu_arch") |
} |
if (is_chromeos && cros_use_custom_toolchain) { |
set_default_toolchain("//build/toolchain/cros:target") |