-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·42 lines (34 loc) · 876 Bytes
/
run.sh
File metadata and controls
executable file
·42 lines (34 loc) · 876 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
40
41
42
mkdir -p build
cd build
touch .gitkeep
cmake .. -DCMAKE_TOOLCHAIN_FILE=./cmake/define-compilers.cmake || { echo "CMake configuration failed"; exit 1; }
cmake --build . --parallel 8 || { echo "CMake build failed"; exit 1; }
if [[ "$(uname)" == "Darwin" ]]; then
echo "Running on macOS. Copying GEngine..."
mkdir -p ../build_includes/
cp -rf ../build/.vcpkg/installed/arm64-osx/include/ ../build_includes/
fi
echo "Running server..."
mkfifo pipe
./r-type_server > pipe &
SERVER_PID=$!
tee server_output.log < pipe &
TEE_PID=$!
cleanup() {
echo "\nCleaning up..."
kill $SERVER_PID 2>/dev/null
kill $TEE_PID 2>/dev/null
rm pipe
kill $CLIENT_PID 2>/dev/null
exit 0
}
# Trap CTRL + C (SIGINT)
trap cleanup SIGINT
sleep 1
echo "Running client..."
./r-type_client
kill $SERVER_PID 2>/dev/null
kill $TEE_PID 2>/dev/null
rm pipe
cd ..
exit 0