This is a C project template with the following features:
- CMake build scripts for building libraries, applications, and tests.
- Integrated with SDL2.
- Integrated with SDL2 Image.
- Integrated with Unity unit test framework.
- Integrated with FetchContent for library dependencies like Unity.
- Resource folder to include assets
- Updated and improved version of C-project-template
This will build cmake files and download dependencies
make setup
# Debug build
make debug
# Release build
make release
This will build and run unity tests
make test
This will build and run unity tests and generate reports for coverage (depends on lcov)
make coverage
# This part is optional: Generates a html with more coverage details
genhtml build/coverage/coverage.info --output-directory build/coverage/out
This will delete generated files for debug and release
make clean
This will open an SDL black window with the unlicense logo on it for 3 seconds.
# Debug bin
./build/debug/bin/example_app
# Release bin
./build/release/bin/example_app
./
├── .github
│ └── workflows -- Github workflows folder.
├── app -- Application source code
├── build
│ ├── cmake -- Cmake Finders for external compiled libs.
│ ├── debug -- Cmake debug build generated files.
│ │ ├── bin -- Application debug binaries.
│ │ └── resources -- Application resources assets symbolic link.
│ └── release -- Cmake release build generated files.
│ ├── bin -- Application release binaries.
│ └── resources -- Application resources assets symbolic link.
├── resources -- Application resources assets folder.
├── src -- Library source code and headers.
└── test -- Test source code.
└── unity -- Unity test framework source.
yay -Sy clang cmake lcov sdl2 sdl2_image
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
sudo apt-get update -y -qq
sudo apt-get install clang cmake lcov libsdl2-dev libsdl2-image-dev
Projects using this boilerplate:
This is free and unencumbered software released into the public domain.
For more information, please refer to http://unlicense.org/