-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
39 lines (31 loc) · 854 Bytes
/
build.sh
File metadata and controls
39 lines (31 loc) · 854 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
git pull
BUILD_DIR="${BUILD_DIR:-build}"
JOBS="${JOBS:-$(nproc)}"
# CMake configure options (add more -D... here if needed)
CMAKE_ARGS=(
"-DUSE_TLS=ON"
"-DUSE_OPEN_SSL=1"
)
RECONFIGURE=0
for arg in "$@"; do
case "$arg" in
--reconfigure) RECONFIGURE=1 ;;
--debug) CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Debug") ;;
--release) CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release") ;;
*) ;;
esac
done
# Remove old build dir
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
if [[ ! -f "$BUILD_DIR/CMakeCache.txt" || "$RECONFIGURE" -eq 1 ]]; then
echo "[build] Configuring in '$BUILD_DIR'..."
cmake -S . -B "$BUILD_DIR" "${CMAKE_ARGS[@]}"
else
echo "[build] Already configured (CMakeCache.txt exists)."
fi
echo "[build] Building with $JOBS jobs..."
cmake --build "$BUILD_DIR" -j "$JOBS"
echo "[build] Done."