forked from llSourcell/Doctor-Dignity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_libs.sh
executable file
·74 lines (65 loc) · 1.76 KB
/
prepare_libs.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
function help {
echo -e "OPTION:"
echo -e " -s, --simulator Build for Simulator"
echo -e " -a, --arch x86_64 | arm64 Simulator arch "
echo -e " -h, --help Prints this help\n"
}
is_simulator="false"
arch="arm64"
# Args while-loop
while [ "$1" != "" ];
do
case $1 in
-s | --simulator ) is_simulator="true"
;;
-a | --arch ) shift
arch=$1
;;
-h | --help ) help
exit
;;
*)
echo "$script: illegal option $1"
usage
exit 1 # error
;;
esac
shift
done
set -euxo pipefail
sysroot="iphoneos"
type="Release"
if [ "$is_simulator" = "true" ]; then
if [ "$arch" = "arm64" ]; then
# iOS simulator on Apple processors
rustup target add aarch64-apple-ios-sim
else
# iOS simulator on x86 processors
rustup target add x86_64-apple-ios
fi
sysroot="iphonesimulator"
type="Debug"
else
# iOS devices
rustup target add aarch64-apple-ios
fi
mkdir -p build/ && cd build/
cmake ../..\
-DCMAKE_BUILD_TYPE=$type\
-DCMAKE_SYSTEM_NAME=iOS\
-DCMAKE_SYSTEM_VERSION=14.0\
-DCMAKE_OSX_SYSROOT=$sysroot\
-DCMAKE_OSX_ARCHITECTURES=$arch\
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0\
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON\
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON\
-DCMAKE_INSTALL_PREFIX=.\
-DCMAKE_CXX_FLAGS="-O3"\
-DMLC_LLM_INSTALL_STATIC_LIB=ON\
-DUSE_METAL=ON
make mlc_llm_static
cmake --build . --target install --config release -j
cd ..
rm -rf MLCSwift/tvm_home
ln -s ../../3rdparty/tvm MLCSwift/tvm_home
python prepare_model_lib.py