This is a sdl tutorials. 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
- Unit testing using Catch2 v2
- General purpose libraries: JSON, spdlog, cxxopts and fmt
- Continuous integration testing with Github Actions and pre-commit
- Code documentation with Doxygen and Github Pages
- Tooling: Clang-Format, Cmake-Format, Clang-tidy, Sanitizers
├── CMakeLists.txt
├── app
│ ├── CMakesLists.txt
│ └── main.cc
├── cmake
│ └── cmake modules
├── docs
│ ├── Doxyfile
│ └── html/
├── src
│ ├── CMakesLists.txt
│ ├── my_lib.h
│ └── my_lib.cc
└── tests
├── CMakeLists.txt
└── main.cc
Library code goes into src/, main program code in app/ and tests go in tests/.
- CMake 3.21+
- GNU Makefile
- Doxygen
- CPM
- MSVC 2017 (or higher), G++9 (or higher), Clang++9 (or higher)
- Optional: Code Coverage (only on GNU|Clang): lcov, gcovr
- Optional: Makefile, Doxygen
First, clone this repo and do the preliminary work:
git clone https://github.com/kybuivan/sdl-tutorials.git
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
- Output
JSON: 3.11.2
FMT: 90100
CXXOPTS: 3.1.1
SPDLOG: 1.11.0
SDL: 2.26.3
SDL_image: 2.6.3
SDL_mixer: 2.6.3
SDL_net: 2.2.0
SDL_ttf: 2.20.2
Usage Example:
[2023-05-30 13:32:54.175] [info] Welcome to sdl-tutorials v0.1.0
Welcome to sdl-tutorials v0.1.0
Usage:
sdl-tutorials [OPTION...]
arguments options:
-h, --help Print usage
-f, --filename arg File name
-v, --verbose Verbose output
For more info about CMake see here.