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 unit tests |
make torture | Run only the adversarial / long-running subset |
make conformance | Build the conformance runner |
make conformance-run | Build + run the render-health conformance check |
make docs-check | Validate docs slugs / links + compile-test every c main block |
make ci-linux | Reproduce a Linux CI job locally via docker (see Testing → CI) |
make tools | Build CLI tools (e.g. mop_convert) |
make shaders | Recompile Vulkan GLSL → SPIR-V → embedded C arrays (requires glslc) |
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/) |
make MOP_ENABLE_VULKAN=1 # Build with Vulkan
make MOP_ENABLE_VULKAN=1 test # Tests auto-adapt when Vulkan is enabled
Vulkan-gated tests compile on CPU-only builds too — they fall through to a printf + return 0 stub when MOP_HAS_VULKAN is undefined. See Testing for details.
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): -Og -g — preserves debuggability without -O0's catastrophic slowdown on math-heavy paths (GGX, inverse, ...).
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 run .#showcase # 60 frames → /tmp/mop-showcase-out/
nix run .#interactive # Live SDL2 window, Vulkan, HDRI skybox
# Or manually:
nix develop # SDL2 + pkg-config + Vulkan loader
make MOP_ENABLE_VULKAN=1 interactive
./build/examples/interactive --vulkan --hdri path/to/env.exr
See examples/Makefile for all targets.