Build & Run

Quick Build

make clean && make run

This compiles shaders, builds the C++ shared library, builds the physics library, compiles all C# files, and launches the viewer.

Build Targets

CommandDescription
make runBuild everything and run the Vulkan viewer
make devBuild and run with hot reload (edit C# game logic live)
make viewerBuild shaders + C++ dylib + physics dylib + C# exe (no run)
make appBuild macOS .app bundle
make shadersCompile GLSL shaders to SPIR-V only
make cleanRemove all build artifacts (build/, compile_commands.json)
make helpShow available targets

make run

The primary development command. Builds all four stages (shaders, C++ renderer, physics library, C# executable) then launches:

DYLD_LIBRARY_PATH=build:/opt/homebrew/lib \
VK_ICD_FILENAMES=/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json \
    mono build/Viewer.exe
  • DYLD_LIBRARY_PATH — locates librenderer.dylib and libjoltc.dylib in build/, plus MoltenVK/GLFW in /opt/homebrew/lib
  • VK_ICD_FILENAMES — tells the Vulkan loader where to find the MoltenVK ICD (note: /etc/ not /share/ on Homebrew)

make dev

Splits C# into three assemblies for live code reloading:

AssemblyContentsReloadable?
Engine.dllWorld, Components, NativeBridgeNo
GameLogic.dllGame.cs, systems/*.csYes
ViewerDev.exeViewer + HotReloadNo

Save any file in game_logic/ and the engine auto-recompiles and reloads your game code without restarting. See Hot Reload for details.

make viewer

Builds everything without running. Useful for checking compilation without launching the window:

make viewer  # build only
make run     # build + run

make app

Creates a self-contained macOS .app bundle with all dylibs and the Mono runtime embedded:

make app
open build/Viewer.app

make shaders

Compiles only GLSL shaders to SPIR-V. Useful during shader development:

make shaders

Compiles these shaders:

SourceOutputPurpose
native/shaders/shader.vertbuild/shaders/vert.spv3D scene vertex shader
native/shaders/shader.fragbuild/shaders/frag.spv3D scene fragment shader
native/shaders/ui.vertbuild/shaders/ui_vert.spvUI overlay vertex shader
native/shaders/ui.fragbuild/shaders/ui_frag.spvUI overlay fragment shader
native/shaders/shadow.vertbuild/shaders/shadow_vert.spvShadow map vertex shader
native/shaders/shadow_point.vertbuild/shaders/shadow_point_vert.spvPoint shadow vertex shader
native/shaders/shadow_point.fragbuild/shaders/shadow_point_frag.spvPoint shadow fragment shader

make clean

Removes all build artifacts:

make clean  # removes build/ and compile_commands.json

Build Pipeline

The build has four stages that run in dependency order:

1. GLSL → SPIR-V        (glslc)
2. C++ → librenderer.dylib  (CMake + clang++)
3. Jolt → libjoltc.dylib    (CMake, first build fetches JoltPhysics ~1 min)
4. C# → Viewer.exe          (mcs)

Stage 3 only runs on first build or after make clean. Subsequent builds skip it if the physics library already exists.

What the Build Does

  1. Compiles shadersglslc compiles 7 GLSL files (scene, UI, shadow) to SPIR-V
  2. Builds C++ renderer — CMake compiles renderer code into build/librenderer.dylib
  3. Builds physics — CMake compiles joltc into build/libjoltc.dylib
  4. Compiles C#mcs compiles all .cs files into build/Viewer.exe
  5. Links at runtimemono Viewer.exe loads both .dylib files via P/Invoke