Add CMake build and cross-platform cleanup

This commit is contained in:
Bram Verhulst
2026-04-12 23:15:20 +02:00
parent 81746db9ae
commit 1ba1c1f2cc
25 changed files with 350 additions and 56 deletions

View File

@@ -79,18 +79,52 @@ This section gives a clear and detailed overview of which parts of the original
<!-- GETTING STARTED -->
## Getting Started
Detailed instructions on how to run your game project are in this section.
This project now includes a CMake build in addition to the original Visual Studio solution files.
For the longer version, troubleshooting, and platform notes, see [`BUILDING.md`](BUILDING.md).
### Prerequisites
This is an example of how to list things you need to use the software and how to install them.
* Visual Studio 2022 Or Jetbrains Rider
#### Windows
* Visual Studio 2022 with the Desktop development with C++ workload
* CMake 3.21 or newer
### How to run the project
The repository already contains prebuilt SDL2 / SDL2_image / SDL2_mixer / SDL2_ttf Windows packages in `Libraries/`, and the CMake build will use those by default.
1. Download the Repo.
2. Open the project in Visual Studio 2022 or Jetbrains Rider.
3. Run the project.
#### Linux
Install the development packages first.
Ubuntu / Debian example:
```bash
sudo apt install build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libgl1-mesa-dev
```
### Build with CMake
#### Windows, Visual Studio 2022
```bash
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Debug
```
The executable will be generated in `build/bin/` or the selected Visual Studio configuration output folder. Resource files are copied automatically after the build.
#### Linux
```bash
cmake -S . -B build
cmake --build build
```
The executable will be generated in `build/bin/`. Resource files are copied automatically after the build.
### Run the game
After building, run the generated executable from the build output directory so that the copied resource files are next to it.
### Notes
* The original `.sln` and `.vcxproj` files are still present and can still be used in Visual Studio.
* The CMake build creates the same two logical targets as the solution: `Engine` and `Motherload`.
* On non-Windows platforms, SDL dependencies are expected to come from the system package manager.
<p align="right">(<a href="#readme-top">back to top</a>)</p>