Build ASGE from source
ASGE builds a static library target and installs a CMake package config, so it
can be consumed as a subdirectory, via FetchContent, or as an installed package.
Prerequisites
- A C++23 compiler — MSVC on Windows, GCC/Clang on Linux, Clang on macOS
- CMake ≥ 3.31
- Git
-
Clone the repository
shellgit clone https://github.com/lmriccardo/a-simple-game-engine.git asge cd asge -
Fetch vendored dependencies
SDL3 and the stb single-header libraries aren't pulled in by CMake — a script vendors them per platform.
Windows (PowerShell)./scripts/install-deps.ps1Linux / macOS./scripts/install-deps.sh -
Configure, build and test
Using one of the provided CMake presets (also buildable without a preset via plain
cmake -S . -B build):Windowscmake --preset windows cmake --build --preset windows ctest --preset windows-debugLinuxcmake --preset linux cmake --build --preset linux ctest --preset linux-debugmacOScmake --preset macos cmake --build --preset macos ctest --preset macos-debugBuilt examples land in
bin/.
Using ASGE in your own C++ project
Either way, pull in the whole engine through the umbrella header:
#include <ASGE/ASGE.hpp>
Option 1 — add_subdirectory
Vendor ASGE into your project (e.g. as a submodule under third-party/asge) and add it directly:
add_subdirectory(third-party/asge)
add_executable(my_game main.cpp)
target_link_libraries(my_game PRIVATE ASGE)
# On Windows, my_game.exe also needs SDL3.dll next to it at runtime
asge_copy_sdl3_runtime(my_game)
Option 2 — FetchContent
include(FetchContent)
FetchContent_Declare(
asge
GIT_REPOSITORY https://github.com/lmriccardo/a-simple-game-engine.git
GIT_TAG main
SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/asge"
)
FetchContent_MakeAvailable(asge)
add_executable(my_game main.cpp)
target_link_libraries(my_game PRIVATE ASGE)
asge_copy_sdl3_runtime(my_game)
ASGE's own dependencies aren't fetched by CMake, so the first
FetchContent_MakeAvailable call fails — it clones ASGE, then immediately tries to
configure it before find_package(SDL3) can find anything. Run ASGE's install
script against the freshly-cloned copy once, then reconfigure:
./third-party/asge/scripts/install-deps.sh # or install-deps.ps1 on Windows
Option 3 — installed package
Install ASGE (cmake --install build), then from your own project:
find_package(ASGE REQUIRED CONFIG)
add_executable(my_game main.cpp)
target_link_libraries(my_game PRIVATE ASGE::ASGE)
Testing
Unit tests (GoogleTest) live under tests/ and build when
BUILD_TESTING is ON:
ctest --preset windows-debug # or the linux / macos equivalent