-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
36 lines (28 loc) · 783 Bytes
/
build.sh
File metadata and controls
36 lines (28 loc) · 783 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
#!/bin/bash
set -e
CONFIG="${1:-Release}"
echo "========================================"
echo "Building Convoy - $CONFIG"
echo "========================================"
if [ ! -d "build" ]; then
echo "[CREATE] Creating build directory..."
mkdir -p build
fi
cd build
if command -v nproc &> /dev/null; then
CORES=$(nproc)
elif command -v sysctl &> /dev/null; then
CORES=$(sysctl -n hw.ncpu)
else
CORES=4
fi
echo "[CONFIGURE] Running CMake..."
cmake .. -DCMAKE_BUILD_TYPE="$CONFIG"
echo "[BUILD] Compiling ($CORES cores)..."
cmake --build . --config "$CONFIG" --parallel "$CORES"
echo ""
echo "========================================"
echo "[SUCCESS] Build complete!"
echo "========================================"
echo ""
echo "Executable: build/Convoy"