-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathxcframework.sh
More file actions
executable file
·40 lines (31 loc) · 1.08 KB
/
xcframework.sh
File metadata and controls
executable file
·40 lines (31 loc) · 1.08 KB
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
#!/bin/bash
#simple script to create xcframework, I was using this to build LSAutoInjector.framework for xcode
DEVICE_DYLIB_PATH=".theos/obj/debug/libSupport.dylib"
SIMULATOR_DYLIB_PATH=".theos/obj/iphone_simulator/debug/libSupport.dylib"
XC_FRAMEWORK_OUTPUT=".theos/libSupport.xcframework"
# array to hold our paths for our compiled dylibs
DYLIB_PATHS=()
#### some check checks to determine if some paths are present ####
if [ -f "$DEVICE_DYLIB_PATH" ]; then
DYLIB_PATHS+=(-library "$DEVICE_DYLIB_PATH")
fi
if [ -f "$SIMULATOR_DYLIB_PATH" ]; then
DYLIB_PATHS+=(-library "$SIMULATOR_DYLIB_PATH")
fi
if [ ${#DYLIB_PATHS[@]} -eq 0 ]; then
echo "No dylibs found."
exit 1
fi
# remove xcframework if it exists
[ -d "$XC_FRAMEWORK_OUTPUT" ] && rm -rf "$XC_FRAMEWORK_OUTPUT"
# create xcframework from provided dylibs
xcodebuild -create-xcframework \
"${DYLIB_PATHS[@]}" \
-output "$XC_FRAMEWORK_OUTPUT"
# check the succession of the build
if [ $? -eq 0 ]; then
echo "created $XC_FRAMEWORK_OUTPUT"
echo " ${DYLIB_PATHS[@]}"
else
echo "cannot create xcframework"
fi