This repository has no description
1odin_root := `odin root`
2project := "thanatograph"
3game_pkg := "src/game"
4sim_pkg := "src/sim"
5hot_loader_pkg := "src/lib/hot_reload"
6release_pkg := "src/lib/release"
7headless_pkg := "src/lib/headless"
8hot_dir := "build/hot_reload"
9release_dir := "build/release"
10headless_dir := "build/headless"
11dll_ext := if os() == "windows" { ".dll" } else if os() == "macos" { ".dylib" } else { ".so" }
12exe_ext := if os() == "windows" { ".exe" } else { ".bin" }
13hot_exe := project + "_hot_reload" + exe_ext
14release_exe := release_dir + "/" + project + exe_ext
15headless_exe := headless_dir + "/" + project + "_headless" + exe_ext
16raylib_dir := if os() == "macos" { odin_root + "/vendor/raylib/macos" } else if os() == "linux" { odin_root + "/vendor/raylib/linux" } else { odin_root + "/vendor/raylib/windows" }
17linker_flags := if os() == "windows" { "" } else { "-Wl,-rpath " + raylib_dir }
18
19# List available recipes
20default:
21 @just --list
22
23# Check all template packages
24check: test-sim
25 odin check {{ sim_pkg }} -strict-style -vet -no-entry-point
26 odin check {{ game_pkg }} -strict-style -vet -no-entry-point
27 odin check {{ hot_loader_pkg }} -strict-style -vet
28 odin check {{ release_pkg }} -strict-style -vet
29 odin check {{ headless_pkg }} -strict-style -vet
30
31# Run deterministic simulation tests without Raylib
32test-sim:
33 odin test {{ sim_pkg }} -strict-style -vet
34
35# Build the game shared library used by the hot reload loader
36build-game:
37 @mkdir -p {{ hot_dir }}
38 odin build {{ game_pkg }} \
39 -extra-linker-flags:"{{ linker_flags }}" \
40 -define:RAYLIB_SHARED=true \
41 -build-mode:dll \
42 -out:{{ hot_dir }}/game_tmp{{ dll_ext }} \
43 -strict-style -vet -debug
44 @mv {{ hot_dir }}/game_tmp{{ dll_ext }} {{ hot_dir }}/game{{ dll_ext }}
45
46# Alias for the hot-reload game library build
47build: build-game
48
49# Build the hot reload loader executable
50build-loader:
51 odin build {{ hot_loader_pkg }} -out:{{ hot_exe }} -strict-style -vet -debug
52
53# Build the headless simulation harness
54build-headless:
55 @mkdir -p {{ headless_dir }}
56 odin build {{ headless_pkg }} -out:{{ headless_exe }} -strict-style -vet -debug
57
58# Run a deterministic simulation fixture without Raylib
59headless fixture="fixtures/headless/basic_run.txt": build-headless
60 ./{{ headless_exe }} {{ fixture }}
61
62# Build and run the hot reload template
63run: build-game build-loader
64 ./{{ hot_exe }}
65
66# Rebuild the shared game library for a running loader
67reload: build-game
68 @printf "Hot reloaded.\n"
69
70# Launch the loader and rebuild the game library on source changes. Requires watchexec or fswatch.
71dev: build-game build-loader
72 @if command -v watchexec >/dev/null 2>&1; then \
73 ./{{ hot_exe }} & \
74 watchexec -w {{ game_pkg }} -w {{ sim_pkg }} -e odin -- just reload; \
75 elif command -v fswatch >/dev/null 2>&1; then \
76 ./{{ hot_exe }} & \
77 fswatch -o {{ game_pkg }} {{ sim_pkg }} | while read -r _event; do just reload; done; \
78 else \
79 printf "watchexec or fswatch is required for 'just dev'. Install one or use 'just run' + 'just reload'.\n"; \
80 exit 1; \
81 fi
82
83# Optimized release build without hot reload
84release:
85 @mkdir -p {{ release_dir }}
86 odin build {{ release_pkg }} \
87 -out:{{ release_exe }} \
88 -strict-style -vet -no-bounds-check -o:speed
89
90# Clean build artifacts
91clean:
92 rm -rf build/ {{ hot_exe }} {{ hot_exe }}.dSYM