-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·90 lines (77 loc) · 2.13 KB
/
build.sh
File metadata and controls
executable file
·90 lines (77 loc) · 2.13 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# build.sh
# Clone dependencies
mkdir -p thirdparty
cd thirdparty
git clone https://github.com/chriskohlhoff/asio.git
if [ ! -d "asio/asio/include" ]; then
echo "ASIO directory structure incorrect, checking..."
if [ -f "asio/asio.hpp" ]; then
echo "Found ASIO headers at root"
else
echo "Warning: ASIO structure may be unexpected"
fi
fi
git clone https://github.com/nlohmann/json.git
git clone https://github.com/gabime/spdlog.git
git clone https://github.com/g-truc/glm.git
cd ..
# Install system dependencies
#sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
libpq-dev \
python3-dev \
libssl-dev \
zlib1g-dev \
postgresql-15 \
libglm-dev \
libasio-dev \
libspdlog-dev \
nlohmann-json3-dev
# Parse command line arguments for optional database backends
USE_CITUS=OFF
USE_SQLITE=OFF
for arg in "$@"; do
case $arg in
--with-citus)
echo "Installing Citus extension..."
sudo apt-get install -y postgresql-15-citus-12
USE_CITUS=ON
;;
--with-sqlite)
echo "Installing SQLite3 development libraries..."
sudo apt-get install -y libsqlite3-dev
USE_SQLITE=ON
;;
*)
# ignore unknown
;;
esac
done
# Build configuration
echo "Building with Citus: $USE_CITUS, SQLite: $USE_SQLITE"
# Clean previous build artifacts
rm -f CMakeCache.txt Makefile cmake_install.cmake
rm -rf CMakeFiles
# Create build directory and copy config
mkdir -p build
rsync -a --delete config/ build/config/
cd build
# Run CMake
cmake .. -B . \
-DUSE_CITUS=${USE_CITUS} \
-DUSE_SQLITE=${USE_SQLITE} \
-DCMAKE_BUILD_TYPE=Debug
# Build
make -j$(nproc)
if [ -f "gameserver" ]; then
echo "Build successful! Executable: $(pwd)/gameserver"
else
echo "Build failed - no executable created"
echo "Check cmake output above for errors"
fi
# create default database user (commented out by default)
#sudo -u postgres psql -c "DROP USER IF EXISTS gameuser;"
#sudo -u postgres psql -c "CREATE USER gameuser WITH PASSWORD 'password' SUPERUSER;"