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 (mop_convert, mop_font_bake) |
make shaders | Recompile Vulkan GLSL → SPIR-V → embedded C arrays (requires glslc) |
make fonts | Bake assets/fonts/JetBrainsMono-Regular.ttf → SDF atlas |
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.
Embedded HUD font
MOP's design language ships JetBrains Mono (OFL) as the canonical font for HUD chrome, navigator labels, gizmo axis tags, and selection callouts. The TTF isn't vendored — drop it in and bake:
# 1. Fetch the OFL TTF from upstream (github.com/JetBrains/JetBrainsMono).
cp JetBrainsMono-Regular.ttf assets/fonts/
# 2. Bake → build/fonts/jbm_regular.{mfa, mfa.c}
make fonts
# 3. Re-link libmop with the embedded font.
make MOP_ENABLE_VULKAN=1
After step 3, mop_font_hud() returns the embedded atlas with no
disk I/O. Without the TTF, mop_font_hud() returns NULL and host
code can fall back to mop_font_load("path/to/file.mfa"). See
Font for the .mfa format and the
mop_font_bake CLI.
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.