forked from firka/flutter
[macOS] Enable universal binary builds by default (#100271)
This changes the default build architectures for Flutter macOS apps to x86_64 and arm64. Previously, we manually excluded arm64 builds via the EXCLUDE_ARCHS Xcode setting in Flutter's generated xcconfig file. This eliminates setting EXCLUDE_ARCHS during the build and updates the default architectures in the tool and in the macos_assemble.sh wrapper. Issue: https://github.com/flutter/flutter/issues/97681 Umbrella issue: https://github.com/flutter/flutter/issues/60113
This commit is contained in:
@@ -80,7 +80,7 @@ abstract class UnpackMacOS extends Target {
|
||||
}
|
||||
|
||||
void _thinFramework(Environment environment, String frameworkBinaryPath) {
|
||||
final String archs = environment.defines[kDarwinArchs] ?? 'x86_64';
|
||||
final String archs = environment.defines[kDarwinArchs] ?? 'x86_64 arm64';
|
||||
final List<String> archList = archs.split(' ').toList();
|
||||
final ProcessResult infoResult = environment.processManager.runSync(<String>[
|
||||
'lipo',
|
||||
@@ -186,7 +186,7 @@ class DebugMacOSFramework extends Target {
|
||||
final Iterable<DarwinArch> darwinArchs = environment.defines[kDarwinArchs]
|
||||
?.split(' ')
|
||||
.map(getDarwinArchForName)
|
||||
?? <DarwinArch>[DarwinArch.x86_64];
|
||||
?? <DarwinArch>[DarwinArch.x86_64, DarwinArch.arm64];
|
||||
|
||||
final Iterable<String> darwinArchArguments =
|
||||
darwinArchs.expand((DarwinArch arch) => <String>['-arch', getNameForDarwinArch(arch)]);
|
||||
@@ -256,7 +256,7 @@ class CompileMacOSFramework extends Target {
|
||||
?.split(' ')
|
||||
.map(getDarwinArchForName)
|
||||
.toList()
|
||||
?? <DarwinArch>[DarwinArch.x86_64];
|
||||
?? <DarwinArch>[DarwinArch.x86_64, DarwinArch.arm64];
|
||||
if (targetPlatform != TargetPlatform.darwin) {
|
||||
throw Exception('compile_macos_framework is only supported for darwin TargetPlatform.');
|
||||
}
|
||||
|
||||
@@ -200,15 +200,12 @@ Future<List<String>> _xcodeBuildSettingsLines({
|
||||
xcodeBuildSettings.add('ARCHS=$arch');
|
||||
}
|
||||
}
|
||||
if (useMacOSConfig) {
|
||||
// ARM not yet supported https://github.com/flutter/flutter/issues/69221
|
||||
xcodeBuildSettings.add('EXCLUDED_ARCHS=arm64');
|
||||
} else {
|
||||
String excludedSimulatorArchs = 'i386';
|
||||
|
||||
if (!useMacOSConfig) {
|
||||
// If any plugins or their dependencies do not support arm64 simulators
|
||||
// (to run natively without Rosetta translation on an ARM Mac),
|
||||
// the app will fail to build unless it also excludes arm64 simulators.
|
||||
String excludedSimulatorArchs = 'i386';
|
||||
if (!(await project.ios.pluginsSupportArmSimulator())) {
|
||||
excludedSimulatorArchs += ' arm64';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user