/project-cpp-template

Primary LanguageC++The UnlicenseUnlicense

project-cpp-template

Linux Status Windows Status macOS Status MIT License Latest version

This repository aims to represent a template for Modern C++ projects, including static analysis checks, autoformatting, a BDD/TDD capable test-suite and packaging

Features

  • [x] CMake and Conan based project template

  • [x] qt6 widgets&qml style application demo

  • [x] imgui-style application demo

  • [x] plugin demo(shared/static)

  • [x] BDD/TDD test-suite

  • [x] GitHub actions with cache

  • [x] Code coverage

  • [x] Code formatting&linting

  • [x] Basic CPack packaging

Available CMake Options

  • BUILD_TESTING - builds the tests (requires doctest)

  • BUILD_SHARED_LIBS - enables or disables the generation of shared libraries

  • BUILD_WITH_MT - valid only for MSVC, builds libraries as MultiThreaded DLL

  • BUILD_WITH_QT6 - enables or disables the generation of qt6 widgets&qml style application demo

  • CODE_COVERAGE - enables or disables the generation of code coverage

  • USE_SANITIZER - enables or disables the generation of code coverage, could be Address,Leak,Memory,Thread,Undefined

Add third party libs

  • conan conan package build type should be defined in conan profile

$ pip install conan
$ conan profile detect
$ conan profile update settings.compiler.libcxx=libstdc++11 default
$ conan profile update settings.compiler.cppstd=17 default
$ task conan:base
  • vcpkg

    • [] vcpkg install

    • [] vcpkg import to cmake

How to build from command line

The project can be built using the following commands:

cd /path/to/this/project
task cmake:gen