o
odinpkg.dev
packages / library / spear

spear

b0e3905library

little build system for odin

BSD-3-Clause · updated 2 months ago

Spear

Spear is a simple (and kinda boring) build system for Odin. I made it mostly out of boredom, but it can still be useful if you want something minimal.


Build Spear

chmod +x build.sh
./build.sh

Usage

spear init   # creates a Spear.toml in the current directory
spear run    # builds and runs the default target
spear build  # builds the project

Concepts (quick overview)

  • collections Groups of libraries. Shared across all targets.

  • target A buildable unit (like a project). There is a default target, but you can define others (e.g. test, examples).

  • compiler Configuration for the Odin compiler (path, flags, etc).


Example Spear.toml for another of my projects (multiple targets)

This example shows a slightly more complete setup, with custom compiler options, multiple collections, and more than one target.

[package]
name = "game"
version = "0.1.0"
author = "okkami"

[project]
output_dir = "bin"
default_target = "game"

[compiler]
path = "odin"
vet = false
strict = false
opt = "none"

[collections]
extra = "extra"
oge = "extra/oge" # very large engine

[target.game]
path = "game"
kind = "exe"

[target.test]
path = "test"
kind = "exe"

Notes

  • default_target = "game" means spear run will run the main game.
  • You can still build other targets manually (like test).
  • collections lets you organize libraries like oge under extra/oge.
  • Compiler options (vet, strict, opt) are optional and just passed to Odin.