Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/raoulkdev/MiniECS/llms.txt

Use this file to discover all available pages before exploring further.

MiniECS uses CMake as its sole build system. A single CMakeLists.txt at the project root declares all source files, sets the C++ standard, and produces a standalone executable with no external libraries to link beyond the standard library and the header-only GLM math dependency. This page covers everything you need to know to configure the project from the command line, adjust the GLM include path for your environment, and optionally integrate with a C++ IDE.

Prerequisites

You need three tools before you can build MiniECS:
RequirementMinimum versionNotes
C++20 compilerGCC 10+, Clang 10+, MSVC 19.29+Must support C++20 features used by <memory> and structured bindings.
CMake3.30Matches the cmake_minimum_required declaration in CMakeLists.txt.
GLMAny recent releaseHeader-only; no compiled library needed.
GLM (OpenGL Mathematics) is a header-only library, which means there is nothing to compile or link. CMake does not need to find a .lib or .so file — you simply need the GLM headers available on the file system and an accurate #include path in TransformModule.h. No find_package(glm) call is required in the current CMakeLists.txt.

Installing Prerequisites

macOS (Homebrew):
brew install cmake glm
Ubuntu / Debian:
sudo apt install cmake libglm-dev
Windows (vcpkg):
vcpkg install glm

CMakeLists.txt

The complete build definition for MiniECS is intentionally short. Here is the actual CMakeLists.txt from the repository:
cmake_minimum_required(VERSION 3.30)
project(MiniECS)

set(CMAKE_CXX_STANDARD 20)

add_executable(MiniECS src/main.cpp
        src/modules/module_base/Module.cpp
        src/modules/module_base/Module.h
        src/unit/Unit.cpp
        src/unit/Unit.h
        src/modules/renderer/RendererModule.cpp
        src/modules/renderer/RendererModule.h
        src/modules/transform/TransformModule.cpp
        src/modules/transform/TransformModule.h
        src/world/World.cpp
        src/world/World.h)
What each line does:
  • cmake_minimum_required(VERSION 3.30) — enforces that the CMake installation is at least version 3.30, matching the project’s policy settings.
  • project(MiniECS) — names the project and sets the PROJECT_NAME variable used internally by CMake.
  • set(CMAKE_CXX_STANDARD 20) — instructs the compiler to use C++20 mode (-std=c++20 on GCC/Clang, /std:c++20 on MSVC).
  • add_executable(MiniECS ...) — declares a single compilation target named MiniECS and lists every .cpp and .h file explicitly. Including headers in this list is optional for compilation but makes them visible in IDEs.

Source File Layout

The source tree follows a module-per-subdirectory convention:
src/
├── main.cpp                          # Entry point; creates World, Units, and Modules
├── world/
│   ├── World.h                       # World class declaration
│   └── World.cpp                     # createUnit, getUnitByName, play() implementation
├── unit/
│   ├── Unit.h                        # Unit class + getModule<T>() template
│   └── Unit.cpp                      # addModule factory, removeModule, callModuleStart
└── modules/
    ├── module_base/
    │   ├── Module.h                  # Base Module class + ModuleType enum
    │   └── Module.cpp                # getTypeName(), getType(), default start()
    ├── renderer/
    │   ├── RendererModule.h          # RendererModule declaration
    │   └── RendererModule.cpp        # start() override — prints "Start / Started rendering..."
    └── transform/
        ├── TransformModule.h         # TransformModule with glm::vec2 fields
        └── TransformModule.cpp       # start() override — prints position, rotation, scale
Each module subdirectory is self-contained. Adding a new module means creating a new subdirectory, a .h/.cpp pair that inherits from Module, and two lines in CMakeLists.txt.

Building from the Command Line

From the repository root, run:
cmake .
make
cmake . configures the project in-source (build files land in the same directory as CMakeLists.txt). For a cleaner out-of-source build, use a separate directory:
mkdir build && cd build
cmake ..
make
After a successful build, the MiniECS executable appears in whichever directory you ran make from. Run it with:
./MiniECS
The cmake-build-debug/ directory you may see in the repository is generated by CLion’s default build profile. It is not the output of a manual cmake . && make invocation. If you are building from the command line, your executable will be in the directory where you ran make, not in cmake-build-debug/. Do not confuse the two; running cmake-build-debug/MiniECS after a manual build will execute a stale binary if CLion has previously compiled the project.

GLM Path Configuration

TransformModule.h includes GLM with an absolute path that targets the default Homebrew installation on Apple Silicon Macs:
#include "/opt/homebrew/include/glm/glm.hpp" // Change this to where you have GLM
If GLM is installed elsewhere, you must update this line before building. Common paths:
Platform / package managerTypical GLM path
macOS — Homebrew (Apple Silicon)/opt/homebrew/include/glm/glm.hpp
macOS — Homebrew (Intel)/usr/local/include/glm/glm.hpp
Ubuntu / Debian/usr/include/glm/glm.hpp
Windows — vcpkgC:/vcpkg/installed/x64-windows/include/glm/glm.hpp
Manual installwherever you extracted the GLM release archive
Alternatively, you can replace the absolute path with a relative include and add GLM’s parent directory to CMake’s include path by adding one line to CMakeLists.txt:
# Add this after set(CMAKE_CXX_STANDARD 20)
include_directories(/path/to/glm/parent)
Then change the include in TransformModule.h to:
#include <glm/glm.hpp>
This is more portable and the recommended approach if you intend to share the project across machines or operating systems.

IDE Integration

Both CLion and VS Code with the CMake Tools extension can open the MiniECS repository directly as a CMake project. Open the folder, let the IDE detect CMakeLists.txt, select a kit (compiler toolchain), and hit Build — no manual cmake . required. IDE integration also gives you full IntelliSense, inline compiler errors, and a one-click debugger that respects the CMake build configuration.
CLion will automatically create a cmake-build-debug/ profile when you open the project. Set the GLM path in the CMake cache editor (File → Settings → Build, Execution, Deployment → CMake) or edit TransformModule.h directly. VS Code requires the CMake Tools extension. Once installed, open the command palette and run CMake: Configure, then CMake: Build.

Build docs developers (and LLMs) love