From 14dfcf0b8133819f76aafe642fe4f0f0a74a4880 Mon Sep 17 00:00:00 2001 From: Anthony Shoumikhin Date: Sat, 29 Aug 2026 06:42:24 -0700 Subject: [PATCH] Give the flatc and flatcc host tools a valid macOS deployment floor Xcode 26 raised the minimum iOS deployment target to 15, so the ios and ios-simulator presets could no longer configure at their old 12.0 floor. This is the current shipping Xcode, not only the 27 beta. Raise both presets to 15.0. The flatc and flatcc tools are built by host sub-projects that run on the build machine. On an iOS build they were handed the app's iOS deployment target, and after Xcode 26/27 that value is an iOS floor the host compiler rejects, so the sub-builds produced a flatc the build machine could not run and the schema step failed. Give those host sub-builds an explicit macOS floor instead of the iOS one. The SDK-root line above them was already blanked for non-MAC Apple builds for the same host-vs-target reason; this completes it for the deployment target. Also add CMakePresets.json to the Apple workflow's path filter so a preset change runs the framework packaging job, and fix a stale deployment-target comment in the MLX build. Test Plan: On a Mac with the ios.toolchain, the flatc host sub-build now configures with a macOS deployment floor (14.0) instead of the iOS target, so it targets the host. Both iOS presets configure at 15.0 on Xcode 27; 12.0 is rejected. The preset floor keeps the top-level iOS configure legal; the host-floor change keeps the flatc and flatcc sub-builds runnable. --- .github/workflows/apple.yml | 3 +++ CMakePresets.json | 4 ++-- backends/mlx/CMakeLists.txt | 11 +++++------ third-party/CMakeLists.txt | 24 ++++++++++++++++++------ 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.github/workflows/apple.yml b/.github/workflows/apple.yml index 4d19bd23527..b55bd92d6a2 100644 --- a/.github/workflows/apple.yml +++ b/.github/workflows/apple.yml @@ -17,6 +17,9 @@ on: - scripts/build_apple_llm_demo.sh - scripts/create_frameworks.sh - Package.swift + - CMakePresets.json + - third-party/CMakeLists.txt + - backends/mlx/** - .ci/scripts/test_ios_ci.sh - extension/apple/** - extension/benchmark/apple/** diff --git a/CMakePresets.json b/CMakePresets.json index fe74bc437b7..34a35123ef6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -64,7 +64,7 @@ "EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/ios.cmake", "PLATFORM": "OS64", "DEPLOYMENT_TARGET": "17.0", - "CMAKE_OSX_DEPLOYMENT_TARGET": "12.0" + "CMAKE_OSX_DEPLOYMENT_TARGET": "15.0" }, "condition": { "lhs": "${hostSystemName}", @@ -82,7 +82,7 @@ "EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/ios.cmake", "PLATFORM": "SIMULATORARM64", "DEPLOYMENT_TARGET": "17.0", - "CMAKE_OSX_DEPLOYMENT_TARGET": "12.0" + "CMAKE_OSX_DEPLOYMENT_TARGET": "15.0" }, "condition": { "lhs": "${hostSystemName}", diff --git a/backends/mlx/CMakeLists.txt b/backends/mlx/CMakeLists.txt index 32be05462e4..2a3d1546755 100644 --- a/backends/mlx/CMakeLists.txt +++ b/backends/mlx/CMakeLists.txt @@ -266,12 +266,11 @@ ExternalProject_Add( CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${_mlx_build_type}" -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} ${_mlx_cxx_flags_arg} - # The preset's DEPLOYMENT_TARGET carries the correct per-slice - # minimum (iOS 17, macOS 14); the ios.toolchain leaves - # CMAKE_OSX_DEPLOYMENT_TARGET at 12.0 on the iOS slices and only - # syncs it for MAC. The shader-flag patch reads - # CMAKE_OSX_DEPLOYMENT_TARGET, so feed the preset value in as that, - # or the iOS metallib is stamped -mios-version-min=12.0. + # Feed the preset's per-slice DEPLOYMENT_TARGET in as + # CMAKE_OSX_DEPLOYMENT_TARGET: the ios.toolchain does not reliably + # carry it to this sub-build, and the shader-flag patch reads + # CMAKE_OSX_DEPLOYMENT_TARGET to stamp the metallib's minimum OS + # version, so without this the iOS metallib gets the wrong floor. -DCMAKE_OSX_DEPLOYMENT_TARGET=${_mlx_osx_deployment_target} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DPLATFORM=${PLATFORM} diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index adcb541b3c3..9073d479ed9 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -46,6 +46,20 @@ else() set(_flatbuffers_ep_additional_args) endif() +# The flatc and flatcc host tools are built for the build machine. On a non-MAC +# Apple build the parent's CMAKE_OSX_DEPLOYMENT_TARGET is an iOS floor the host +# compiler rejects, so the host sub-builds get this macOS floor instead, to +# match the package's macOS minimum. _executorch_apple_cross is true only for a +# non-MAC Apple build, where the host tool must not take the app's SDK or floor. +set(_executorch_host_macos_floor 14.0) +set(_executorch_apple_cross + "$,$>>" +) +set(_executorch_host_osx_args + "$<${_executorch_apple_cross}:-DCMAKE_OSX_SYSROOT=>" + "-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=$" +) + # Allow reusing a prebuilt host flatc instead of building it from source. This is # required when cross-compiling with the Ninja generator on Windows: the WIN32 # branch above only supports the Visual Studio generator (it passes the VS-only @@ -73,10 +87,9 @@ ExternalProject_Add( # Unset the toolchain to build for the host instead of the toolchain set for # the project. -DCMAKE_TOOLCHAIN_FILE= - # If building for iOS, "unset" these variables to rely on the host (macOS) - # defaults. - $<$,$>>:-DCMAKE_OSX_SYSROOT=> - -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET} + # flatc runs on the build machine, so it must target the host, not the app's + # iOS platform. See _executorch_host_osx_args above. + ${_executorch_host_osx_args} BUILD_BYPRODUCTS /bin/flatc ${_executorch_external_project_additional_args} ${_flatbuffers_ep_additional_args} @@ -140,8 +153,7 @@ ExternalProject_Add( -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_TOOLCHAIN_FILE= - $<$,$>>:-DCMAKE_OSX_SYSROOT=> - -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET} + ${_executorch_host_osx_args} ${_flatcc_extra_cmake_args} BUILD_BYPRODUCTS /bin/flatcc ${_executorch_external_project_additional_args}