Start

Theory

Reference

Examples

Installation

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
  1. Clone the repository

    shell
    git clone https://github.com/lmriccardo/a-simple-game-engine.git asge
    cd asge
  2. 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.ps1
    Linux / macOS
    ./scripts/install-deps.sh
  3. Configure, build and test

    Using one of the provided CMake presets (also buildable without a preset via plain cmake -S . -B build):

    Windows
    cmake --preset windows
    cmake --build --preset windows
    ctest --preset windows-debug
    Linux
    cmake --preset linux
    cmake --build --preset linux
    ctest --preset linux-debug
    macOS
    cmake --preset macos
    cmake --build --preset macos
    ctest --preset macos-debug

    Built 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:

CMakeLists.txt
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

CMakeLists.txt
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:

shell
./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:

CMakeLists.txt
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:

shell
ctest --preset windows-debug   # or the linux / macos equivalent