C++ Training Project by devminds GmbH
This C++ project is used for DevOps CI/CD trainings.
The project contains an application providing a CLI to calculate the sum of two numbers:
C++ Training Project
Usage: ./cplusplus_training_project [OPTIONS] SUBCOMMAND
Options:
-h,--help Print this help message and exit
Subcommands:
sum Sum two doublesThe C++ application is based on the following toolchain:
- CMake as build system
- doxygen for documentation
- GCC and Clang for compilation
- GoogleTest for test creation and execution
- ClangFormat for code formatting
- Clang-Tidy for static code analysis
- Cppcheck for static code analysis
- include-what-you-use for #include analysis
- link-what-you-use for linking analysis
- gcovr for code coverage processing
├── build Reserved folder for build artifacts
├── cmake Custom CMake files
├── docs Doxygen documentation
├── external 3rdparty libraries as Git submodules
├── src C++ source code
├── tests GoogleTest tests
└── tools Scripts
All steps required to build or test the application are wrapped in separate shell scripts.
Check the content of the corresponding scripts for details.
Build the doxygen documentation:
./tools/build-docs.shRun clang-format:
./tools/clang-format.shThe following tools are integrated into CMake and can be enabled by defining a corresponding environment variable:
- Enable include-what-you-use by defining
ENABLE_IWYU=1 - Enable link-what-you-use by defining
ENABLE_LWYU=1 - Enable Clang-Tidy by defining
ENABLE_CLANG_TIDY=1 - Enable Cppcheck by defining
ENABLE_CPPCHECK=1
If Cppcheck should be executed manually, run the following:
cppcheck src/ --xml --xml-version=2 2> cppcheck.xmlBuild the application release config:
./tools/build-cmake-target.sh gcc-release cplusplus_training_projectBuild the tests for code coverage analysis:
./tools/build-cmake-target.sh gcc-coverage calculate_testExecute the tests:
./tools/run-test.sh build/gcc-coverage/bin/calculate_test build/gccExecuting the GCC tests will create the following artifacts:
build/gcc/test-report.xml: test results in Junit XML formatbuild/gcc/test-coverage.xml: code coverage report in Cobertura XML formatbuild/gcc/html/index.html: HTML report of code coverage from gcovr
Build the application release config:
./tools/build-cmake-target.sh clang-release cplusplus_training_projectBuild the tests for code coverage analysis:
./tools/build-cmake-target.sh clang-coverage calculate_testExecute the tests:
./tools/run-test.sh build/clang-coverage/bin/calculate_test build/clangExecuting the Clang tests will create the following artifacts:
build/clang/test-report.xml: test results in Junit XML formatbuild/clang/test-coverage.xml: code coverage report in Cobertura XML formatbuild/clang/html/index.html: HTML report of code coverage from gcovr