Skip to content

Commit cccae4a

Browse files
committed
Add platform-specific configurations for iOS and macOS ARM64 to prevent AVX code compilation on x64 macOS
- Updated `Utils.cmake` to set appropriate `target_platforms_arg` for iOS and macOS when building on ARM64. - Added execution platforms `ios-arm64` and `macos-arm64` in `shim/BUCK` for specifying CPU and OS configurations. - fix #6691
1 parent 39e5b91 commit cccae4a

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

build/Utils.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,19 @@ function(extract_sources sources_file)
196196
message(FATAL_ERROR "Unsupported ANDROID_ABI setting ${ANDROID_ABI}. Please add it here!")
197197
endif()
198198
endif()
199+
200+
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
201+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
202+
set(target_platforms_arg "--target-platforms=shim//:ios-arm64")
203+
endif()
204+
endif()
205+
206+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
207+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
208+
set(target_platforms_arg "--target-platforms=shim//:macos-arm64")
209+
endif()
210+
endif()
211+
199212
execute_process(
200213
COMMAND
201214
${PYTHON_EXECUTABLE} ${executorch_root}/build/extract_sources.py

shim/BUCK

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,19 @@ execution_platform(
7474
use_windows_path_separators = host_info().os.is_windows,
7575
visibility = ["PUBLIC"],
7676
)
77+
78+
execution_platform(
79+
name = "ios-arm64",
80+
cpu_configuration = "prelude//cpu:arm64",
81+
os_configuration = "prelude//os:ios",
82+
use_windows_path_separators = False,
83+
visibility = ["PUBLIC"],
84+
)
85+
86+
execution_platform(
87+
name = "macos-arm64",
88+
cpu_configuration = "prelude//cpu:arm64",
89+
os_configuration = "prelude//os:macos",
90+
use_windows_path_separators = False,
91+
visibility = ["PUBLIC"],
92+
)

0 commit comments

Comments
 (0)