From 263542dc689b7450625b9b040496a04382e0d30f Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 26 Oct 2015 17:11:53 -0700 Subject: [PATCH] Remove `ios_active_arch` and directly specify `arm64` vs `armv7` preference via `target_cpu` --- engine/src/flutter/build/config/arm.gni | 10 +++++-- .../flutter/build/config/compiler/BUILD.gn | 30 ++++++------------- engine/src/flutter/skia/BUILD.gn | 5 +++- engine/src/flutter/sky/tools/gn | 14 ++++++++- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/engine/src/flutter/build/config/arm.gni b/engine/src/flutter/build/config/arm.gni index 6d63965e39d..429a250b21d 100644 --- a/engine/src/flutter/build/config/arm.gni +++ b/engine/src/flutter/build/config/arm.gni @@ -2,11 +2,17 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -if (current_cpu == "arm") { +if (current_cpu == "arm" || current_cpu == "arm64") { declare_args() { # Version of the ARM processor when compiling on ARM. Ignored on non-ARM # platforms. - arm_version = 7 + if (current_cpu == "arm") { + arm_version = 7 + } else if(current_cpu == "arm64") { + arm_version = 8 + } else { + assert(false, "Unconfigured arm version") + } # The ARM floating point mode. This is either the string "hard", "soft", or # "softfp". An empty string means to use the default one for the diff --git a/engine/src/flutter/build/config/compiler/BUILD.gn b/engine/src/flutter/build/config/compiler/BUILD.gn index 06e92093e8d..8869b4ea9c0 100644 --- a/engine/src/flutter/build/config/compiler/BUILD.gn +++ b/engine/src/flutter/build/config/compiler/BUILD.gn @@ -60,14 +60,6 @@ declare_args() { # The patch is preapplied to the internal toolchain and hence all bots. msvs_xtree_patched = false } - - # By default, iOS executables are fat binaries that contain armv7 and arm64 - # build artifacts. This is suitable for release builds and for testing on - # older devices. However, generating fat binaries takes a very long time, and, - # depending on the application type, may be unnecessary. If the type of - # architecture is known beforehand, setting that as the active arch will - # greatly reduce build times and reduce binary sizes. - ios_active_arch = "arm64" } # default_include_dirs --------------------------------------------------------- @@ -271,19 +263,15 @@ config("compiler") { "i386", ] } else if (current_cpu == "arm") { - if (ios_active_arch != "") { - common_mac_flags += [ - "-arch", - ios_active_arch, - ] - } else { - common_mac_flags += [ - "-arch", - "arm64", - "-arch", - "armv7", - ] - } + common_mac_flags += [ + "-arch", + "armv7", + ] + } else if (current_cpu == "arm64") { + common_mac_flags += [ + "-arch", + "arm64", + ] } cflags += common_mac_flags diff --git a/engine/src/flutter/skia/BUILD.gn b/engine/src/flutter/skia/BUILD.gn index 9b3cd9844df..e61fd0c310e 100644 --- a/engine/src/flutter/skia/BUILD.gn +++ b/engine/src/flutter/skia/BUILD.gn @@ -5,7 +5,7 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//testing/test.gni") -if (current_cpu == "arm") { +if (current_cpu == "arm" || current_cpu == "arm64") { import("//build/config/arm.gni") } if (current_cpu == "mipsel" || current_cpu == "mips64el") { @@ -583,6 +583,9 @@ source_set("skia_opts") { } else { sources = gypi_skia_opts.none_sources } + } else if (current_cpu == "arm64") { + # TODO(1841): NEON sources are not currently used on arm64. + sources = gypi_skia_opts.none_sources } else if (current_cpu == "mipsel") { cflags += [ "-fomit-frame-pointer" ] diff --git a/engine/src/flutter/sky/tools/gn b/engine/src/flutter/sky/tools/gn index f0edd27cb1d..76586325407 100755 --- a/engine/src/flutter/sky/tools/gn +++ b/engine/src/flutter/sky/tools/gn @@ -40,6 +40,11 @@ def to_gn_args(args): gn_args['is_debug'] = args.debug gn_args['is_clang'] = args.clang and args.target_os not in ['android'] + ios_target_cpu = 'arm64' + if args.ios_force_armv7: + ios_target_cpu = 'arm' + pass + if args.target_os == 'android': gn_args['target_os'] = 'android' elif args.target_os == 'ios': @@ -48,13 +53,19 @@ def to_gn_args(args): if args.simulator: gn_args['use_libjpeg_turbo'] = False gn_args['use_ios_simulator'] = args.simulator - gn_args['dart_target_arch'] = "arm64" + gn_args['dart_target_arch'] = ios_target_cpu else: gn_args['use_aura'] = False gn_args['use_glib'] = False gn_args['use_system_harfbuzz'] = False if args.target_os in ['android', 'ios'] and not args.simulator: + if args.target_os == 'ios': + # iOS defaults to arm64 builds unless forced to build armv7. This + # flag will go away once universal builds are supported + gn_args['target_cpu'] = ios_target_cpu + else: + # There are currently no arm64 Android builds gn_args['target_cpu'] = 'arm' else: gn_args['target_cpu'] = 'x64' @@ -83,6 +94,7 @@ def parse_args(args): parser.add_argument('--target-os', type=str, choices=['android', 'ios']) parser.add_argument('--android', dest='target_os', action='store_const', const='android') parser.add_argument('--ios', dest='target_os', action='store_const', const='ios') + parser.add_argument('--ios-force-armv7', dest='ios_force_armv7', action='store_true', default=False) parser.add_argument('--simulator', action='store_true', default=False) parser.add_argument('--goma', default=True, action='store_true')