Skip to content

Commit e4dfc7c

Browse files
committed
Update bootstrap
1 parent a952ee5 commit e4dfc7c

File tree

1 file changed

+41
-15
lines changed

1 file changed

+41
-15
lines changed

bootstrap.sh

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1-
#!/bin/bash -eu
1+
#!/bin/bash -e
22

33
USAGE="Usage: $0 [options]
44
5-
Bootstraps the riesling build system (specifies the toolchain for CMake)
5+
Bootstraps the build
66
77
Options:
8-
-f FILE : Use a set of flags for dependency compilation. Currently provided
9-
options are avx2, abi (for pre-C++11 ABI), and native
8+
-i DIR Install riesling to this directory, e.g. $HOME/.local
9+
-j N Restrict parallel build to this many threads
10+
-h Print this message
11+
-w Add warnings
1012
"
11-
12-
git submodule update --init --recursive
13-
14-
FLAGS="base"
15-
while getopts "f:h" opt; do
13+
PAR=""
14+
PREFIX=""
15+
ALL=""
16+
DEBUG=""
17+
RELDBG="-O2 -g -DNDEBUG"
18+
while getopts "hi:j:w" opt; do
1619
case $opt in
17-
f) export FLAGS="$OPTARG";;
20+
i) PREFIX="-DCMAKE_INSTALL_PREFIX=$OPTARG";;
21+
j) export VCPKG_MAX_CONCURRENCY=$OPTARG
22+
PAR="-j $OPTARG";;
1823
h) echo "$USAGE"
1924
return;;
25+
w) ALL="-Wall -Wshadow"
26+
DEBUG="-g -fsanitize=address,undefined"
27+
RELDBG="-O2 -g -DNDEBUG -fsanitize=address,undefined";;
2028
esac
2129
done
2230
shift $((OPTIND - 1))
@@ -28,10 +36,28 @@ else
2836
GEN=""
2937
fi
3038

39+
# If vcpkg is not installed, install it
40+
if [[ (-x "$( command -v vcpkg )") && (-n $VCPKG_ROOT) ]]; then
41+
echo "vcpkg installed"
42+
else
43+
git clone https://github.com/microsoft/vcpkg.git .vcpkg
44+
cd .vcpkg && ./bootstrap-vcpkg.sh && cd ..
45+
export VCPKG_ROOT="$PWD/.vcpkg"
46+
export PATH="$VCPKG_ROOT:$PATH"
47+
fi
48+
3149
mkdir -p build
32-
cd build
33-
cmake -S ../ $GEN \
50+
cmake -S . -B build $GEN \
51+
-DOX_INSTALL_DIRECTORY="${1}" \
3452
-DCMAKE_BUILD_TYPE=Release \
35-
-DCMAKE_TOOLCHAIN_FILE="cmake/toolchain.cmake" \
36-
-DFLAGS_FILE="${FLAGS}"
37-
cmake --build .
53+
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
54+
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -fsanitize=address,undefined" \
55+
-DVCPKG_INSTALL_OPTIONS="--no-print-usage" \
56+
-DCMAKE_CXX_FLAGS="$ALL" -DCMAKE_CXX_FLAGS_DEBUG="$DEBUG" -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$RELDBG"\
57+
"$PREFIX"
58+
59+
cmake --build build $PAR
60+
61+
if [ -n "$PREFIX" ]; then
62+
cmake --install build
63+
fi

0 commit comments

Comments
 (0)