-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_osx.sh
56 lines (44 loc) · 1.92 KB
/
build_osx.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
#!/usr/bin/env bash
set -e
brew install wget
brew install llvm@18
brew install libomp
brew install cmake
export CC=$(brew --prefix)/opt/llvm@18/bin/clang
export CXX=$(brew --prefix)/opt/llvm@18/bin/clang++
export LDFLAGS="-L$(brew --prefix)/opt/llvm@18/lib -Wl,-rpath,$(brew --prefix)/opt/llvm@18/lib"
export OpenMP_ROOT=$(brew --prefix)/opt/libomp
TARGET_OS="macos"
ONNXRUNTIME_SOURCE_URL="/~https://github.com/Som5ra/AI-Engine/releases/download/3rd-party/onnxruntime-osx-arm64-static_lib-1.19.2.zip"
OPENCV_SOURCE_URL="/~https://github.com/Som5ra/AI-Engine/releases/download/3rd-party/opencv-mobile-4.10.0-macos.zip"
# check if 3rdparty/onnxruntime/onnxruntime-osx-arm64-static_lib-1.19.2 exists
if [ ! -d "3rdparty/onnxruntime/onnxruntime-osx-arm64-static_lib-1.19.2" ]; then
echo "No Prebuilt onnxruntime found, Downloading from $ONNXRUNTIME_SOURCE_URL"
cd 3rdparty/onnxruntime
wget $ONNXRUNTIME_SOURCE_URL -O onnxruntime-osx-arm64-static_lib-1.19.2.zip
unzip onnxruntime-osx-arm64-static_lib-1.19.2.zip
rm onnxruntime-osx-arm64-static_lib-1.19.2.zip
cd ../../
else
echo "Prebuilt onnxruntime found: 3rdparty/onnxruntime/onnxruntime-osx-arm64-static_lib-1.19.2"
fi
# check if 3rdparty/opencv/opencv-mobile-4.10.0-macos exists
if [ ! -d "3rdparty/opencv/opencv-mobile-4.10.0-macos" ]; then
echo "No Prebuilt opencv found, Downloading from $OPENCV_SOURCE_URL"
cd 3rdparty/opencv
wget $OPENCV_SOURCE_URL -O opencv-mobile-4.10.0-macos.zip
unzip opencv-mobile-4.10.0-macos.zip
rm opencv-mobile-4.10.0-macos.zip
cd ../../
else
echo "Prebuilt OpenCV found: 3rdparty/opencv/opencv-mobile-4.10.0-macos"
fi
cmake -DBUILD_PLATFORM=$TARGET_OS \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=osx.toolchain.cmake \
-S . -B build/$TARGET_OS
cmake --build build/$TARGET_OS -j8
if [ "$1" == "install" ]; then
cmake --install build/$TARGET_OS
fi