A modern engine is not just a collection of C++ files — it is a
CMake is the industry standard for this kind of work, but most tutorials teach outdated patterns. This article
presents
Old CMake relied on:
Modern CMake uses:
This shift is essential for engine architecture.
Engines usually have many modules. Our engine has the following modules:
Each module must be:
Target based CMake makes this possible.
The GusOnGames engine uses a
The top level file:
It does not contain build logic for modules.
This keeps the top level file clean and readable.
Each module has its own CMakeLists:
engine/glew/CMakeLists.txtengine/image/CMakeLists.txtengine/math/CMakeLists.txtengine/platform/CMakeLists.txtengine/render/CMakeLists.txtengine/resources/CMakeLists.txtengine/simulation/CMakeLists.txtengine/utils/CMakeLists.txtEach module:
This enforces clean boundaries.
Each module defines its own
This avoids collisions and keeps naming consistent. GLEW is an external library we compile ourselves, but we do not modify in any way. It is written in C and thus has no namespace support.
This is the heart of modern CMake.
The dependency affects:
Example: math headers.
The dependency affects:
Example: internal helper libraries.
The dependency affects:
Example: header only libraries.
CMakePresets.json is the modern way to define build configurations.
It allows you to define:
This makes the engine easy to build on:
And easy to integrate with IDEs.
This gives developers a predictable workflow.
The engine uses only one library which is built inside the engine.
This, as well as any other libraries we might add, should be:
This keeps the engine clean and maintainable.
The top level CMakeLists orchestrates the entire engine.
add_subdirectory(engine/glew)
add_subdirectory(engine/image)
add_subdirectory(engine/math)
add_subdirectory(engine/platform)
add_subdirectory(engine/render)
add_subdirectory(engine/resources)
add_subdirectory(engine/simulation)
add_subdirectory(engine/utils)
add_subdirectory(examples/basic_triangle)
add_subdirectory(examples/physics_demo)
add_subdirectory(examples/game_demo)
Examples are separate executables that link to engine modules.
Example:
target_link_libraries(game_demo
PRIVATE
engine_platform
engine_renderer
engine_simulation
engine_resources
engine_math
)
This makes dependencies explicit and predictable.
This article defined the build architecture of the GusOnGames engine:
This build system is modern, scalable, and perfectly aligned with the engine’s modular architecture.