Building Retrodev from Source

March 21, 2026 · View on GitHub

Retrodev uses Kombine as its build system. Kombine is a C#-scripted build tool: build logic is written in .csx files (C# scripts) and executed by the mkb command-line runner (mkb stands for make kombine). There is no CMake or MSBuild involved in the compilation — only the Kombine scripts.

Prerequisites

ToolNotes
Kombine (mkb)The build runner. A single self-contained executable — no .NET runtime, no Python, no additional dependencies. Install so that mkb is on PATH.
ClangUsed as the compiler and linker for all source. Must be on PATH.
GitRequired to fetch and update external dependencies. Must be on PATH.
Visual Studio or Microsoft Build ToolsClang on Windows links against the MSVC CRT and Windows SDK. These are not bundled with Clang — they must be installed separately. See Windows CRT requirements below.

Retrodev currently builds on Windows only. Kombine itself runs on Windows, macOS and Linux, and both the build scripts and the application code are structured to support other platforms — but the port is not yet complete.

Windows CRT requirements

Clang on Windows does not ship its own C runtime or Windows SDK headers. It expects to find them in the standard locations that Visual Studio or the Microsoft Build Tools install them to. Without these components the linker will fail to resolve CRT symbols (__CrtDbgReport, _wassert, etc.) and the Windows API headers will be missing.

You can satisfy this requirement in one of two ways:

Option A — Visual Studio (recommended if you already have it)

Install Visual Studio and, in the installer's Workloads tab, select Desktop development with C++. This pulls in the MSVC compiler toolchain, the CRT, and the Windows SDK in one step. Clang will locate them automatically via the registry entries that the VS installer writes. See the Visual Studio documentation for a step-by-step walkthrough.

Option B — Microsoft Build Tools (minimal install, no IDE)

Install the Build Tools for Visual Studio (a standalone, IDE-free package). In the installer select the Desktop development with C++ workload. At minimum the following individual components are required:

  • MSVC v143 (or later) — VS C++ x64/x86 build tools — provides the CRT import libraries and headers.
  • Windows 11 SDK (10.0.22621 or later) — provides windows.h and the Win32 API link libraries.

The SDK version does not need to match Windows 11 exactly; any recent SDK (10.0.19041 or newer) is sufficient. Clang discovers the installation through the registry; no manual PATH or LIB configuration is needed.

Note: the Visual Studio Developer Command Prompt / PowerShell sets additional environment variables (INCLUDE, LIB, LIBPATH) that are not required by Kombine's Clang invocations — Kombine passes all necessary paths explicitly. A normal shell with mkb and clang on PATH is sufficient.

Cloning

git clone https://github.com/tlotb/retrodev.git
cd retrodev

First build

After cloning, fetch and build all external dependencies first, then build the application:

mkb dependencies install
mkb build debug deps

dependencies install clones every dependency repository at the pinned tag. build debug deps compiles the dependencies from source and then compiles the application in debug mode. On subsequent builds you can omit deps to skip recompiling the dependencies — Kombine will register their already-built artifacts instead:

mkb build debug

Build verbs

All verbs are invoked via the mkb command-line tool:

mkb <verb> [parameters]

The entry-point script is kombine.csx at the repository root. It delegates to per-library and per-module sub-scripts automatically.

build

Compiles the application. Processes all declared dependencies first (either building or registering them), then builds the two main modules (retro.dev.lib and retro.dev.gui) and syncs the sdk/ folder into the binary output directory.

mkb build
mkb build release
mkb build release deps
mkb build verbose

Parameters:

ParameterDescription
debugDebug build with full debug info and no optimisation (default).
releaseRelease build with -O2, static runtime, and version header stamping.
depsAlso build the external dependency libraries (SDL3, ImGui, AngelScript, RASM, …). Omit to register pre-built deps.
verbosePrint the full Clang invocation for every compiled file.
productionRemove developer settings and debug information from the output.

For release builds the version header (src/lib/system/version.h) is stamped with a generated build number, the build runs, and the header is restored afterwards regardless of success or failure. The full version string is also written to out/pkg/version.txt.

Output paths are structured as:

out/bin/<os>/<debug|release>/retro.dev.gui/   ← executable and sdk/
out/lib/<os>/<debug|release>/                 ← static libraries
out/tmp/<os>/<debug|release>/                 ← object files, compile_commands.json

dependencies

Manages the external dependency libraries. Run this before the first build or after changing dependency versions. All dependencies are cloned from Git — Git must be on PATH.

mkb dependencies update
mkb dependencies install
mkb dependencies clean

Parameters:

ParameterDescription
updateUpdate the dependency sources (git pull / re-fetch).
installInstall / prepare the dependency sources.
cleanRemove dependency build artifacts.

Build vs register: when the deps parameter is passed to mkb build, Kombine compiles every dependency library from source. When deps is omitted, Kombine instead registers the dependencies — it pushes their paths and library names onto the internal share stack so the linker can find them, but does not recompile anything. Use deps only when the dependency sources have changed; omit it for all normal incremental application builds.

Dependency sources:

LibraryRepositoryTag / Branch
SDL3https://github.com/libsdl-org/SDL.gitrelease-3.4.x
SDL3_imagehttps://github.com/libsdl-org/SDL_image.gitrelease-3.4.x
Dear ImGuihttps://github.com/ocornut/imgui.gitv1.92.6
AngelScripthttps://github.com/anjo76/angelscript.gitv2.38.0
RASMhttps://github.com/EdouardBERGE/rasm.gitv3.0.8
Glazehttps://github.com/stephenberry/glazev2.9.5
CTREhttps://github.com/hanickadot/compile-time-regular-expressions.gitv3.10.0
FreeTypehttps://github.com/freetype/freetype.gitmaster

clean

Removes build artifacts for the selected configuration.

mkb clean
mkb clean release
mkb clean deps

Parameters:

ParameterDescription
debugClean debug artifacts (default).
releaseClean release artifacts.
depsAlso clean dependency artifacts. The application is always cleaned.

format

Applies clang-format (using the .clang-format file at the repository root) to all .h, .cpp and .c files under src/ and the extended ImGui and RASM sources under ext/.

mkb format

help

Prints a summary of all verbs and their parameters.

mkb help

Visual Studio solution

The repository includes retro.dev.sln, a Visual Studio solution with three projects grouped under build.projects:

ProjectTypePurpose
retro.devShared items (.vcxitems)Contains all source files. Shared into the other projects so IntelliSense and the editor work across the full codebase.
retro.dev.guiMakefile projectBuilds the application by invoking mkb build. The Visual Studio debugger attaches to the resulting process, so you can build and debug without leaving the IDE.
debug.buildMakefile projectDebugs the Kombine build scripts themselves. Launches mkb under the Visual Studio debugger so you can step through .csx build logic.

Opening retro.dev.sln in Visual Studio is the recommended way to work on the source — the actual compilation is still driven by Kombine, but you get full IDE editing, IntelliSense and debugger support.

Compiler flags summary

All modules share a common set of compiler flags defined in the buildCompilerFlags() function in kombine.csx:

  • C standard: C17 (-std=c17)
  • C++ standard: C++20 (-std=c++20, -pedantic, -Wall, -Wextra)
  • Exceptions: disabled (-fno-exceptions)
  • Debug: -g -glldb -gfull -O0, static debug runtime
  • Release: -O2, static release runtime, NDEBUG defined

A compile_commands.json database is written to out/tmp/<os>/<config>/compile_commands.json for IDE and tooling integration.