Meowstro is a C++ game project using SDL2 and related libraries. The project uses CMake for building with platform-specific dependency management to optimize setup and development across different systems.
- C++17 compiler (Visual Studio 2022, GCC, Clang)
- CMake (version 3.10 or higher)
- Platform-specific dependencies (see below and in DEPENDENCIES.md)
All of my group uses Windows so that's the recommended OS but I will try to make Linux and MacOS work. I made it so those OS get tested in the GitHub Actions too so hopefully everything works with that.
Install vcpkg and integrate it:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate installCopy build.default.bat to build.bat (Command Prompt) or build.default.ps1 to build.ps1 (PowerShell), update the vcpkg path, then:
.\build.bator
.\build.ps1Both scripts will:
- Configure the project using the Visual Studio generator (
-G "Visual Studio 17 2022" -A x64) - Use the vcpkg toolchain file
- Build the Debug configuration
The output directory is always
build/bin/Debugorbuild/bin/Releasedepending on the build type, on all platforms.
Install SDL2 and development tools from the system package manager:
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
pkg-config \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev
# Note: Requires SDL2 2.30.0+, SDL2_image 2.8.2+, SDL2_mixer 2.8.0+, SDL2_ttf 2.22.0+Then build directly:
cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build buildHomebrew:
brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf
cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build buildFor convenience, platform-specific build scripts are provided:
- Windows:
build.batorbuild.ps1(copy frombuild.default.batandbuild.default.ps1) - Linux/macOS:
build.sh(copy frombuild.default.sh)
Personal build scripts contain system-specific paths and are ignored in .gitignore.
After building, run the executable:
- Debug build (default):
./build/bin/Debug/meowstro(add.exeon Windows) - Release build:
./build/bin/Release/meowstro(add.exeon Windows)
The output directory is always
build/bin/Debugorbuild/bin/Releasedepending on the build type, on all platforms.
Audio Synchronization: There are known synchronization issues between the audio, game logic, and rendering that can cause the game to feel slow or off. Due to time constraints and other priorities, this issue remains unresolved. I (Hugo) will get back to it as soon as I feel like I have time to do so. This project will be worked on in the future with the goal of making the game good enough.
- cppcheck
- clang-tidy
Update CMakeLists.txt when adding new source files:
set(SOURCES
src/existing_file.cpp
src/new_file.cpp # Add here
# ...
)
set(HEADERS
include/existing_file.hpp
include/new_file.hpp # Add here
# ...
)/project-root
│-- .github/ # GitHub-specific files (workflows, templates)
│ │-- workflows/ # GitHub Actions workflows
│ │ │-- build.yml # Workflow for building the project
│ │-- PULL_REQUEST_TEMPLATE.md # Pull request guidelines
|-- aseperite-imgs # Aseperite files to modify image assets
│-- assets/ # Game assets (textures, sounds, etc.)
│ │-- audio/ # Audio files
│ │-- fonts/ # Font files
│ │-- images/ # Image files
│-- build/ # CMake build files (includes build/bin/Debug and build/bin/Release)
|-- cmake/ # copy_if_exists.cmake location
│-- docs/ # Project documentation
│ │-- design_notes.md
│ │-- how_to_play.md
│-- include/ # Header files
│-- src/ # Source files
|-- tests/ # Test files
│-- .gitattributes # Git attributes file
│-- .gitignore # Git ignore file
│-- build.default.bat # Windows batch default build script
│-- build.default.ps1 # Windows PowerShell default build script
│-- build.default.sh # macOS/Linux default build script
│-- CMakeLists.txt # Main CMake build script
|-- DEPENDENCIES.md # List of dependencies/versions used
│-- LICENSE # Project LICENSE
│-- README.md # Project README
|-- vcpkg.json # JSON file w/ dependencies & versions used in vcpkg install