-
Notifications
You must be signed in to change notification settings - Fork 21
/
bootstrap.sh
executable file
·47 lines (39 loc) · 1 KB
/
bootstrap.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
#!/bin/bash -eu
USAGE="Usage: $0 [options]
Bootstraps the riesling build system (specifies the toolchain for CMake)
Options:
-f FILE : Use a set of flags for dependency compilation. Currently provided
options are avx2, abi (for pre-C++11 ABI), and native
"
git submodule update --init --recursive
FLAGS="base"
PAR=""
PREFIX=""
while getopts "f:hi:j:" opt; do
case $opt in
f) FLAGS="$OPTARG";;
i) PREFIX="-DCMAKE_INSTALL_PREFIX=$OPTARG -DCMAKE_PREFIX_PATH=$OPTARG";;
j) export VCPKG_MAX_CONCURRENCY=$OPTARG
PAR="-j $OPTARG";;
h) echo "$USAGE"
return;;
esac
done
shift $((OPTIND - 1))
# Use Ninja if available, otherwise CMake default
if [ -x "$( command -v ninja )" ]; then
GEN="-GNinja"
else
GEN=""
fi
mkdir -p build
cd build
cmake -S ../ $GEN \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="cmake/toolchain.cmake" \
-DFLAGS_FILE="${FLAGS}" \
$PREFIX
cmake --build . $PAR
if [ -n "$PREFIX" ]; then
cmake --install .
fi