Change build scripts to Odin via brokkr

This commit is contained in:
Riyyi
2026-09-28 20:50:59 +02:00
parent bf668d6177
commit 9ead998a3b
11 changed files with 661 additions and 331 deletions
+5 -52
View File
@@ -2,59 +2,12 @@
set -eu
PROJECT="sindri"
VERSION="dev-$(date -u '+%Y-%m-%d')-$(git rev-parse --short HEAD)"
cd -- "$(dirname -- "$0")"
OPTION="${1:-}"
shift
# ------------------------------------------
# Setup compiled wgpu binary
./scripts/wgpu-init.sh
# ------------------------------------------
# Game compile
mkdir -p build
# Game.dll
odin build game/ -show-timings \
-collection:sindri=src \
-collection:gram=vendor/gram/src \
-collection:wgpu=vendor \
-build-mode:dynamic \
-out:build/game_tmp -microarch:native -o:minimal -use-separate-modules -define:VERSION="$VERSION-debug" -debug "$@"
# Need to use a temp file on Linux/macOS because it first writes an empty file,
# which the engine will load before it is actually fully written.
[ "$(uname -s)" = "Darwin" ] && LIB_EXT="dylib" || LIB_EXT="so"
[ -f "build/game_tmp.$LIB_EXT" ] || {
echo "error: build produced no game lib.$LIB_EXT" >&2
exit 1
}
mv -f "build/game_tmp.$LIB_EXT" "build/game.$LIB_EXT"
# ------------------------------------------
# Engine compile
# If the executable is already running, then don't try to build and start it.
if pgrep -x $PROJECT >/dev/null; then
echo "Hot reloading..."
exit 0
if [ ! -x ./build ]; then
odin build compile/build.odin -file -out:build
fi
if [ "$OPTION" = "debug" ]; then
odin build src/ -show-timings \
-collection:sindri=src \
-collection:gram=vendor/gram/src \
-collection:wgpu=vendor \
-out:build/$PROJECT -microarch:native -o:minimal -use-separate-modules -define:VERSION="$VERSION-debug" -debug "$@"
exit 0
fi
./build "$@"
odin build src/ -show-timings \
-collection:sindri=src \
-collection:gram=vendor/gram/src \
-collection:wgpu=vendor \
-out:build/$PROJECT -microarch:native -o:speed -define:VERSION="$VERSION" "$@"
cd - > /dev/null