echo docs build.md
1.4 kB · 54 lines
Markdown
at main

Build Notes #

The template uses just recipes around Odin commands.

Development #

just run

This builds:

  • src/game as build/hot_reload/game.{dylib,so,dll} with -build-mode:dll
  • src/lib/hot_reload as template_hot_reload.{bin,exe}

Then it runs the loader.

To reload manually while the loader is running:

just reload

For automatic rebuilds, install watchexec or fswatch and run:

just dev

just run starts the hot-reload loader in the foreground; use just reload manually from another terminal after editing src/game or src/sim. just dev starts the loader in the background and keeps a file watcher running in the foreground to call just reload automatically when either package changes.

Release #

just release

This builds src/lib/release as an optimized executable in build/release/. Release builds link directly against src/game and do not use hot reload.

Platform conditionals #

Odin supports compile-time OS checks with when:

when ODIN_OS == .Windows {
	// Windows-only code
} else when ODIN_OS == .Darwin {
	// macOS-only code
} else when ODIN_OS == .Linux {
	// Linux-only code
}

For larger platform-specific implementations, prefer Odin's file suffix convention, such as file_windows.odin, file_darwin.odin, or file_linux.odin.