MyEngine
A C++20 game engine project built with CMake and OpenGL.
Requirements
Ubuntu with the following packages installed:
- CMake >= 3.20
- GCC / G++
- Make or Ninja
- OpenGL development libraries
- GLFW3
- GLM
- spdlog
- fmt
Install the dependencies with:
sudo apt update
sudo apt install \
build-essential \
cmake \
ninja-build \
libglfw3-dev \
libglm-dev \
libspdlog-dev \
libfmt-dev \
libgl1-mesa-dev \
libimgui-dev
Building
Clone the repository and enter the project directory:
git clone <repository-url>
cd DeerithEngine
Create a separate build directory:
cmake -S . -B build -G Ninja
Build the project:
cmake --build build
The project uses C++20.
Running
After a successful build, run the sandbox application with:
./build/sandbox/Sandbox
If the executable is generated in a different location depending on the CMake configuration, you can find it with:
find build -type f -executable -name "Sandbox"
Then execute the resulting path.
Project Structure
MyEngine/
├── CMakeLists.txt
│
├── deerith_engine_core/
│ ├── CMakeLists.txt
│ ├── include/
│ │ └── deerith/
│ └── src/
│
├── deerith_engine_client/
│ ├── CMakeLists.txt
│ ├── include/
│ │ └── deerith/
│ ├── src/
│ └── shader_ts/
│
├── sandbox/
│ ├── CMakeLists.txt
│ └── src/
│ └── main.cpp
│
└── build/
The build/ directory is generated by CMake and should not be committed to Git.
CMake Targets
DeerithCore
DeerithCore is the engine's core library.
Dependencies:
spdlogfmt
It exposes its headers through:
deerith_engine_core/include
DeerithClient
DeerithClient contains the graphics/client-side engine functionality.
Dependencies:
DeerithCore- OpenGL
- GLFW
- GLM
It also copies the engine shader_ts into the build directory automatically.
Sandbox
Sandbox is the executable used to test and develop the engine.
It links against:
DeerithClient
shader_t Files
shader_ts are located in:
deerith_engine_client/shader_ts/
CMake automatically copies them to the corresponding build directory:
build/deerith_engine_client/shader_ts/
This is done by the DeerithClientshader_ts custom target.
Clean Build
To completely remove the generated build files:
rm -rf build
Then configure and build again:
cmake -S . -B build -G Ninja
cmake --build build
Debug Build
For a Debug build:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build
Run the application:
./build/sandbox/Sandbox
Release Build
For a Release build:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
Development
When adding new .cpp files to the engine, CMake automatically detects them through GLOB_RECURSE with CONFIGURE_DEPENDS.
After adding or removing source files, rebuild normally:
cmake --build build
If CMake does not detect a project configuration change correctly, reconfigure:
cmake -S . -B build -G Ninja