# 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: ```bash sudo apt update sudo apt install \ build-essential \ cmake \ ninja-build \ libglfw3-dev \ libglm-dev \ libspdlog-dev \ libfmt-dev \ libgl1-mesa-dev ``` ## Building Clone the repository and enter the project directory: ```bash git clone cd DeerithEngine ``` Create a separate build directory: ```bash cmake -S . -B build -G Ninja ``` Build the project: ```bash cmake --build build ``` The project uses C++20. ## Running After a successful build, run the sandbox application with: ```bash ./build/sandbox/Sandbox ``` If the executable is generated in a different location depending on the CMake configuration, you can find it with: ```bash find build -type f -executable -name "Sandbox" ``` Then execute the resulting path. ## Project Structure ```text MyEngine/ ├── CMakeLists.txt │ ├── deerith_engine_core/ │ ├── CMakeLists.txt │ ├── include/ │ │ └── deerith/ │ └── src/ │ ├── deerith_engine_client/ │ ├── CMakeLists.txt │ ├── include/ │ │ └── deerith/ │ ├── src/ │ └── shaders/ │ ├── 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: * `spdlog` * `fmt` It exposes its headers through: ```text deerith_engine_core/include ``` ### DeerithClient `DeerithClient` contains the graphics/client-side engine functionality. Dependencies: * `DeerithCore` * OpenGL * GLFW * GLM It also copies the engine shaders into the build directory automatically. ### Sandbox `Sandbox` is the executable used to test and develop the engine. It links against: ```text DeerithClient ``` ## Shader Files Shaders are located in: ```text deerith_engine_client/shaders/ ``` CMake automatically copies them to the corresponding build directory: ```text build/deerith_engine_client/shaders/ ``` This is done by the `DeerithClientShaders` custom target. ## Clean Build To completely remove the generated build files: ```bash rm -rf build ``` Then configure and build again: ```bash cmake -S . -B build -G Ninja cmake --build build ``` ## Debug Build For a Debug build: ```bash cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug cmake --build build ``` Run the application: ```bash ./build/sandbox/Sandbox ``` ## Release Build For a Release build: ```bash 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: ```bash cmake --build build ``` If CMake does not detect a project configuration change correctly, reconfigure: ```bash cmake -S . -B build -G Ninja ```