-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildnative.sh
executable file
·58 lines (46 loc) · 1.58 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
54
55
56
57
58
#!/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
# cd ./.vcpkg/vcpkg
# git reset --hard e52999ee1a61bfea654733712288c5d4469d38bc
# cd ../..
PACKAGE=ceres[suitesparse,lapack,cxsparse,eigensparse]
if [ "$OS" = "Darwin" ];
then
PACKAGE=ceres
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/aardvark-community/CeresSharp
./.vcpkg/vcpkg/vcpkg install gflags $PACKAGE --triplet $VCPKG_TRIPLET --binarysource='clear;nuget,GitHub,readwrite;nugettimeout,1000'
rm -dfr src/CeresNative/build
cmake -S src/CeresNative/ -B src/CeresNative/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/CeresNative/build --config Release --target install