Repository navigation
Conversation
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.
|
Thanks — I can confirm the diagnosis. CMake (4.4.4 here) has no deployment-target flag for Swift, and swiftc is the link driver, so Tested on M3 Max, macOS 27.2, Xcode 27, CMake 4.4.4, Ninja:
Builds cleanly, the Metal backend works, and there's no performance difference. One gap: So @@ -804,7 +804,6 @@ elseif(USE_BACKEND STREQUAL "METAL")
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
message(FATAL_ERROR "Project requires building with AppleClang. Have ${CMAKE_CXX_COMPILER_ID}")
endif()
- add_subdirectory(external/katagocoreml)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/macos/cmake/modules")
if (NOT CMAKE_OSX_SYSROOT)
@@ -818,6 +817,7 @@ elseif(USE_BACKEND STREQUAL "METAL")
if(NOT CMAKE_Swift_FLAGS MATCHES "-target ")
string(APPEND CMAKE_Swift_FLAGS " -target ${CMAKE_SYSTEM_PROCESSOR}-apple-macosx${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
+ add_subdirectory(external/katagocoreml)
set(NEURALNET_BACKEND_SOURCES
neuralnet/metalbackend.cpp
)Two notes, not blocking:
I haven't run the binary on an actual macOS 13 machine. |
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_TARGETto 13.0.The C++ files do get
-mmacosx-version-min=13.0, but CMake passes nothing to swiftc, and swiftc is what linkskatago, so it falls back to the host's version. Passing-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0on the command line doesn't help either.This adds
-target <arch>-apple-macosx13.0to the Swift flags, unless a-targetis already inCMAKE_Swift_FLAGS.Tested on Apple Silicon only (M2 Max, macOS 26.6.2, Xcode 27.0, CMake 4.4.3), checking
minoswithotool -l katago:-DCMAKE_Swift_FLAGS="-target arm64-apple-macosx14.0": 14.0The 13.0 build runs fine (
katago versionreports the Metal backend, andkatago benchmarkworks).