Created
April 26, 2021 10:45
-
-
Save MapaX/5dc58ccb16ad1f772907154ae4991dca to your computer and use it in GitHub Desktop.
Shell script to create xcframeworks from MLKit frameworks
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
#!/bin/zsh | |
makeXCFramework () { | |
BASEDIR=$(pwd) | |
echo "Script location: ${BASEDIR}" | |
LIBNAME=$(basename $BASEDIR) | |
echo "lib is: $LIBNAME" | |
cd Frameworks | |
mkdir -p iphoneos | |
mkdir -p iphonesimulator | |
# Copy framework into the platform specific directories | |
cp -R $LIBNAME.framework/ iphoneos/$LIBNAME.framework | |
cp -R $LIBNAME.framework/ iphonesimulator/$LIBNAME.framework | |
xcrun lipo -remove x86_64 ./iphoneos/$LIBNAME.framework/$LIBNAME -o ./iphoneos/$LIBNAME.framework/$LIBNAME | |
xcrun lipo -remove arm64 ./iphonesimulator/$LIBNAME.framework/$LIBNAME -o ./iphonesimulator/$LIBNAME.framework/$LIBNAME | |
xcodebuild -create-xcframework -framework iphoneos/$LIBNAME.framework/ -framework iphonesimulator/$LIBNAME.framework/ -output ../../"$LIBNAME.xcframework" | |
cd .. | |
cd .. | |
} | |
cd MLKitCommon | |
makeXCFramework | |
cd MLKitVision | |
makeXCFramework | |
cd MLKitTextRecognition | |
makeXCFramework |
I think the easy way is to clone the https://github.com/nilsnilsnils/MLKitFrameworkTools repo, tune the Pod file and just follow the instructions in there.
I have not checked what the translate contains, but same approach should work just fine.
can anyone give me xcframework file of GoogleMLKit/FaceDetection. I tried the following script but in output folder, there is no framework at all :(
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How would I apply this to GoogleMLKit/Translate?