/CProjectTemplate

Ground Zero for a generic C code

Primary LanguageCMake

Usage

Please note that the commands have to be executed from the build subdirectory.

command action  
cmake --preset=simple buildsystem from preset  
cmake -G "MinGW Makefiles" .. generate buildsystem  
make compile source code executable can be found under build/src/
make test run cmocka tests  
make doc generate documentation to view open build/doc/html/index.html
make clean remove compiled files  

If VSCode is used these commands are also available as tasks in tasks.json.

Building

First, clone this repo and do the preliminary work:

  • Simulation for developer
cd Build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_WARNINGS=ON -DENABLE_WARNINGS_AS_ERRORS=ON -G "MinGW Makefiles" ..
cmake --build . --config Release --target main
./Simulation
  • Simulation using presets

Go to root dir:

cmake --preset=simple
cd Build
make
  • Documentation
cd Build
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --config Debug --target docs

Software Requirements

  • CMake 3.22+
  • GNU Makefile
  • MSVC 2017 (or higher), GCC 9 (or higher), Clang 9 (or higher)
  • Doxygen
  • Code Coverage (only on GNU|Clang): lcov, gcovr