Build Tools
| Tool | Role |
|---|---|
| Make | Build orchestration |
| Nix | Reproducible toolchain and deps |
| cc | C11 compiler (clang or gcc) |
| ar | Static archive creation |
Nix is the canonical build method. Make is the build driver. No CMake, no autotools.
Quick Start
With Nix (recommended)
nix develop # Enter development shell
make # Build static library
With Nix Build
nix build # Build in a pure Nix sandbox
ls ./result/lib/ # libmop.a
Without Nix
If you have a C11 compiler and make installed:
make CC=clang # Or CC=gcc
Make Targets
| Target | Effect |
|---|---|
make | Build the static library (libmop.a) |
make lib | Same as make |
make test | Build and run all tests |
make clean | Remove build/ directory |
make install | Install to PREFIX (default /usr/local) |
Optional Features
| Flag | Effect |
|---|---|
MOP_ENABLE_VULKAN=1 | Compile Vulkan backend (src/backend/vulkan/) |
MOP_ENABLE_OPENGL=1 | Compile OpenGL backend (src/backend/opengl/) |
MOP_ENABLE_LUA=1 | Enable Lua configuration system (src/config/) |
make MOP_ENABLE_VULKAN=1 # Build with Vulkan
make test # Run tests (rebuild lib without Vulkan first)
Note: tests link against libmop.a without -lvulkan, so build the library without MOP_ENABLE_VULKAN=1 when running tests. The Vulkan backend is tested via the examples.
Build Outputs
build/
obj/ — Object files (mirrors src/ structure)
lib/
libmop.a — Static library
Compiler Flags
-std=c11 -Wall -Wextra -Wpedantic -Werror
-Wno-unused-parameter -Wno-missing-field-initializers
Debug mode (default): -O0 -g
Release mode: -O2 -DNDEBUG (set RELEASE=1)
Nix Flake Structure
The flake.nix provides:
packages.default— Nix derivation that builds the projectdevShells.default— Development shell with compiler, make, clang-tools
The core library has zero platform-specific dependencies beyond a C11 compiler.
Examples
Examples live in examples/ with their own Makefile and flake.nix.
cd examples && nix develop # SDL3 + pkg-config
make # Build all examples
make run # Run interactive viewport
make run-headless # Run headless PPM exporter
See examples/Makefile for all targets.