Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Build Guide

The build uses CMake presets. A preset names the platform, the configuration and, when the name contains -prof, profiling. A preset that contains external configures into ../voxelius-build/<preset>/ instead, so the build files stay out of the checkout.

The presets use schema version 6, so the build needs CMake 3.25 or newer. The Requirements page lists the compilers and the other tools.

Presets

PresetPlatformConfiguration
generic-debugAny POSIX hostDebug
generic-releaseAny POSIX hostRelease
windows-x32-debugWindows x86Debug
windows-x32-releaseWindows x86Release
windows-x64-debugWindows x64Debug
windows-x64-releaseWindows x64Release

Each of these presets has a -prof variant, for example generic-release-prof or windows-x64-debug-prof.

Windows x64 also has four -external presets: windows-x64-debug-external, windows-x64-release-external, windows-x64-debug-prof-external and windows-x64-release-prof-external. They build the same targets and place the build tree beside the checkout instead of inside it.

A preset exists only on its platform. Run cmake --list-presets to see the presets that the current host can use.

Building

Configure first, then build. Both commands take the same preset name:

cmake --preset windows-x64-debug
cmake --build --preset windows-x64-debug

Add --parallel to the build command to use every core: cmake --build --preset windows-x64-debug --parallel.

The executables land in build/<preset>/, or in ../voxelius-build/<preset>/ for an -external preset. The Windows presets use a multi-configuration generator, so the configuration comes first: build/windows-x64-debug/Debug/vclient.exe.

NOTE: CMake picks the generator. On Windows it is Visual Studio, on a POSIX host it is usually Ninja or GNU make. The Visual Studio generator writes no compile_commands.json. The Editor Setup page explains what clangd needs.

The scripts

The build scripts in scripts/ wrap one preset each. They configure and then build, from the repository root:

TargetCommand
Windows x64, debugscripts/build-windows-x64-debug.bat
Windows x64, releasescripts/build-windows-x64-release.bat
Windows x86, debugscripts/build-windows-x32-debug.bat
Windows x86, releasescripts/build-windows-x32-release.bat
Any POSIX host, debugscripts/build-generic-debug.sh
Any POSIX host, releasescripts/build-generic-release.sh

Each target also has a -prof script, for example scripts/build-windows-x64-debug-prof.bat or scripts/build-generic-release-prof.sh.

Packaging

A release preset also has package presets. They build the ZIP and, on Windows, the NSIS installer, and drop the result in dist/:

Package presetOutput
generic-releaseZIP for a POSIX host
windows-x32-release-zipZIP for Windows x86
windows-x32-release-nsisInstaller for Windows x86
windows-x64-release-zipZIP for Windows x64
windows-x64-release-nsisInstaller for Windows x64
cmake --build --preset windows-x64-release
cpack --preset windows-x64-release-zip

The pack-* scripts in scripts/ do both steps. They only exist for the presets that ship.

Profiling

A -prof preset defines TRACY_ENABLE, TRACY_ON_DEMAND and TRACY_NO_FRAME_IMAGE. The game then records the profiling zones and waits for the Tracy profiler to connect. A normal preset defines none of these macros, so the zones cost nothing in a build that ships.

Do not ship a -prof build.

Without a preset

A preset covers the usual targets. For another generator or another configuration, configure by hand and keep the build directory under build/:

cmake -S . -B build/my-build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build/my-build --parallel

The Ninja and GNU make generators write build/my-build/compile_commands.json. The Editor Setup page explains how clangd finds it.