-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.sh
92 lines (83 loc) · 2.66 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
set -e
if [[ $# -eq 0 ]]; then
echo "Usage: $0 [arm64-apple-ios|arm64-apple-ios-macabi|arm64-apple-xros|arm64-apple-tvos]"
exit 1
fi
OUTPUT_DIR="out"
for target in "$@"; do
case $target in
arm64-apple-ios)
echo "Building for $target..."
clang=$(xcrun --sdk iphoneos -f clang)
sdk_dir=$(xcrun --sdk iphoneos --show-sdk-path)
out_dir=$OUTPUT_DIR/$target
mkdir -p $out_dir
$clang -dynamiclib \
-x objective-c \
-target arm64-apple-ios13.1 \
-isysroot $sdk_dir \
-framework Foundation \
-framework UIKit \
-o $out_dir/LuckySpeeder.dylib LuckySpeeder.m \
-Ofast \
-flto
;;
arm64-apple-ios-macabi)
echo "Building for $target..."
clang=$(xcrun --sdk macosx -f clang)
sdk_dir=$(xcrun --sdk macosx --show-sdk-path)
out_dir=$OUTPUT_DIR/$target
mkdir -p $out_dir
$clang -dynamiclib \
-x objective-c \
-target arm64-apple-ios13.1-macabi \
-isysroot $sdk_dir \
-isystem $sdk_dir/System/iOSSupport/usr/include \
-iframework $sdk_dir/System/iOSSupport/System/Library/Frameworks \
-framework Foundation \
-framework UIKit \
-o $out_dir/LuckySpeeder.dylib LuckySpeeder.m \
-Ofast \
-flto
;;
arm64-apple-xros)
echo "Building for $target..."
clang=$(xcrun --sdk xros -f clang)
sdk_dir=$(xcrun --sdk xros --show-sdk-path)
out_dir=$OUTPUT_DIR/$target
mkdir -p $out_dir
$clang -dynamiclib \
-x objective-c \
-target arm64-apple-xros1.0 \
-isysroot $sdk_dir \
-framework Foundation \
-framework UIKit \
-o $out_dir/LuckySpeeder.dylib LuckySpeeder.m \
-Ofast \
-flto
;;
arm64-apple-tvos)
echo "Building for $target..."
clang=$(xcrun --sdk appletvos -f clang)
sdk_dir=$(xcrun --sdk appletvos --show-sdk-path)
out_dir=$OUTPUT_DIR/$target
mkdir -p $out_dir
$clang -dynamiclib \
-x objective-c \
-target arm64-apple-tvos13.2 \
-isysroot $sdk_dir \
-framework Foundation \
-framework UIKit \
-o $out_dir/LuckySpeeder.dylib LuckySpeeder.m \
-Ofast \
-flto
;;
*)
echo "Invalid target: $target"
echo "Usage: $0 [arm64-apple-ios|arm64-apple-ios-macabi|arm64-apple-xros|arm64-apple-tvos]"
exit 1
;;
esac
done
echo "Build completed!"