Created
October 9, 2021 12:38
-
-
Save robnadin/3233de3aa9b13d25e8c49cfbf853b0a5 to your computer and use it in GitHub Desktop.
Convert universal(fat) frameworks to XCFrameworks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
set -eo pipefail | |
# -e exit if any command returns non-zero status code | |
# -o pipefail force pipelines to fail on first non-zero status code | |
declare -a frameworks=("Bold360AI" "BoldAIAccessibility" "BoldAIEngine" "BoldCore" "BoldEngine") | |
# Create directories | |
mkdir -p iphoneos | |
mkdir -p iphonesimulator | |
rm -rf output | |
mkdir -p output | |
for framework in "${frameworks[@]}" | |
do | |
# Copy framework into the platform specific directories | |
cp -R vendor/${framework}.framework/ iphoneos/${framework}.framework | |
cp -R vendor/${framework}.framework/ iphonesimulator/${framework}.framework | |
# Remove slices that aren't relevant to the device slice of the xcframework | |
xcrun lipo -remove x86_64 -remove i386 ./iphoneos/${framework}.framework/${framework} -o ./iphoneos/${framework}.framework/${framework} | |
xcrun lipo -remove arm64 -remove armv7s -remove armv7 ./iphonesimulator/${framework}.framework/${framework} -o ./iphonesimulator/${framework}.framework/${framework} | |
# Create xcframework from the platform slices | |
xcodebuild -create-xcframework -framework iphoneos/${framework}.framework/ -framework iphonesimulator/${framework}.framework/ -output "output/${framework}.xcframework" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment