Skip to content

snpara/sdl2-project-template

Repository files navigation

Template For SDL2 Projects

C++ License

This template is adapted from CppProjectTemplate.

This is a template for SDL2 projects. What you get:

  • Library, executable and test code separated in distinct folders
  • Use of modern CMake for building and compiling
  • External libraries installed and managed by
    • CPM Package Manager
  • Code documentation with Doxygen
  • Tooling: Clang-Format, Cmake-Format, Clang-tidy

Structure

├── CMakeLists.txt
├── app
│   ├── CMakesLists.txt
│   └── main.cpp
├── cmake
│   └── cmake modules
├── docs
│   ├── Doxyfile
│   └── html/
├── external
│   ├── CMakesLists.txt
│   ├── ...
└── src
    ├── CMakesLists.txt
    ├── my_lib.hpp
    └── my_lib.cpp

Library code goes into src/, main program code in app/

Software Requirements

  • CMake 3.27+
  • GNU Makefile
  • Doxygen
  • MSVC 2017 (or higher), G++9 (or higher), Clang++9 (or higher)
  • Optional: Makefile

Building

First, clone this repo and do the preliminary work:

git clone --recursive https://github.com/snpara/cpp-practice-template
make prepare
  • App Executable
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release --target main
cd app
./main
  • Unit testing
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --config Debug --target unit_tests
cd tests
./unit_tests
  • Documentation
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --config Debug --target docs
  • Code Coverage (Unix only)
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
cmake --build . --config Debug --target coverage

For more info about CMake see here.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages