Building and Configuration
This chapter explains the CMake build from the root CMakeLists.txt down: how the three configurations
are created, what the conjure_add_* helpers do to a target, how the umbrella shared library
conjure_shared and game modules are built, how shaders are compiled and indexed, how warnings and sanitizers
are applied, how third-party libraries are pinned and kept out of our warning set, where the generated headers
come from, and how the configured build steps fit together.
Configure flow
The root CMakeLists.txt (CMake 3.28+) runs in this order:
include(cmake/ConjureConfigs.cmake)beforeproject(), soDebug;Development;Distributionexist for every target including fetched ones.project(Conjure VERSION 0.1.0 LANGUAGES C CXX), thenconjure_derive_config_flags()copies theRelWithDebInfo/Releasecompiler and linker flags into the custom configurations (Development without MSVC's incremental linking, section 2).- In-source builds are rejected;
cmake/is added toCMAKE_MODULE_PATH. - Options (section 3) and their consistency checks.
- Global settings: C++20 without extensions, position-independent code,
CMAKE_EXPORT_COMPILE_COMMANDS,USE_FOLDERS, outputs in${PROJECT_BINARY_DIR}/bin(executables and shared libraries) andlib(static libraries). MSVC additionally gets/MP /utf-8 /Zc:__cplusplus /Zc:preprocessor /EHsc /bigobj. include(ConjureWarnings),include(ConjureModule),include(ConjureSharedLibrary),include(ConjureTesting),include(ConjureSanitizers).add_subdirectory(third_party), thenengine, thenconjure_finalize_engine()(every engine library is declared by now), thenmanaged(whenCONJURE_BUILD_MANAGED AND CONJURE_WITH_SCRIPTING),editor,runtime,tests(afterenable_testing()),samples, each behind its option.conjure_print_configuration_summary()prints the resulting matrix.
engine/CMakeLists.txt walks CONJURE_ENGINE_MODULES in dependency order and adds every module directory, as do
engine/src/core/CMakeLists.txt for CONJURE_CORE_AREAS, tests/CMakeLists.txt for CONJURE_TEST_MODULES and
tests/core/CMakeLists.txt for CONJURE_CORE_TEST_AREAS. A listed directory without a CMakeLists.txt stops the
configure with a FATAL_ERROR naming the list and the path, as do a missing tests/integration/ and, with
CONJURE_BUILD_BENCHMARKS, a missing tests/benchmarks/: a skip could only hide a typo or a lost file that later
shows up as unrelated link errors. A subsystem still turns off, because each module's CMakeLists.txt honours its
CONJURE_WITH_* option (the editor, CONJURE_BUILD_EDITOR) and returns early, and the test directory of an optional
module checks for its module's target (tests/core for conjure::core_<area>). Only samples/CMakeLists.txt
skips samples/feature_test/ when that directory is absent. When CONJURE_WITH_RENDERER is on,
engine/CMakeLists.txt also includes ConjureShaders and adds engine/shaders/.
Configurations
cmake/ConjureConfigs.cmake:
- Multi-config generators get
CMAKE_CONFIGURATION_TYPES "Debug;Development", or"Debug;Development;Distribution"when the cache holdsCONJURE_BUILD_EDITOR=OFF: the editor is never part of a Distribution build and a multi-config tree builds every configuration from one set of targets, so the configuration exists there only without the editor. Single-config generators defaultCMAKE_BUILD_TYPEtoDevelopmentand restrict its choices to the three. conjure_derive_config_flags()setsCMAKE_<LANG>_FLAGS_DEVELOPMENTfromRELWITHDEBINFOandCMAKE_<LANG>_FLAGS_DISTRIBUTIONfromRELEASE(same forEXE/SHARED/MODULE/STATIClinker flags), and maps imported targets that only know the standard configurations withCMAKE_MAP_IMPORTED_CONFIG_DEVELOPMENT "RelWithDebInfo;Release;"and..._DISTRIBUTION "Release;RelWithDebInfo;".- On MSVC, Development does not link incrementally: the derivation turns the
/INCREMENTALof CMake'sRelWithDebInfolinker flags into/INCREMENTAL:NO, in a value already cached too, because the benchmarks are enforced in Development (tests/benchmarks/README.md) and incremental linking adds padding and jump thunks that Distribution does not have./debugstays; every Development relink ofconjure_sharedand of the test and benchmark executables is a full link, while Debug, the default oftools/build.py, keeps incremental linking. - Before
project()it setsCMAKE_MSVC_DEBUG_INFORMATION_FORMATto$<$<CONFIG:Debug,Development>:ProgramDatabase>unless one is given (CMP0141 takes/Ziout of the flag defaults, and CMake's own default names only Debug and RelWithDebInfo), so MSVC Development objects carry debug info and Distribution produces no PDB. conjure::platform_defines(cmake/ConjureWarnings.cmake) addsCONJURE_DEBUG=1,CONJURE_DEVELOPMENT=1orCONJURE_DISTRIBUTION=1through$<CONFIG:...>generator expressions, plusCONJURE_WITH_*andCONJURE_RHI_*for the enabled subsystems. On Windows it also definesNOMINMAX,WIN32_LEAN_AND_MEAN,UNICODE,_UNICODE,_CRT_SECURE_NO_WARNINGS.- A single-config
Distributionbuild forcesCONJURE_BUILD_EDITORoff; a multi-config tree with the editor on has noDistributionconfiguration at all (above), so the*-distpresets are the way to build what ships.conjure_add_executable(... WIN32_GUI)hides the console window only in Distribution (WIN32_EXECUTABLE $<CONFIG:Distribution>and/ENTRY:mainCRTStartupon MSVC) so developers keep stdout. CONJURE_WITH_SCRIPTINGneeds the .NET host pack (cmake/FindNetHost.cmake). When the root file does not find it, scripting andCONJURE_BUILD_MANAGEDare turned off for that tree with a CMake warning instead of failing the configure;-DCONJURE_WITH_SCRIPTING=OFFmakes the choice explicit.
Options and consistency rules
The option table is in Build Options. The root file enforces:
| Rule | Error |
|---|---|
CONJURE_BUILD_EDITOR requires CONJURE_PLATFORM_GLFW |
the editor renders through Dear ImGui's GLFW backend |
CONJURE_WITH_RENDERER requires CONJURE_RHI_D3D12 or CONJURE_RHI_VULKAN |
a renderer with no backend is a configure error |
CONJURE_RHI_D3D12 is OFF (cache INTERNAL) off Windows |
D3D12 is Windows only |
CONJURE_ENABLE_TSAN excludes CONJURE_ENABLE_ASAN and MSVC |
cmake/ConjureSanitizers.cmake |
CONJURE_WITH_SCRIPTING needs the .NET host pack |
cmake/FindNetHost.cmake fails with the install hint or -DCONJURE_WITH_SCRIPTING=OFF |
Module helpers
cmake/ConjureModule.cmake declares the three target kinds. Libraries link conjure::platform_defines publicly (so the
CONJURE_* macros reach consumers) and conjure::warnings / conjure::sanitizers privately; executables
(conjure_add_executable, and conjure_add_test_executable in cmake/ConjureTesting.cmake) link all three privately.
conjure_add_module
conjure_add_module(<name>
SOURCES <files...> # required; private sources and headers under engine/src/<name>
PUBLIC_HEADERS <files...> # absolute paths under engine/include/conjure/<name>
PUBLIC_DEPS <targets...> # dependencies that leak into the public headers
PRIVATE_DEPS <targets...> # dependencies used only in .cpp files (third-party goes here)
PUBLIC_DEFINES <defs...>
PRIVATE_DEFINES <defs...>
)
Creates the static library conjure_<name> with alias conjure::<name>; public include directories engine/include
and ${PROJECT_BINARY_DIR}/generated/include, private engine/src; the private define CONJURE_MODULE_NAME="<name>";
FOLDER "Engine"; the target property CONJURE_PUBLIC_HEADERS (read by conjure_header_check()); registration in the
global property CONJURE_STATIC_LIBRARIES through conjure_register_static_library() (whole-archived into
conjure_shared by conjure_finalize_engine()); and a source_group(TREE engine) for IDEs. Unknown arguments and a
missing SOURCES are fatal.
conjure_add_core_area
Same arguments and behaviour as conjure_add_module, but the target is conjure_core_<area> with alias
conjure::core_<area>, FOLDER "Engine/core" and CONJURE_MODULE_NAME="core". Areas list the other areas they use in
PUBLIC_DEPS (conjure::core_foundation at least); nothing is implied. The real declaration of the math area:
conjure_add_core_area(math
PUBLIC_HEADERS
${PROJECT_SOURCE_DIR}/engine/include/conjure/core/math.h
${PROJECT_SOURCE_DIR}/engine/include/conjure/core/math/aabb.h
# ... one line per public header
SOURCES
aabb.cpp
frustum.cpp
look_rotation.cpp
look_rotation.h
projection.cpp
ray.cpp
transform.cpp
PUBLIC_DEPS
conjure::core_foundation
conjure::thirdparty::glm
)
engine/src/core/CMakeLists.txt then links every area into the INTERFACE umbrella conjure::core, which
is what other modules depend on. tests/core/CMakeLists.txt adds one test directory and one
conjure_header_check(conjure_core_<area>) per area.
conjure_add_executable
conjure_add_executable(<name> [WIN32_GUI] SOURCES <files...> DEPS <targets...> DEFINES <defs...> FOLDER <folder>)
An add_executable with the shared interface targets, FOLDER defaulting to Executables, and the Distribution-only
GUI subsystem described in section 2. tests/core/system/CMakeLists.txt uses it for the conjure_process_child helper.
An MSVC Distribution build copies the toolchain's vcruntime140*.dll and msvcp140*.dll next to conjure_runtime
after it links (runtime/cmake/ConjureMsvcRuntime.cmake takes a redistributable folder not older than the compiler's
toolset); export step 5 ships them.
Warning
PUBLIC_DEPS becomes part of every consumer's include path and link line. A third-party target listed
there (other than conjure::thirdparty::glm) would let its headers reach public headers, which
tools/check_style.py rejects (third-party-include: a public header includes Conjure and C++ standard
library headers only, glm through conjure/core/math/glm_types.h). Keep yyjson, stb, Jolt, NVRHI, GLFW,
miniaudio, ImGui and nethost in PRIVATE_DEPS.
The umbrella shared library and game modules
cmake/ConjureSharedLibrary.cmake provides conjure_finalize_engine(), called once by the root file right
after add_subdirectory(engine) (idempotent). It creates two targets:
| Target | What it is |
|---|---|
conjure_abi_identity |
custom target writing ${PROJECT_BINARY_DIR}/generated/include/conjure/modules/abi_identity.h: CONJURE_ABI_HEADER_HASH (a hash over every public header of every engine module, recomputed at build time), CONJURE_ABI_COMPILER_MAJOR and the runtime facts CONJURE_ABI_RUNTIME_DYNAMIC_CRT / _ASAN / _UBSAN; conjure_modules and conjure_shared depend on it |
conjure_shared (alias conjure::shared) |
SHARED library whole-archiving every library in CONJURE_STATIC_LIBRARIES (every engine module; editor_core, editor_kit and editor_ui outside Distribution), so one copy of every engine symbol and global exists in the process; consumers get CONJURE_SHARED_IMPORTS, the engine include directories, every engine library's interface definitions, conjure::platform_defines and glm |
Every static library is compiled with CONJURE_SHARED_EXPORTS and hidden visibility (conjure_apply_export_settings()
in cmake/ConjureModule.cmake), so conjure_shared exports exactly the declarations that carry CONJURE_API
(conjure/core/api.h) on every platform and nothing is generated at build time. tools/check_exports.py keeps the
annotations complete and reads the export count back from the built library; both run as the CTest entries
exports.check_annotations and exports.count_shared_library (limit 52,428 of the 65,535 a Windows DLL may hold),
with exports.check_tool as the checker's self-test. Modules module 7 has the export story in
detail; tools/check_distribution_symbols.py (CTest runtime.distribution_symbols, label process) proves that the
Distribution conjure_runtime and conjure_shared carry no editor or ImGui symbol.
conjure_add_game_module() (cmake/ConjureModule.cmake) builds a plugin or game module:
conjure_add_game_module(<target>
MANIFEST <module.json> # required; the "name" (and optional "binary") are read from it
SOURCES <files...> # required
[NAME <module name>] [OUTPUT_ROOT <dir>] [DEPS <targets...>] [DEFINES <defs...>] [EDITOR_UI]
)
It creates a SHARED library linking conjure::shared privately (never the static libraries), with hidden
visibility, CONJURE_MODULE_NAME="<name>", FOLDER "GameModules", $ORIGIN / @loader_path rpaths, and
every output under <OUTPUT_ROOT or manifest directory>/bin/<platform>-<arch>-<config> (the binary triplet of
). tests/modules/CMakeLists.txt uses it for the fixture plugins; the handbook chapter
Creating a module 3 shows the call from a module author's side.
LINK_ENGINE_SHARED
conjure_add_test_module() and conjure_add_test_executable() accept LINK_ENGINE_SHARED, which links
conjure::shared and conjure::test_support_shared instead of the static libraries so that a test host and
the plugins it loads share one engine copy. tests/modules/ is the suite that needs it; the consequences for
memory_guard are in Testing and Benchmarks.
Shaders
cmake/ConjureShaders.cmake provides conjure_add_shaders(TARGET <name> OUTPUT_DIR <dir> SHADERS <entries...>
[INCLUDE_DIRS...] [DEPENDENCIES...]), where each entry is source;entry;stage;defines. It compiles every permutation
to DXIL with dxc (CONJURE_RHI_D3D12) and to SPIR-V with glslang or dxc -spirv (CONJURE_RHI_VULKAN, chosen by
CONJURE_SPIRV_COMPILER), and cmake/ConjureShaderIndex.cmake writes <OUTPUT_DIR>/index.json at build time for
rhi::shader_library. engine/shaders/CMakeLists.txt declares the engine's own list as the target conjure_shaders
into ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders (build/<preset>/bin/shaders, next to the executables, where the
engine looks by default); the list holds the RHI fullscreen-triangle pair and every renderer pass shader (the table in
engine/src/renderer/assets/shader_asset.cpp is the list the renderer loads: a new permutation goes into both, and
test_shader_asset fails when they disagree, see Renderer module), and
conjure_renderer and the test executables that render (rhi, renderer, engine, editor, integration, benchmarks) depend
on it. Compiler lookup, depfiles and the index format are in RHI module; the
user-facing side is 📘 API: Shaders.
Warnings as errors
cmake/ConjureWarnings.cmake defines conjure::warnings, applied privately to every Conjure target and
never to third-party code:
| Compiler | Flags |
|---|---|
| MSVC | /W4 /permissive- /external:W0, the opt-in /w14xxx set (4242 4254 4263 4265 4287 4296 4311 4545 4546 4547 4549 4555 4619 4640 4826 4905 4906 4928), /we4289, /wd4201 (nameless struct/union used by the math types), /wd4251 /wd4275 (dll-interface warnings for standard-library members of exported classes; conjure_shared and its consumers are built with one toolchain); /WX when CONJURE_WARNINGS_AS_ERRORS |
| GCC and Clang | -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough; GCC adds -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op; -Werror when CONJURE_WARNINGS_AS_ERRORS |
Third-party headers stay silent because every FetchContent_Declare carries SYSTEM (CMake marks their
include directories as system directories; on MSVC that is /external:I, silenced by /external:W0) and
the wrapper targets use target_include_directories(... SYSTEM PUBLIC ...). Test programs alone receive
-Wno-c2y-extensions on Clang 21+ (CONJURE_TEST_WARNING_OPTIONS in cmake/ConjureTesting.cmake) because
doctest's TEST_CASE expands __COUNTER__; engine targets never see it.
Important
Do not disable a warning to make a build pass. Fix the code; if a third-party header
is at fault, route it through a SYSTEM include as above. The three /wd entries above are intentional warning exceptions
recorded with their reasons, not build fixes.
Sanitizers
cmake/ConjureSanitizers.cmake defines conjure::sanitizers, linked privately by every target:
| Option | MSVC | GCC / Clang | Preset |
|---|---|---|---|
CONJURE_ENABLE_ASAN |
/fsanitize=address |
-fsanitize=address -fno-omit-frame-pointer (compile and link) |
windows-msvc-asan, linux-clang-sanitize |
CONJURE_ENABLE_UBSAN |
ignored | -fsanitize=undefined -fno-omit-frame-pointer |
linux-clang-sanitize |
CONJURE_ENABLE_TSAN |
fatal error | -fsanitize=thread -fno-omit-frame-pointer; exclusive with ASan |
linux-clang-tsan (nightly) |
Runtime options for the CI sanitizer leg are in Continuous Integration.
Testing helpers
cmake/ConjureTesting.cmake provides conjure_add_test_module(), conjure_add_test_executable() and
conjure_header_check(), plus the option CONJURE_TEST_GOLDEN_IMAGES (OFF). The Testing and Benchmarks
chapter documents them in full; the build-relevant facts are:
- A test module compiles its
SOURCEStogether withtests/support/src/test_main.cppandtests/support/src/tracked_global_new.cpp(the globaloperator new/deletereplacement, test executables only, never engine code), linksconjure::<module>when that target exists, and registers one CTest entry perTEST_CASEthrough doctest'sdoctest_discover_tests(). conjure_header_check(<target>)writes one.cppper entry ofCONJURE_PUBLIC_HEADERScontaining just#include "<path relative to engine/include>", compiles them as the object library<target>_header_checkwith the target's usage requirements and the project warning set, and hangs that off the aggregate targetconjure_header_check, which is part ofALL. A header that does not compile alone therefore breaks the default build.tests/CMakeLists.txtregisterstools/check_style.py --tests-mirror-headersplus its self-test as the CTest entriesstyle.checkandstyle.check_tool(labelsstyleandkit_conformance: the checker holds the editor's sources to the widget kit'skit-onlyinclude rule),tools/check_docs.pyplus its self-test asdocs.checkanddocs.check_tool(labeldocs), and the self-tests oftools/build.py,tools/prune_builds.py,tools/download_test_assets.py,tools/generate_native_api.pyandtools/kit_triptych.pyasbuild.driver_tool,build.prune_tool,test_assets.downloader_tool,native_api.generator_toolandkit.triptych_tool(labeltools), each with a 120 s timeout, when a Python 3 interpreter is found. The self-tests live intools/tests/and never touch the network.- Independently of Python, it registers
build.abi_identity_non_ascii_path(labelbuild, 60 s timeout):cmake/ConjureSharedLibrary.cmakein script mode over a header list that names a path with a non-ASCII directory, which fails if the list is read back truncated. - Also independently of Python, it registers
build.managed_project_references(labelbuild, 60 s timeout): theCHECK_CLEANscript mode ofcmake/ConjureManaged.cmakeover a probeApp.csprojwhose<ProjectReference>names..\Lib\Lib.csprojwith backslashes, next to aLib/that holds anobj/; it passes only when the check reportsLib/obj, so it fails when the reference parser returns the path unresolved or resolves it against anything but the project's directory. - Also independently of Python, seven configure probes (label
build, 60 s timeout) configure afresh a throwawayLANGUAGES NONEproject that includes one real list file with a probe directory as its source directory. The sixbuild.missing_*_configureentries (engine module, core area, test module, core test area, benchmarks, integration) pass only on theFATAL_ERRORof section 1;build.development_links_without_incrementalonly whenconjure_derive_config_flags()leaves/INCREMENTAL:NOin derived, cached and already right Development flags.
Third-party dependencies
Every dependency is declared exactly once in third_party/CMakeLists.txt or a file it includes (jxl.cmake) with
FetchContent, pinned to an archive that its URL_HASH SHA256 verifies, and exposed as a conjure::thirdparty::<name>
target. Code dependencies are also declared SYSTEM and (where upstream CMake is used) EXCLUDE_FROM_ALL. Most pins
name the archive of one commit (https://github.com/<owner>/<repo>/archive/<commit>.tar.gz), with the release tag,
where the commit has one, in a # tag <name> comment on the FetchContent_Declare line; jxl.cmake and the editor
fonts name release archives. conjure_check_third_party_pins() (cmake/ConjureNotices.cmake) fails the configure,
before anything is downloaded, when a declaration names no URL with URL_HASH SHA256=<64 hex digits> or fetches from a
version control system. Engine code never names an upstream target, so a dependency can be swapped or vendored in one
place. BUILD_SHARED_LIBS is forced OFF for the duration and restored; CMAKE_POLICY_VERSION_MINIMUM 3.5 keeps old
upstream cmake_minimum_required lines configurable under CMake 4; FETCHCONTENT_UPDATES_DISCONNECTED ON stops
re-fetching on every configure.
| Target | Upstream | Pin | Built when | Notes |
|---|---|---|---|---|
conjure::thirdparty::stb |
nothings/stb | commit d14d46f6 |
always | src/stb_impl.c; private to core_system and renderer (and linked by conjure_core_system_tests to decode fixtures) |
conjure::thirdparty::cgltf |
jkuhlmann/cgltf | v1.14 |
always | src/cgltf_impl.c |
conjure::thirdparty::miniaudio |
mackron/miniaudio | 0.11.26 |
CONJURE_WITH_AUDIO |
src/miniaudio_impl.c; links dl pthread m on Linux |
conjure::thirdparty::glm |
g-truc/glm | 1.0.1 |
always | interface target with GLM_FORCE_RADIANS, GLM_FORCE_DEPTH_ZERO_TO_ONE, GLM_ENABLE_EXPERIMENTAL, GLM_FORCE_SILENT_WARNINGS, GLM_FORCE_EXPLICIT_CTOR; the only third-party header allowed in a public header, via conjure/core/math/glm_types.h |
conjure::thirdparty::yyjson |
ibireme/yyjson | 0.10.0 |
always | private to core_json |
conjure::thirdparty::jxl |
libjxl/libjxl, with google/highway, google/brotli and google/skcms in its tree | v0.13.0 tarball, commits 457c8917, db24a98a, 96d9171c, each by URL and SHA-256 |
always (built when linked: CONJURE_WITH_RENDERER) |
third_party/jxl.cmake: libjxl's static jxl (encoder, decoder, skcms colour management), checked at configure time; private to renderer (its JPEG XL codec); JPEG XL |
conjure::thirdparty::doctest |
doctest/doctest | v2.4.11 |
CONJURE_BUILD_TESTS OR CONJURE_BUILD_BENCHMARKS |
also includes scripts/cmake/doctest.cmake and caches _DOCTEST_DISCOVER_TESTS_SCRIPT for the tests/ directories |
conjure::thirdparty::glfw |
glfw/glfw | 3.4 |
CONJURE_PLATFORM_GLFW |
static; Wayland and X11 both on Linux |
conjure::thirdparty::nvrhi |
NVIDIA-RTX/NVRHI | commit bf0bbd9b |
CONJURE_WITH_RENDERER |
D3D12 (d3d12 dxgi dxguid) and/or Vulkan per CONJURE_RHI_*; validation layer on |
glslang (CONJURE_GLSLANG_EXECUTABLE) |
KhronosGroup/glslang | 15.1.0 |
CONJURE_WITH_RENDERER AND CONJURE_RHI_VULKAN |
HLSL front-end for SPIR-V; the default CONJURE_SPIRV_COMPILER of conjure_add_shaders() (section 4.6, RHI module) |
conjure::thirdparty::jolt |
jrouwe/JoltPhysics | v5.3.0 |
CONJURE_WITH_PHYSICS |
SOURCE_SUBDIR Build; object stream and debug renderer on, profiler off |
conjure::thirdparty::imgui |
ocornut/imgui + CedricGuillemet/ImGuizmo | v1.91.9b-docking, commit 105e4fde |
CONJURE_BUILD_EDITOR |
one static library from the listed .cpp files, GLFW backend; PUBLIC definitions IMGUI_DEFINE_MATH_OPERATORS, IMGUI_DISABLE_OBSOLETE_FUNCTIONS, IMGUI_DISABLE_OBSOLETE_KEYIO and IMGUI_ENABLE_TEST_ENGINE (below) |
conjure::thirdparty::editor_fonts |
rsms/inter, tonsky/FiraCode, JetBrains/JetBrainsMono | release archives v4.1, 6.2, v2.304, each by URL and SHA-256 |
CONJURE_BUILD_EDITOR |
data, no code: an INTERFACE target whose dependency conjure_thirdparty_editor_font_files copies the fonts and their licences into bin/fonts (below) |
conjure::thirdparty::nethost |
.NET SDK host pack | found, not fetched | CONJURE_WITH_SCRIPTING |
cmake/FindNetHost.cmake picks the newest pack of the lowest major >= 8 and defines NETHOST_USE_AS_STATIC |
ImGui and the widget kit's hooks
ImGui is compiled with IMGUI_ENABLE_TEST_ENGINE, which turns on ImGui's item hooks; the editor's widget kit reads
them to count the stock ImGui items a frame submits. The definition is PUBLIC because every user of ImGui's headers
must agree on it, and it obliges every link that holds ImGui's objects to define the four ImGuiTestEngineHook_*
functions. The engine and renderer tests link ImGui without the editor, so the kit cannot define them in its own
library.
engine/src/editor/CMakeLists.txt therefore builds the small static archive conjure_editor_kit_hooks (alias
conjure::editor_kit_hooks, from kit/imgui_test_hooks.cpp) and adds it to the ImGui target's interface:
Every consumer of conjure::thirdparty::imgui then resolves the hooks, whether or not it links the editor. The hooks
forward to the probe a test installs and do nothing otherwise. The archive takes ImGui's include directories and
definitions, never its code, so it does not link ImGui back.
Warning
The target_link_libraries line above runs in engine/src/editor/CMakeLists.txt, after ImGui is declared and only
when conjure_thirdparty_imgui exists. Moving it, or removing the editor directory from a tree that still builds
ImGui, leaves the engine and renderer test executables with four unresolved ImGuiTestEngineHook_* symbols.
The editor fonts
The editor bundles three font families, all under the SIL Open Font License 1.1: Inter for the interface, Fira Code
for numbers, logs, paths and code, and JetBrains Mono as a selectable code font. Each is its family's official release
archive, pinned by version and SHA-256. FetchContent refuses a download that does not match, so a new release changes
URL and URL_HASH together.
Nothing is compiled. conjure_thirdparty_editor_font_files copies the static Regular, Medium and SemiBold .ttf files
of each family, never the variable fonts or the .ttc collection, with copy_if_different. Each family's licence is
copied beside them as LICENSE-<Family>.txt:
| Family | Files in bin/fonts |
Licence file |
|---|---|---|
| Inter | Inter-Regular.ttf, Inter-Medium.ttf, Inter-SemiBold.ttf |
LICENSE-Inter.txt, the archive's LICENSE.txt |
| Fira Code | FiraCode-Regular.ttf, FiraCode-Medium.ttf, FiraCode-SemiBold.ttf |
LICENSE-FiraCode.txt, the repository's LICENSE at tag 6.2 |
| JetBrains Mono | JetBrainsMono-Regular.ttf, JetBrainsMono-Medium.ttf, JetBrainsMono-SemiBold.ttf |
LICENSE-JetBrainsMono.txt, the archive's OFL.txt |
The Fira Code release archive carries no licence file. Its licence is fetched as one more pinned download,
font_fira_code_license (DOWNLOAD_NO_EXTRACT TRUE, its own URL_HASH), and has a notice of its own. The files keep
their release names, which the editor's font loader matches by family.
The copies are declared outputs of a custom command, so a deleted bin/fonts is filled again on the next build. On a
multi-configuration generator they land in bin/<Config>/fonts, next to that configuration's executables. A file the
pinned archive does not hold stops the configure with a FATAL_ERROR naming it. conjure_editor_ui links
conjure::thirdparty::editor_fonts privately; the interface target's dependency orders the copy before the editor and
before every test or benchmark executable that links the editor's UI.
The fonts are editor-only. A Distribution tree has CONJURE_BUILD_EDITOR off, so it neither downloads nor installs
them, and an export copies named runtime files only, never fonts/.
Adding a dependency
Declare it here by the URL of its archive with URL_HASH SHA256=<hash> (the archive of the tag's commit, with
# tag <name> on the FetchContent_Declare line), SYSTEM and EXCLUDE_FROM_ALL. Turn off its tests, docs and
install, create the conjure::thirdparty::<name> alias and give it FOLDER "ThirdParty". Add its
conjure_third_party_notice() beside the pin, with VERSION repeating the tag, or the commit where there is no tag
(Licence and third-party notices).
List it in PRIVATE_DEPS of the consuming module, and extend THIRD_PARTY_INCLUDE_ROOTS in tools/check_style.py so
the include-order rule requires angle brackets for the new headers (and THIRD_PARTY_FLAT_HEADER_PREFIXES for headers
included without a directory, so they are grouped as third-party rather than standard library). The public-header rule
needs no entry: it accepts only Conjure and C++ standard library headers and rejects every other include on its own.
To bump a pin, take the commit the new tag points to, put it in the URL, the tag in the comment and the notice's
VERSION, and record the archive's hash. The configure prints the actual hash when the recorded one no longer matches.
Note
There is no cmake/Dependencies.cmake or CompilerWarnings.cmake: the declarations live in
third_party/CMakeLists.txt and its included files, and the warnings in cmake/ConjureWarnings.cmake. CI keys its
_deps cache on the hash of third_party/CMakeLists.txt and third_party/*.cmake.
Generated build info
engine/src/core/CMakeLists.txt runs configure_file(... @ONLY) on engine/src/core/foundation/build_info.h.in,
writing ${PROJECT_BINARY_DIR}/generated/include/conjure/core/build_info.h. The directory is a public include directory
of every module and of the conjure::core umbrella, so the header is included as conjure/core/build_info.h. It
defines the macros CONJURE_VERSION_MAJOR, CONJURE_VERSION_MINOR, CONJURE_VERSION_PATCH, CONJURE_VERSION_STRING,
CONJURE_ENGINE_NAME and the constants in namespace conjure::core::build_info:
#include "conjure/core/build_info.h"
#include <format>
#include <string>
std::string engine_banner() {
using namespace conjure::core;
// VERSION_NUMBER orders versions: major * 1,000,000 + minor * 1,000 + patch.
return std::format("{} {} ({})", build_info::ENGINE_NAME, build_info::VERSION_STRING, build_info::VERSION_NUMBER);
}
The version comes from project(Conjure VERSION 0.1.0) in the root CMakeLists.txt; change it there or in
the template, never in the generated file.
The second generated header is conjure/modules/abi_identity.h, written into the same
generated/include tree by the conjure_abi_identity target. Unlike build_info.h it is
produced at build time, not configure time, because its header hash must follow every public header edit.
Additional build targets
| Target area | Build integration |
|---|---|
| Managed assemblies | conjure_add_managed_project() and managed/CMakeLists.txt. |
| Export | engine::export_pipeline, called by the editor's --export option and project.export command. |
| Benchmarks | tests/benchmarks, with one CTest entry per scenario under label benchmark. |
| Engine-level test fixtures | conjure_add_test_module() with ENGINE, or ENGINE plus LINK_ENGINE_SHARED for the shared-library variant. |
See Testing and Benchmarks for fixture contracts, golden-image configuration, and supported test targets.
Related
- Setup and First Run, Repository Tour, Testing and Benchmarks, Modules module 7 (umbrella library, exports), RHI module 5 (shader pipeline), Creating a module
Presets
Configure presets live in CMakePresets.json. Every single-config configure preset has a build preset of
the same name; test presets exist for every single-config preset except macos-dist. The multi-config
windows-vs preset builds through windows-vs-debug / windows-vs-dev and tests through windows-vs-debug
only. Binary directories are build/<presetName>. In-source builds are rejected by the root CMakeLists.txt.
| Preset | Platform | Compiler | Configuration | Extras |
|---|---|---|---|---|
windows-msvc-debug |
Windows | cl (Ninja) |
Debug | default on Windows |
windows-msvc-dev |
Windows | cl |
Development | |
windows-msvc-dist |
Windows | cl |
Distribution | asserts and TRACE/DEBUG logging compiled out |
windows-msvc-asan |
Windows | cl |
Debug | CONJURE_ENABLE_ASAN=ON |
windows-vs |
Windows | Visual Studio 18 2026 | multi-config | build presets windows-vs-debug, windows-vs-dev; test preset windows-vs-debug only; see IDE notes |
linux-gcc-debug / -dev / -dist |
Linux | gcc / g++ |
Debug / Development / Distribution | default on Linux |
linux-clang-debug |
Linux | clang / clang++ |
Debug | |
linux-clang-sanitize |
Linux | clang++ |
Debug | CONJURE_ENABLE_ASAN=ON, CONJURE_ENABLE_UBSAN=ON |
linux-clang-tsan |
Linux | clang++ |
Debug | CONJURE_ENABLE_TSAN=ON, CONJURE_WITH_SCRIPTING=OFF; nightly |
macos-debug / -dev / -dist |
macOS | clang++, deployment target 14.0 |
Debug / Development / Distribution | default on macOS; macos-dist has no test preset (build only) |
Test presets inherit base-test: output on failure, four parallel jobs, noTestsAction: error, and the
label filter exclude benchmark|golden|kit_visual|downloaded|slow|process. The hidden nightly-test preset
excludes only benchmark|kit_visual (used by windows-msvc-debug-nightly, linux-gcc-debug-nightly and
linux-clang-tsan, which restricts itself to the labels core|ecs|scene|engine|integration and excludes only
benchmark). kit_visual is the widget kit's goldens, which pull-request CI runs in a step of its own
(Widget kit goldens). Two workflow presets,
windows-msvc-debug and linux-gcc-debug, chain configure, build and test for cmake --workflow.
Choosing a Configuration
cmake/ConjureConfigs.cmake is included before project() so the custom configurations exist for every
target, including fetched third-party ones. Single-config generators default to Development when no
CMAKE_BUILD_TYPE is given; every preset sets one explicitly.
| Configuration | Optimisation | Asserts | CONJURE_LOG_TRACE/DEBUG |
Editor | Macro | Flags derived from |
|---|---|---|---|---|---|---|
Debug |
none, full debug info | on | compiled in | yes | CONJURE_DEBUG=1 |
CMake's Debug |
Development |
optimised + debug info | on (CONJURE_ASSERT and CONJURE_VERIFY) |
compiled in | yes | CONJURE_DEVELOPMENT=1 |
RelWithDebInfo |
Distribution |
full | CONJURE_ASSERT compiles out, CONJURE_VERIFY still evaluates its expression |
compiled out | no | CONJURE_DISTRIBUTION=1 |
Release |
The macros come from conjure::platform_defines (cmake/ConjureWarnings.cmake); conjure/core/platform_detect.h
turns them into CONJURE_ASSERTS_ENABLED and CONJURE_DEV_TOOLS_ENABLED, and conjure/core/assert.h and
conjure/core/log.h read those. With a single-config generator a Distribution build sets
CONJURE_BUILD_EDITOR to OFF. The multi-config windows-vs preset offers Debug and Development only: the
editor is never part of a Distribution build and a multi-config tree builds every configuration from one set of
targets, so cmake/ConjureConfigs.cmake adds Distribution to such a tree only when it is configured with
-DCONJURE_BUILD_EDITOR=OFF. Build what ships with the single-config *-dist presets.
Important
Run the Distribution test preset before claiming a change is done when it touches assertions or
logging: CONJURE_CHECK_ASSERTS compiles to a no-op there, and a test that relied on an assert or a
TRACE message to fire will behave differently. python tools/build.py --preset windows-msvc-dist --test.
Private build directories
Builds in the same directory must not overlap. When another agent or a second shell may be building, pass a private directory; the configure preset still supplies the generator and compiler:
python tools/build.py --build-dir build/core_math --target conjure_core_math_tests --test -R core_math
python tools/build.py --build-dir build/core_math --no-configure --target conjure_core_math_tests --test -R core_math
With --build-dir, tools/build.py runs cmake --preset <preset> -B <dir>, cmake --build <dir> and
ctest --test-dir <dir> --output-on-failure instead of the preset forms. Everything under build/ is
ignored by git. --clean removes the directory first, clearing the read-only bit git leaves on fetched
pack files on Windows.
A private directory is temporary. A full Debug tree is 11 to 13 GB, so reuse its name across rounds of work
and remove it once no further round will use it; tools/prune_builds.py lists and removes build trees:
python tools/prune_builds.py # every build tree: size, last change, action
python tools/prune_builds.py core_math --delete # remove named trees (core_math or build/core_math)
python tools/prune_builds.py --older-than 3 --delete # remove trees unchanged for three days
python tools/prune_builds.py --all --keep core_math --delete
It only touches directories directly under build/ that hold a CMakeCache.txt and no CMakeLists.txt, and
whose recorded source directory exists on this host outside the tree. The comparison is by file identity, so an
in-source scratch project stays safe however its path is spelled (a junction, a symbolic link, a subst
drive), and a tree configured from WSL is listed only in WSL, a tree configured on Windows only on Windows. It
never follows a link or junction, and it keeps the presets' binary directories (build/<preset>, including
those of CMakeUserPresets.json and of included preset files, with inheritance and the macros resolved as CMake
does; a macro it cannot know, such as $vendor{}, stands for any text in its place, so $vendor{x}-dev
protects every name ending in -dev) unless --include-presets is given. Without --delete it only reports.
A tree's last change is the newest modification of any file or directory in it, whatever the generator.
To remove a tree it first renames it to a private name next to it (NAME.prune-<process id>) and checks that
what it renamed is still the directory it listed, so another agent that recreates or relinks build/NAME
meanwhile cannot redirect the removal; whenever the removal stops, the tree is renamed back. On Windows removal
works through extended-length paths, so files past 260 characters go too, and deletes read-only files (git
leaves fetched pack files read-only) without clearing the read-only bit their other hard links share. It leaves
a tree untouched while a file in it is held open, a process works in it, or a program or library runs from it.
On Linux and macOS it makes read-only, unreadable and unsearchable directories inside the tree accessible,
refuses to start on a tree when build/ itself is not writable, and keeps a tree that is or holds a mount
point; it cannot tell that a tree is in use there, so run --older-than or --all only when no one else is
building. CMakeCache.txt goes last: a tree that could not be removed completely stays listed, and running the
command again retries it.
Build options
Options are declared in the root CMakeLists.txt (CONJURE_ENABLE_TSAN in cmake/ConjureSanitizers.cmake,
CONJURE_TEST_GOLDEN_IMAGES in cmake/ConjureTesting.cmake) and passed through tools/build.py after --:
| Option | Default | Effect |
|---|---|---|
CONJURE_WITH_RENDERER / _PHYSICS / _AUDIO / _SCRIPTING |
ON | build the subsystem and fetch its dependency (NVRHI, Jolt, miniaudio, nethost); a disabled subsystem also disables its tests |
CONJURE_BUILD_EDITOR / _RUNTIME / _TESTS / _BENCHMARKS / _SAMPLES / _MANAGED |
ON | build the executables, tests, benchmarks, samples and C# assemblies (the samples/ directory skips optional sources that are absent) |
CONJURE_RHI_D3D12 |
ON on Windows, forced OFF elsewhere | D3D12 backend; the renderer needs at least one of D3D12 / Vulkan |
CONJURE_RHI_VULKAN |
OFF on Windows, ON elsewhere | Vulkan backend, fetches glslang |
CONJURE_PLATFORM_GLFW |
ON | GLFW window backend; required by CONJURE_BUILD_EDITOR |
CONJURE_WARNINGS_AS_ERRORS |
ON | /WX or -Werror on every Conjure target |
CONJURE_ENABLE_ASAN / _UBSAN / _TSAN |
OFF | sanitizers; TSan is exclusive with ASan and needs GCC or Clang |
CONJURE_PHYSICS_CROSS_PLATFORM_DETERMINISTIC |
OFF | build Jolt with CROSS_PLATFORM_DETERMINISTIC (bit-identical physics across platforms; slower) |
CONJURE_TEST_GOLDEN_IMAGES |
OFF | enables the golden-image test configuration |