diff options
author | dpranke <dpranke@chromium.org> | 2015-02-20 14:09:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-20 22:10:45 +0000 |
commit | 55187fbe2d3264d4c31432e2f8a77f094d7c986b (patch) | |
tree | aef99dfe1fee89fb3ac14c30f8f95a60a2f4bd53 | |
parent | 56820bdb2a9bcddca9528b16e79d7339f218336f (diff) | |
download | chromium_src-55187fbe2d3264d4c31432e2f8a77f094d7c986b.zip chromium_src-55187fbe2d3264d4c31432e2f8a77f094d7c986b.tar.gz chromium_src-55187fbe2d3264d4c31432e2f8a77f094d7c986b.tar.bz2 |
Fix GN os, cpu defaults for Android builds.
We would like to be able to default to the ARM CPU for
Android builds, not the host cpu (so that you can get the
default Android build by just specifying os="android");
prior to my cpu_arch -> target_cpu changes, this was the
case, but I accidentally broke this.
However, the target_cpu changes at least allow us to remove
the target_arch hack which was how they were accomplishing
this before :).
TBR=brettw@chromium.org
R=cjhopman@chromium.org
BUG=344767
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/946683002
Cr-Commit-Position: refs/heads/master@{#317419}
-rw-r--r-- | build/config/BUILDCONFIG.gn | 29 | ||||
-rw-r--r-- | tools/relocation_packer/BUILD.gn | 10 | ||||
-rw-r--r-- | tools/relocation_packer/config.gni | 6 |
3 files changed, 14 insertions, 31 deletions
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 7822261..a554f12 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -37,6 +37,12 @@ if (target_cpu == "") { # 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 } @@ -108,17 +114,6 @@ declare_args() { cros_use_custom_toolchain = false } - # TODO(dpranke): Replace target_arch with target_cpu. - - # Architecture of the target device. For Android builds, this will be - # equal to the current_cpu of the default toolchain. When checking - # the CPU architecture for source files and build dependencies you - # should almost alway use current_cpu instead. current_cpu 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. @@ -216,18 +211,6 @@ if (current_os == "win") { } # ============================================================================= -# CPU ARCHITECTURE -# ============================================================================= - -if (is_android) { - # TODO(cjhopman): enable this assert once bots are updated to not set - # current_cpu. - #assert(current_cpu == host_cpu, "Android device target architecture should - # be set with 'target_arch', not 'current_cpu'") - current_cpu = target_arch -} - -# ============================================================================= # SOURCES FILTERS # ============================================================================= # diff --git a/tools/relocation_packer/BUILD.gn b/tools/relocation_packer/BUILD.gn index 0b29c91..e95dbcf 100644 --- a/tools/relocation_packer/BUILD.gn +++ b/tools/relocation_packer/BUILD.gn @@ -7,9 +7,9 @@ import("//testing/test.gni") assert(relocation_packing_supported) -if (target_arch == "arm") { +if (target_cpu == "arm") { target_define = "TARGET_ARM" -} else if (target_arch == "arm64") { +} else if (target_cpu == "arm64") { target_define = "TARGET_ARM64" } @@ -78,7 +78,7 @@ if (current_toolchain == host_toolchain) { } if (current_toolchain == default_toolchain && - (target_arch == "arm" || target_arch == "arm64")) { + (target_cpu == "arm" || target_cpu == "arm64")) { # Targets to build test data. These participate only in building test # data for use with elf_file_unittest.cc, and are not part of the main # relocation packer build. Unit test data files are checked in to the @@ -102,11 +102,11 @@ if (current_toolchain == default_toolchain && action("relocation_packer_unittests_test_data") { script = "test_data/generate_elf_file_unittest_relocs.py" test_file = "$root_build_dir/librelocation_packer_test_data.so" - if (target_arch == "arm") { + if (target_cpu == "arm") { added_section = ".android.rel.dyn" packed_output = "elf_file_unittest_relocs_arm32_packed.so" unpacked_output = "elf_file_unittest_relocs_arm32.so" - } else if (target_arch == "arm64") { + } else if (target_cpu == "arm64") { added_section = ".android.rela.dyn" packed_output = "elf_file_unittest_relocs_arm64_packed.so" unpacked_output = "elf_file_unittest_relocs_arm64.so" diff --git a/tools/relocation_packer/config.gni b/tools/relocation_packer/config.gni index 90e3979..4cdd945 100644 --- a/tools/relocation_packer/config.gni +++ b/tools/relocation_packer/config.gni @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -relocation_packing_supported = target_arch == "arm" || target_arch == "arm64" +relocation_packing_supported = target_cpu == "arm" || target_cpu == "arm64" if (relocation_packing_supported) { relocation_packer_target = "//tools/relocation_packer($host_toolchain)" @@ -10,9 +10,9 @@ if (relocation_packing_supported) { get_label_info("$relocation_packer_target", "root_out_dir") relocation_packer_exe = "${relocation_packer_dir}/relocation_packer" - if (target_arch == "arm") { + if (target_cpu == "arm") { relocations_have_addends = 0 - } else if (target_arch == "arm64") { + } else if (target_cpu == "arm64") { relocations_have_addends = 1 } } else { |