Repository: ggerganov/whisper.cpp
File: build-xcframework.sh (Shell)

Code before:

# Create dynamic libraries from static libraries
echo "Creating dynamic libraries from static libraries..."
combine_static_libraries "build-ios-sim" "Release-iphonesimulator" "ios" "true"
combine_static_libraries "build-ios-device" "Release-iphoneos" "ios" "false"
combine_static_libraries "build-macos" "Release" "macos" "false"
combine_static_libraries "build-visionos" "Release-xros" "visionos" "false"
combine_static_libraries "build-visionos-sim" "Release-xrsimulator" "visionos" "true"
combine_static_libraries "build-tvos-sim" "Release-appletvsimulator" "tvos" "true"
combine_static_libraries "build-tvos-device" "Release-appletvos" "tvos" "false"

# Create XCFramework with correct debug symbols paths
echo "Creating XCFramework..."

if [[ "${BUILD_STATIC_XCFRAMEWORK}" == "ON" ]]; then
    xcodebuild -create-xcframework \
        -framework $(pwd)/build-ios-sim/framework/whisper.framework \
        -framework $(pwd)/build-ios-device/framework/whisper.framework \
        -framework $(pwd)/build-macos/framework/whisper.framework \
        -framework $(pwd)/build-visionos/framework/whisper.framework \
        -framework $(pwd)/build-visionos-sim/framework/whisper.framework \
        -framework $(pwd)/build-tvos-device/framework/whisper.framework \
        -framework $(pwd)/build-tvos-sim/framework/whisper.framework \
        -output $(pwd)/build-apple/whisper.xcframework
    exit 0
fi 

xcodebuild -create-xcframework \
    -framework $(pwd)/build-ios-sim/framework/whisper.framework \
    -debug-symbols $(pwd)/build-ios-sim/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-ios-device/framework/whisper.framework \
    -debug-symbols $(pwd)/build-ios-device/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-macos/framework/whisper.framework \
    -debug-symbols $(pwd)/build-macos/dSYMS/whisper.dSYM \
    -framework $(pwd)/build-visionos/framework/whisper.framework \
    -debug-symbols $(pwd)/build-visionos/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-visionos-sim/framework/whisper.framework \
    -debug-symbols $(pwd)/build-visionos-sim/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-tvos-device/framework/whisper.framework \
    -debug-symbols $(pwd)/build-tvos-device/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-tvos-sim/framework/whisper.framework \
    -debug-symbols $(pwd)/build-tvos-sim/dSYMs/whisper.dSYM \
    -output $(pwd)/build-apple/whisper.xcframework


Review comment (suggestion):
Nit: can you remove the extra whitespace after `fi` (does not show up in github but is visible using a local git diff). You can add `[no ci]` to the commit to avoid running the full CI again. 

Code after:

# Create dynamic libraries from static libraries
echo "Creating dynamic libraries from static libraries..."
combine_static_libraries "build-ios-sim" "Release-iphonesimulator" "ios" "true"
combine_static_libraries "build-ios-device" "Release-iphoneos" "ios" "false"
combine_static_libraries "build-macos" "Release" "macos" "false"
combine_static_libraries "build-visionos" "Release-xros" "visionos" "false"
combine_static_libraries "build-visionos-sim" "Release-xrsimulator" "visionos" "true"
combine_static_libraries "build-tvos-sim" "Release-appletvsimulator" "tvos" "true"
combine_static_libraries "build-tvos-device" "Release-appletvos" "tvos" "false"

# Create XCFramework with correct debug symbols paths
echo "Creating XCFramework..."

if [[ "${BUILD_STATIC_XCFRAMEWORK}" == "ON" ]]; then
    xcodebuild -create-xcframework \
        -framework $(pwd)/build-ios-sim/framework/whisper.framework \
        -framework $(pwd)/build-ios-device/framework/whisper.framework \
        -framework $(pwd)/build-macos/framework/whisper.framework \
        -framework $(pwd)/build-visionos/framework/whisper.framework \
        -framework $(pwd)/build-visionos-sim/framework/whisper.framework \
        -framework $(pwd)/build-tvos-device/framework/whisper.framework \
        -framework $(pwd)/build-tvos-sim/framework/whisper.framework \
        -output $(pwd)/build-apple/whisper.xcframework
    exit 0
fi

xcodebuild -create-xcframework \
    -framework $(pwd)/build-ios-sim/framework/whisper.framework \
    -debug-symbols $(pwd)/build-ios-sim/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-ios-device/framework/whisper.framework \
    -debug-symbols $(pwd)/build-ios-device/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-macos/framework/whisper.framework \
    -debug-symbols $(pwd)/build-macos/dSYMS/whisper.dSYM \
    -framework $(pwd)/build-visionos/framework/whisper.framework \
    -debug-symbols $(pwd)/build-visionos/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-visionos-sim/framework/whisper.framework \
    -debug-symbols $(pwd)/build-visionos-sim/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-tvos-device/framework/whisper.framework \
    -debug-symbols $(pwd)/build-tvos-device/dSYMs/whisper.dSYM \
    -framework $(pwd)/build-tvos-sim/framework/whisper.framework \
    -debug-symbols $(pwd)/build-tvos-sim/dSYMs/whisper.dSYM \
    -output $(pwd)/build-apple/whisper.xcframework