Support multi-arch iOS binaries (#17312)
This change adds support for armv7, arm64, and universal iOS apps.
This change eliminates iOS target architecture hardcoding (previously
arm64 only) and uses the target architecture(s) specified in Xcode's
ARCHS setting ('Architectures' in Xcode Build Settings).
For universal binaries, set ARCHS to its default value, $(ARCHS_STANDARD).
Note that after changing the architecture in Xcode, developers should
run 'pod install' from the ios subdirectory of their project. A separate
change (that will land before this one) will add support for
automatically detecting project file and Podfile changes and re-running
pod install if necessary.
This change also adds an --ios-arch option to flutter build aot. In iOS
AOT builds (in profile and release mode), this dictates which
architectures are built into App.framework. This flag should generally
be unnecessary to set manually since flutter build aot is typically only
invoked internally by flutter itself.
diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart
index 82e7dea..2472b9d 100644
--- a/packages/flutter_tools/lib/src/build_info.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -160,6 +160,41 @@
tester,
}
+/// iOS target device architecture.
+//
+// TODO(cbracken): split TargetPlatform.ios into ios_armv7, ios_arm64.
+enum IOSArch {
+ armv7,
+ arm64,
+}
+
+/// The default set of iOS device architectures to build for.
+const List<IOSArch> defaultIOSArchs = const <IOSArch>[
+ IOSArch.arm64,
+];
+
+String getNameForIOSArch(IOSArch arch) {
+ switch (arch) {
+ case IOSArch.armv7:
+ return 'armv7';
+ case IOSArch.arm64:
+ return 'arm64';
+ }
+ assert(false);
+ return null;
+}
+
+IOSArch getIOSArchForName(String arch) {
+ switch (arch) {
+ case 'armv7':
+ return IOSArch.armv7;
+ case 'arm64':
+ return IOSArch.arm64;
+ }
+ assert(false);
+ return null;
+}
+
String getNameForTargetPlatform(TargetPlatform platform) {
switch (platform) {
case TargetPlatform.android_arm: