Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
spellcraft justfile
2.6 kB · 73 lines
Just
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374odin_root := `odin root`project := "template"game_pkg := "src/game"hot_loader_pkg := "src/lib/hot_reload"release_pkg := "src/lib/release"hot_dir := "build/hot_reload"release_dir := "build/release"dll_ext := if os() == "windows" { ".dll" } else { if os() == "macos" { ".dylib" } else { ".so" } }exe_ext := if os() == "windows" { ".exe" } else { ".bin" }hot_exe := project + "_hot_reload" + exe_extrelease_exe := release_dir + "/" + project + exe_extraylib_dir := if os() == "macos" { odin_root + "/vendor/raylib/macos" } else { if os() == "linux" { odin_root + "/vendor/raylib/linux" } else { odin_root + "/vendor/raylib/windows" } }linker_flags := if os() == "windows" { "" } else { "-Wl,-rpath " + raylib_dir }# List available recipesdefault: @just --list# Check all template packagescheck: odin check {{game_pkg}} -strict-style -vet -no-entry-point odin check {{hot_loader_pkg}} -strict-style -vet odin check {{release_pkg}} -strict-style -vet# Build the game shared library used by the hot reload loaderbuild-game: @mkdir -p {{hot_dir}} odin build {{game_pkg}} \ -extra-linker-flags:"{{linker_flags}}" \ -define:RAYLIB_SHARED=true \ -build-mode:dll \ -out:{{hot_dir}}/game_tmp{{dll_ext}} \ -strict-style -vet -debug @mv {{hot_dir}}/game_tmp{{dll_ext}} {{hot_dir}}/game{{dll_ext}}# Alias for the hot-reload game library buildbuild: build-game# Build the hot reload loader executablebuild-loader: odin build {{hot_loader_pkg}} -out:{{hot_exe}} -strict-style -vet -debug# Build and run the hot reload templaterun: build-game build-loader ./{{hot_exe}}# Rebuild the shared game library for a running loaderreload: build-game @printf "Hot reloaded.\n"# Launch the loader and rebuild the game library on source changes. Requires watchexec or fswatch.dev: build-game build-loader @if command -v watchexec >/dev/null 2>&1; then \ ./{{hot_exe}} & \ watchexec -w {{game_pkg}} -e odin -- just reload; \ elif command -v fswatch >/dev/null 2>&1; then \ ./{{hot_exe}} & \ fswatch -o {{game_pkg}} | while read -r _event; do just reload; done; \ else \ printf "watchexec or fswatch is required for 'just dev'. Install one or use 'just run' + 'just reload'.\n"; \ exit 1; \ fi# Optimized release build without hot reloadrelease: @mkdir -p {{release_dir}} odin build {{release_pkg}} \ -out:{{release_exe}} \ -strict-style -vet -no-bounds-check -o:speed# Clean build artifactsclean: rm -rf build/ {{hot_exe}} {{hot_exe}}.dSYM