-
Notifications
You must be signed in to change notification settings - Fork 18
/
build-macos.sh
executable file
·58 lines (44 loc) · 1.15 KB
/
build-macos.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
#!/bin/bash
echo "building for $(python --version)"
version_tag="v1.16.3"
onnxruntime_dir="onnxruntime"
# cleanup
rm -rf $onnxruntime_dir
# download
git clone --recurse-submodules --shallow-submodules --depth 1 --branch $version_tag https://github.com/microsoft/onnxruntime.git $onnxruntime_dir
root_dir=$(pwd)
dist_dir="$root_dir/dist"
patch_dir="$root_dir/patches"
pushd "$root_dir/$onnxruntime_dir" || exit
# install dependencies
pip install -r requirements-dev.txt
# cmake generate to download dependencies
./build.sh --clean
./build.sh --update \
--config Release \
--parallel \
--skip_tests
# apply patches
echo "applying patches..."
# build
./build.sh --config Release \
--parallel \
--compile_no_warning_as_error \
--skip_submodule_sync \
--osx_arch "arm64" \
--use_coreml \
--build_wheel \
--wheel_name_suffix="-silicon" \
--skip_tests
# check for errors in build
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "Error while building, please check the log."
exit $RESULT
fi
# wait for file to be copied
sleep 5
# copy to dist
mkdir -p "$dist_dir"
cp -a ./build/MacOS/Release/dist/*.whl "$dist_dir"
popd || exit