Skip to content

Pass the macOS deployment target to swiftc in Metal builds - #1264

Open
Slymaster wants to merge 1 commit into
lightvector:masterfrom
Slymaster:metal-swift-deployment-target
Open

Slymaster wants to merge 1 commit into
lightvector:masterfrom
Slymaster:metal-swift-deployment-target

Conversation

@Slymaster

Copy link
Copy Markdown

I bundle a Metal build of KataGo in a small macOS app and noticed the binary needed macOS 26, the version of my build Mac, even though CMakeLists.txt sets CMAKE_OSX_DEPLOYMENT_TARGET to 13.0.

The C++ files do get -mmacosx-version-min=13.0, but CMake passes nothing to swiftc, and swiftc is what links katago, so it falls back to the host's version. Passing -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 on the command line doesn't help either.

This adds -target <arch>-apple-macosx13.0 to the Swift flags, unless a -target is already in CMAKE_Swift_FLAGS.

Tested on Apple Silicon only (M2 Max, macOS 26.6.2, Xcode 27.0, CMake 4.4.3), checking minos with otool -l katago:

  • current master: 26.0
  • with this change: 13.0
  • with this change and -DCMAKE_Swift_FLAGS="-target arm64-apple-macosx14.0": 14.0

The 13.0 build runs fine (katago version reports the Metal backend, and katago benchmark works).

CMake gives swiftc no -target, and swiftc links katago, so the binary's minimum macOS was the build machine's version instead of 13.0.

This branch has not been deployed

No deployments
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.

1 participant