-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-all.sh
executable file
·80 lines (62 loc) · 1.7 KB
/
build-all.sh
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
#!/bin/sh
set -e
SCRIPT_ROOT=$(dirname "$(realpath "$0")")
ZIG_PATH=""
ZIG_VERSION=""
ODIN_PATH=""
ODIN_VERSION=""
echo "GDS 2024 Sample Code Repository"
echo ""
echo "[Zig] Building"
if ! command -v zig &> /dev/null; then
echo "[FATAL] zig is not installed!"
exit 1
else
ZIG_VERSION=$(zig version)
ZIG_PATH=$(which zig)
fi
echo "[Zig] Path: $ZIG_PATH"
echo "[Zig] Version: $ZIG_VERSION"
find "$SCRIPT_ROOT/src/zig" -type d | while read -r PROJECT; do
if [ -f "$PROJECT/build.zig" ]; then
echo " - Building at '$PROJECT'"
cd "$PROJECT"
if ! zig build -freference-trace; then
echo "[ERROR] Error building project: $PROJECT"
cd - > /dev/null
continue
fi
cd - > /dev/null
fi
done
echo "[Zig] Done"
echo ""
echo "[Odin] Building"
if ! command -v odin &> /dev/null; then
echo "[FATAL] odin is not installed!"
exit 1
else
ODIN_VERSION=$(odin version)
ODIN_PATH=$(which odin)
fi
echo "[Odin] Path: $ODIN_PATH"
echo "[Odin] Version: $ODIN_VERSION"
find "$SCRIPT_ROOT/src/odin" -type d | while read -r PROJECT; do
if [ -f "$PROJECT/main.odin" ]; then
echo " - Building at '$PROJECT'"
cd "$PROJECT"
FOLDER_BASE_NAME=$(basename $PROJECT)
OUT_FOLDER="$PROJECT/odin-out"
OUT_FILEPATH="$OUT_FOLDER/$FOLDER_BASE_NAME"
echo " - mkdir if not exists: $OUT_FOLDER"
mkdir -p "$OUT_FOLDER"
if ! odin build . -build-mode:exe -out:"$OUT_FILEPATH" -debug; then
echo "[ERROR] Error building project: $PROJECT"
cd - > /dev/null
continue
fi
cd - > /dev/null
fi
done
echo "[Odin] Done"
exit 0