xinoip / pio-cpp-template

C++ project starter template with CMake, vcpkg, CTest/doctest, clang-tidy, clang-format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pio C++ Template

My C++ project starter template.

Features

  • Dummy library named pio_math
  • Example project using that library named example
  • Dependency management with vcpkg integrated into cmake
  • clang-tidy analysis with compile_commands.json support
  • clang-format support
  • doctest unit testing integration to cmake with ctest
  • Integrates well with VSCode using cmake tools extension
  • CMake presets support

Build

Build it with with CMake:

cmake -S . -B build
cmake --build build

You may use CMake presets provided in CMakePresets.json (build/dev and build/rel):

cmake --preset dev # configure
cmake --build dev  # build
ctest dev          # run tests
# or
cmake --preset rel # configure
cmake --build rel  # build
ctest rel          # run tests

Since CMake Presets support requires relatively newer CMake version, you may not have the appropriate CMake version.

If above is the case, use convenient development scripts:

./script/clean.sh   # clean build files and such
./script/config.sh  # shared config for all scripts
./script/build.sh   # build with cmake
./script/run.sh     # run the built output
./script/dev.sh     # build&run in one go

You can find the generated outputs at following locations:

./build/pio_math/PioMath_Lib
./build/test/PioMath_Test
./build/example/Example
./build/compile_commands.json

About

C++ project starter template with CMake, vcpkg, CTest/doctest, clang-tidy, clang-format.


Languages

Language:CMake 84.3%Language:Shell 8.7%Language:C++ 7.0%