-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·69 lines (58 loc) · 2.48 KB
/
build.sh
File metadata and controls
executable file
·69 lines (58 loc) · 2.48 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
#!/bin/bash
set -e
BUILD_TYPE="Debug"
RUN="run"
PROG_ARG="$3"
if [[ "$1" == "Release" ]]; then
BUILD_TYPE="Release"
fi
if [[ "$2" == "norun" ]]; then
RUN="norun"
fi
BUILD_DIR="./build/$BUILD_TYPE"
DEBUG_ARG=""
if [[ "$BUILD_TYPE" == "Debug" ]]; then
DEBUG_ARG="-d"
fi
cppfront -cwd ./src/generated ../cpp2/transformation.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/color.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/stone.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/move.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/goban.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/engine.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/io.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/cli.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/player.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/human.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/dumb.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/random.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/ai.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/itself.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/game.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/interface.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/cli_interface.h2 -pure-cpp2 $DebugArg |
cppfront -cwd ./src/generated ../cpp2/gui_interface.h2 -import-std $DebugArg |
cppfront -cwd ./src/generated ../cpp2/main.cpp2 -import-std $DebugArg
# Move files used for debugging to the build folder.
if [[ "$BUILD_TYPE" == "Debug" ]]; then
mkdir -p "$BUILD_DIR/src"
mkdir -p "$BUILD_DIR/src/cpp2"
cp -f ./src/*.h2 "$BUILD_DIR/src/"
cp -f ./src/*.cpp2 "$BUILD_DIR/src/"
mv -f ./src/cpp2/*.h2-* "$BUILD_DIR/src/cpp2/" 2>/dev/null || true
mv -f ./src/cpp2/*.cpp2-* "$BUILD_DIR/src/cpp2/" 2>/dev/null || true
fi
mkdir -p "$BUILD_DIR/bin/images"
cp -f ./resources/images/* "$BUILD_DIR/bin/images"
ln -sfn "$(realpath --relative-to="$BUILD_DIR/bin" ./snn_models)" "$BUILD_DIR/bin/snn_models"
cmake -S . -B $BUILD_DIR -G"Unix Makefiles" \
-DCMAKE_CXX_COMPILER=g++-14 \
-DCMAKE_C_COMPILER=gcc-14 \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
make -C $BUILD_DIR
mv -f "$BUILD_DIR/gopp2" "$BUILD_DIR/bin/" 2>/dev/null || true
if [[ "$RUN" != "norun" ]]; then
cd "$BUILD_DIR/bin"
./gopp2 "$PROG_ARG"
cd ../../..
fi