-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
52 lines (43 loc) · 1.38 KB
/
Copy pathbuild.sh
File metadata and controls
52 lines (43 loc) · 1.38 KB
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
#!/usr/bin/env bash
# ============================================================
# poop3D Compiler — Build Script (Linux / macOS)
# ============================================================
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="$SCRIPT_DIR/build"
BIN_DIR="$BUILD_DIR/bin"
echo ""
echo "=========================================="
echo " poop3D Compiler — Build"
echo "=========================================="
# Check deps are downloaded
if [ ! -f "$SCRIPT_DIR/src/imgui/imgui.h" ]; then
echo "ERROR: Dependencies missing. Run ./setup.sh first!"
exit 1
fi
if [ ! -f "$SCRIPT_DIR/src/glad/glad.c" ]; then
echo "ERROR: GLAD missing. Run ./setup.sh first!"
exit 1
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Detect build type
BUILD_TYPE="${1:-Release}"
echo "Build type: $BUILD_TYPE"
# CMake configure
cmake "$SCRIPT_DIR" \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
# Build (use all cores)
CORES=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
echo "Building with $CORES cores..."
cmake --build . --config "$BUILD_TYPE" -- -j"$CORES"
echo ""
echo "=========================================="
echo " Build SUCCESS!"
echo " Binary: $BIN_DIR/poop3D"
echo ""
echo " Run with: $BIN_DIR/poop3D"
echo " or simply: ./run.sh"
echo "=========================================="