From 103ebe8f3d9311c5ada59fd87c1c68f446b0103f Mon Sep 17 00:00:00 2001 From: Anthony Shoumikhin Date: Fri, 23 May 2025 06:25:51 -0700 Subject: [PATCH 1/2] Copy .swiftinterface instead of .swiftmodule --- scripts/create_frameworks.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/create_frameworks.sh b/scripts/create_frameworks.sh index 36aa770eb02..8a5fb48a3c7 100755 --- a/scripts/create_frameworks.sh +++ b/scripts/create_frameworks.sh @@ -123,22 +123,23 @@ create_xcframework() { # Create the new .xcframework. xcodebuild -create-xcframework "${libraries[@]}" -output "${xcframework}" - # Copy the .swiftmodule files into the .xcframework if applicable. + # Copy the .swiftinterface files into the .xcframework if applicable. if [[ -n "$swift_module" ]]; then - echo -e "\nCopying Swift module ${swift_module}.swiftmodule into ${xcframework}" + echo -e "\nCopying Swift interface ${swift_module}.swiftinterface into ${xcframework}" for dir in "${directories[@]}"; do local module_source_dir="${dir}/${swift_module}.swiftmodule" if [ ! -d "$module_source_dir" ]; then echo "Swiftmodule directory ${module_source_dir} does not exist" exit 1 fi - local swiftmodule_file - swiftmodule_file=$(find "$module_source_dir" -maxdepth 1 -type f -name '*.swiftmodule' | head -n1) - if [[ -z "$swiftmodule_file" ]]; then - echo "No .swiftmodule file found in ${module_source_dir}" + local swiftinterface_file + swiftinterface_file=$(find "$module_source_dir" -maxdepth 1 \ + -type f -name '*.swiftinterface' ! -name '*.private.swiftinterface' | head -n1) + if [[ -z "$swiftinterface_file" ]]; then + echo "No public .swiftinterface file found in ${module_source_dir}" exit 1 fi - local base=$(basename "$swiftmodule_file" .swiftmodule) + local base=$(basename "$swiftinterface_file" .swiftinterface) local arch="${base%%-*}" local rest="${base#*-apple-}" local platform_tag @@ -156,9 +157,9 @@ create_xcframework() { echo "Warning: slice '${slice_name}' not found in ${xcframework}, skipping" continue fi - echo " - Copying ${swift_module}.swiftmodule into slice ${slice_name}" - cp "$swiftmodule_file" "${slice_path}/${swift_module}.swiftmodule" - ln -sf "../${swift_module}.swiftmodule" "${slice_path}/Headers/${swift_module}.swiftmodule" + echo " - Copying ${swift_module}.swiftinterface into slice ${slice_name}" + cp "$swiftinterface_file" "${slice_path}/${swift_module}.swiftinterface" + ln -sf "../${swift_module}.swiftinterface" "${slice_path}/Headers/${swift_module}.swiftinterface" done fi From c0836a52100443b855440aa7960b4222d2d41769 Mon Sep 17 00:00:00 2001 From: Anthony Shoumikhin Date: Fri, 23 May 2025 06:26:50 -0700 Subject: [PATCH 2/2] Update CMakeLists.txt --- extension/apple/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extension/apple/CMakeLists.txt b/extension/apple/CMakeLists.txt index 7c953244cfa..d55fa381375 100644 --- a/extension/apple/CMakeLists.txt +++ b/extension/apple/CMakeLists.txt @@ -75,8 +75,7 @@ set_target_properties(extension_apple PROPERTIES Swift_MODULE_NAME "ExecuTorch" Swift_FLAGS "${SWIFT_CLANG_INTEROP_FLAGS}" XCODE_ATTRIBUTE_SWIFT_MODULE_NAME "ExecuTorch" - XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION YES - XCODE_ATTRIBUTE_SWIFT_ENABLE_TESTABILITY YES + XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION "YES" XCODE_ATTRIBUTE_OTHER_SWIFT_FLAGS "${SWIFT_CLANG_INTEROP_FLAGS}" )