Skip to content

Extends support for arm64e to macOS & visionOS platforms #8837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

pmattos
Copy link
Contributor

@pmattos pmattos commented Jun 17, 2025

Extends arm64e support for macOS & visionOS apps, besides the existing iOS support.

Motivation:

SwiftPM currently only supports building arm64e packages for iOS.

In Xcode 26 we added support to building packages for arm64e targeting macOS & visionOS platforms too.

Modifications:

Conditionally adds "arm64e" to the ARCHS build settings in the PackagePIFBuilder used to interface with Swift Build.

Result:

PIF builder nows had the capability of builds packages for arm64e. Note, for now, that this is currently disabled in SwiftPM.

I validated this by building a simple macOS executable for arm64e:

$ swift package init --type executable --name HelloWorld
$ swift run swift-build --package-path HelloWorld --build-system swiftbuild

...and then I inspected the generated binary:

$ lipo -archs HelloWorld/.build/arm64-apple-macosx/Products/Debug/HelloWorld 
arm64e

@pmattos pmattos changed the title Support for arm64e Extends support for arm64e to macOS & visionOS platforms Jun 17, 2025
@plemarquand
Copy link
Contributor

@swift-ci please test

@plemarquand
Copy link
Contributor

@swift-ci test windows

@pmattos pmattos merged commit 0a4d139 into main Jun 23, 2025
6 checks passed
@pmattos pmattos deleted the pmattos/arm64e-support branch June 23, 2025 18:45
marcprux pushed a commit to swift-everywhere/swift-package-manager that referenced this pull request Jul 7, 2025
)

Extends arm64e support for macOS & visionOS apps, 
besides the existing iOS support.

### Motivation:

SwiftPM currently only supports building arm64e packages for iOS.

In Xcode 26 we added support to building packages for 
arm64e targeting macOS & visionOS platforms too.

### Modifications:

Conditionally adds "arm64e" to the ARCHS build settings in 
the `PackagePIFBuilder` used to interface with Swift Build.

### Result:

PIF builder nows had the capability of builds packages for arm64e. 
Note, for now, that this is currently disabled in SwiftPM.

I validated this by building a simple macOS executable for arm64e:

    $ swift package init --type executable --name HelloWorld
    $ swift run swift-build --package-path HelloWorld --build-system swiftbuild

...and then I inspected the generated binary:

    $ lipo -archs HelloWorld/.build/arm64-apple-macosx/Products/Debug/HelloWorld 
    arm64e
pmattos added a commit that referenced this pull request Jul 25, 2025
### Motivation:

I extended arm64e support for macOS & visionOS apps in my previous
PR #8837. When enabled, that patch *only* produced the arm64e slice
but...

The App Store will now accept arm64e for macOS, iOS, and visionOS —
arm64e is optional and off by default. But when you turn on arm64e
support for packages (ie, using `shouldPackagesBuildForARM64e` PIF
builder delegate method) we expect *both* slices in the binary now.

### Modifications:

Changes the PIF builder to update the ARCHS settings without
overriding it completely, ensuring we get all required slices (ie, a so
called fat binary).

### Result:

PIF builder nows has the capability of building packages for arm64 and
arm64e. (Note, for now, that this is currently disabled in SwiftPM.)

I validated this by building a simple macOS executable for arm64e (and
force enabling it in SwifPM):

    $ swift package init --type executable --name HelloWorld
    $ swift run swift-build --package-path HelloWorld --build-system swiftbuild --configuration release

...and then I inspected the generated binary:

    $ lipo -archs HelloWorld/.build/arm64-apple-macosx/Products/Release/HelloWorld 
    x86_64 arm64 arm64e

Debug builds. With ONLY_ACTIVE_ARCH = "YES" in debug builds, even
though you specify multiple architectures in ARCHS, it will still only
build for the active architecture during development. This is set to
"NO" for release builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants