Template for new c projects. Includes build system, testing, mocking, logging, readme, license, pipelines.
Clone project
git clone https://github.com/KubaTaba1uga/c_project_template.git
Delete template git files
rm -rf c_project_template/.git
Initiate new git files
cd c_project_template
git init
Once you have initialized the repository, create a remote repository somewhere like github.com.
Add the remote URL to your local git repository
git remote add origin <URL>
Commit at least one file
Push changes
git push -u origin master
I recommend installing perequesitest and confirming that all tests are passing before src/, test/ are actually deleted.
Project's name or version can be changed in ./meson.build file.
Ruby is used by CMock. Python is used by Meson.
Install perequesites by scripts
bash scripts/install_ruby.sh
bash scripts/install_meson.sh
If installing perequesites by scripts has failed, You need to install them manually.
Configure a build for an app and tests
meson setup build
Compile a build
meson compile -C build
Run all tests
meson test -C build
New tests units should be grouped by directories. To understand more look on ./test directory.
Hierarchial build is very favoured by Meson, splitting test unit's into seperate directories allow keeping meson.builds short and simple.
Some pipelines are configured out of the box:
build.yaml
compiles the projectlinter.yaml
makes sure code is inline with .clang-formatunit-tests.yaml
runs unit testsunit-tests-with-valgrind.yaml
checks for memory leaks in testsmerge-gatekeeper.yaml
makes sure that all pipelines ran successfully before merging pull request
Setting up a build
bash scripts/setup_build.sh
Compiling a build
bash scripts/compile_build.sh
Formatting a code
bash scripts/format_code.sh
Running tests
bash scripts/run_tests.sh
Running tests with valgrind
bash scripts/run_valgrind_tests.sh
- Jakub Buczyński - C Project Template - KubaTaba1uga
This project is licensed under the MIT License - see the LICENSE.md file for details