Skip to content

Create an iOS and macOS preset #11111

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
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-presets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
preset: [macos-arm64, pybind, llm]
preset: [macos, ios, ios-simulator, pybind, llm]
with:
job-name: build
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
Expand Down
40 changes: 37 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"binaryDir": "${sourceDir}/cmake-out"
},
{
"name": "macos-arm64",
"displayName": "Build everything buildable on macOS arm64",
"name": "macos",
"displayName": "Build everything buildable on macOS",
"inherits": ["common"],
"generator": "Xcode",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/third-party/ios-cmake/ios.toolchain.cmake",
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/macos-arm64.cmake",
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/macos.cmake",
"PLATFORM": "MAC_ARM64",
"DEPLOYMENT_TARGET": "10.15"
},
Expand All @@ -23,6 +23,40 @@
"rhs": "Darwin"
}
},
{
"name": "ios",
"displayName": "Build everything buildable on iOS",
"inherits": ["common"],
"generator": "Xcode",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/third-party/ios-cmake/ios.toolchain.cmake",
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/ios.cmake",
"PLATFORM": "OS64",
"DEPLOYMENT_TARGET": "17.0"
},
"condition": {
"lhs": "${hostSystemName}",
"type": "equals",
"rhs": "Darwin"
}
},
{
"name": "ios-simulator",
"displayName": "Build everything buildable on iOS simulator",
"inherits": ["common"],
"generator": "Xcode",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/third-party/ios-cmake/ios.toolchain.cmake",
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/ios.cmake",
"PLATFORM": "SIMULATORARM64",
"DEPLOYMENT_TARGET": "17.0"
},
"condition": {
"lhs": "${hostSystemName}",
"type": "equals",
"rhs": "Darwin"
}
},
{
"name": "pybind",
"displayName": "Build pybindings exported in the wheel",
Expand Down
28 changes: 28 additions & 0 deletions tools/cmake/preset/apple_common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++${CMAKE_CXX_STANDARD}")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")

set(
_compiler_flags
"-ffile-prefix-map=${PROJECT_SOURCE_DIR}=/executorch"
"-fdebug-prefix-map=${PROJECT_SOURCE_DIR}=/executorch"
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_compiler_flags}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_compiler_flags}")

set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON)
set_overridable_option(EXECUTORCH_BUILD_COREML ON)
set_overridable_option(EXECUTORCH_BUILD_MPS ON)
set_overridable_option(EXECUTORCH_XNNPACK_SHARED_WORKSPACE ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_APPLE ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON)
set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_CUSTOM ON)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set_overridable_option(EXECUTORCH_BUILD_COREML ON)
include(${PROJECT_SOURCE_DIR}/tools/cmake/preset/apple_common.cmake)
10 changes: 10 additions & 0 deletions tools/cmake/preset/macos.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

include(${PROJECT_SOURCE_DIR}/tools/cmake/preset/apple_common.cmake)
include(${PROJECT_SOURCE_DIR}/tools/cmake/preset/pybind.cmake)

set_overridable_option(EXECUTORCH_BUILD_EXECUTOR_RUNNER ON)
Loading