-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·58 lines (48 loc) · 1.21 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·58 lines (48 loc) · 1.21 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
53
54
55
56
57
58
#!/bin/bash
echo "======================================"
echo " Building fungi-demo Windows Executable "
echo "======================================"
DIST_DIR="dist"
EXE_NAME="game.exe"
ASSET_DIR="assets"
# Stop immediately if any command fails
set -e
# Clean old build
echo "Cleaning old build..."
rm -rf "$DIST_DIR"
mkdir -p "$DIST_DIR"
echo "Compiling..."
# Collect all source files recursively
SRC=$(find . -name "*.cpp" \
-not -path "./.emsdk/*" \
-not -path "./glfw/*" \
-not -path "./dist/*" \
-not -path "./dist_web/*" | tr '\n' ' ')
# Compile with MinGW-w64
x86_64-w64-mingw32-g++ $SRC \
-I. \
-Iglfw/include \
-Lglfw/build/src \
-lglfw3 \
-lopengl32 \
-lws2_32 \
-lgdi32 \
-luser32 \
-lkernel32 \
-std=c++17 \
-O2 \
-static \
-o "$DIST_DIR/$EXE_NAME"
echo "Compilation successful."
# Copy assets safely
if [ -d "$ASSET_DIR" ]; then
echo "Copying assets..."
mkdir -p "$DIST_DIR/$ASSET_DIR"
cp -r "$ASSET_DIR/"* "$DIST_DIR/$ASSET_DIR/"
else
echo "WARNING: No assets folder found!"
fi
echo "======================================"
echo "Build complete"
echo "Run make run to run executable"
echo "======================================"