-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildnativelocal.sh
executable file
·53 lines (42 loc) · 1.4 KB
/
buildnativelocal.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
#!/bin/bash
OS=`uname -s | tail -1`
VCPKG_TRIPLET=""
ARCH=""
ARCH_FLAGS=""
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a"; pwd)
mkdir .vcpkg
git clone https://github.com/Microsoft/vcpkg.git ./.vcpkg/vcpkg --depth 1
if [ "$OS" = "Darwin" ];
then
echo "MacOS"
if [ "$1" = "x86_64" ]; then
VCPKG_TRIPLET="x64-osx-release"
ARCH="x86_64"
elif [ "$1" = "arm64" ]; then
VCPKG_TRIPLET="arm64-osx"
ARCH="arm64"
else
ARCH=`uname -m | tail -1`
if [ "$ARCH" = "x86_64" ]; then
VCPKG_TRIPLET="x64-osx-release"
elif [ "$ARCH" = "arm64" ]; then
VCPKG_TRIPLET="arm64-osx"
else
echo "bad arch $ARCH a"
fi
fi
ARCH_FLAGS="-DCMAKE_OSX_ARCHITECTURES=$ARCH"
else
echo "Linux"
sudo apt-get install -y gperf fontconfig libgles2-mesa-dev libgtk2.0-dev
VCPKG_TRIPLET="x64-linux-release"
fi
./.vcpkg/vcpkg/bootstrap-vcpkg.sh
export VCPKG_NUGET_REPOSITORY="https://github.com/aardvark-community/MiniCV"
./.vcpkg/vcpkg/vcpkg install opencv --triplet $VCPKG_TRIPLET
rm -dfr src/MiniCVNative/build
cmake -S src/MiniCVNative/ -B src/MiniCVNative/build $ARCH_FLAGS \
-DCMAKE_TOOLCHAIN_FILE="$BASEDIR/.vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=$VCPKG_TRIPLET \
-DCMAKE_BUILD_TYPE=Release
cmake --build src/MiniCVNative/build --config Release --target install