-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildnative.sh
executable file
·53 lines (41 loc) · 1.41 KB
/
buildnative.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`
VCPKG_TRIPLET=""
ARCH=""
ARCH_FLAGS=""
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a"; pwd)
mono .config/nuget.exe setApiKey -Source GitHub $GITHUB_TOKEN -NonInteractive
rm -dfr .vcpkg
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"
fi
fi
ARCH_FLAGS="-DCMAKE_OSX_ARCHITECTURES=$ARCH"
else
echo "Linux"
VCPKG_TRIPLET="x64-linux-release"
fi
./.vcpkg/vcpkg/bootstrap-vcpkg.sh
export VCPKG_NUGET_REPOSITORY=https://github.com/krauthaufen/FlannSharp
./.vcpkg/vcpkg/vcpkg install flann --triplet $VCPKG_TRIPLET --binarysource='clear;nuget,GitHub,readwrite;nugettimeout,1000'
rm -dfr src/FlannNative/build
cmake -S src/FlannNative/ -B src/FlannNative/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/FlannNative/build --config Release --target install