-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathios_juce_lib_build.sh
53 lines (38 loc) · 1.53 KB
/
ios_juce_lib_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# returns immediately if any command returns error
set -e
target="juce_lib - Static Library"
libname="juce_lib"
flutter_wrapper_package="juce_mix_player_package"
flutter_app="flutter_app"
root_dir=`pwd`
# generate dart files from native header
cd "$flutter_wrapper_package"
flutter pub get
dart run ffigen
cd "$root_dir"
cd "$libname/Builds/iOS" &&
# clear previous files
rm -rf "build/${libname}.xcframework"
rm -rf "build/Release-iphoneos"
rm -rf "build/Release-iphonesimulator"
# build for iphones
xcodebuild -target "${target}" -configuration Release -sdk iphoneos only_active_arch=no build LLVM_LTO=NO &&
mkdir build/Release-iphoneos &&
cp "build/Release/lib${libname}.a" "build/Release-iphoneos/${libname}.a" &&
# build for simulaotrs
xcodebuild -target "${target}" -configuration Release -sdk iphonesimulator only_active_arch=no LLVM_LTO=NO &&
mkdir build/Release-iphonesimulator &&
cp "build/Release/lib${libname}.a" "build/Release-iphonesimulator/${libname}.a" &&
# create xcframework, with native headers
xcodebuild -create-xcframework \
-library "build/Release-iphoneos/${libname}.a" -headers ../../../modules/juce_mix_player/includes \
-library "build/Release-iphonesimulator/${libname}.a" -headers ../../../modules/juce_mix_player/includes \
-output "build/${libname}.xcframework" &&
echo "✅ Build Success ✅"
cd "$root_dir"
rm -rf \
"$libname/Builds/iOS/build/${libname}.xcframework"
cp -r \
"$libname/Builds/iOS/build/${libname}.xcframework" \
"dist/$libname.xcframework"
echo "✅ Copy framework to 'dist' success ✅"