- Notifications
You must be signed in to change notification settings - Fork129
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.
License
bsamseth/cpp-project
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is a boiler plate for C++ projects. What you get:
- Sources, headers and mains separated in distinct folders
- Use of modernCMake for much easier compiling
- Setup for tests usingdoctest
- Continuous testing withTravis-CI,Appveyor andGitHub Actions, with support for C++17.
- Code coverage reports, including automatic upload toCoveralls.io and/orCodecov.io
- Code documentation withDoxygen
.├── CMakeLists.txt├── app│ └── main.cpp├── include│ ├── example.h│ └── exampleConfig.h.in├── src│ └── example.cpp└── tests ├── dummy.cpp └── main.cppSources go insrc/, header files ininclude/, main programs inapp/, andtests go intests/ (compiled tounit_tests by default).
If you add a new executable, sayapp/hello.cpp, you only need to add the following two lines toCMakeLists.txt:
add_executable(main app/main.cpp)# Name of exec. and location of file.target_link_libraries(mainPRIVATE${LIBRARY_NAME})# Link the executable to lib built from src/*.cpp (if it uses it).
You can find the example source code that builds themain executable inapp/main.cpp under theBuild section inCMakeLists.txt.If the executable you made does not use the library insrc/, then only the first line is needed.
Build by making a build directory (i.e.build/), runcmake in that dir, and then usemake to build the desired target.
Example:
mkdir build&&cd buildcmake .. -DCMAKE_BUILD_TYPE=[Debug| Coverage| Release]make./mainmaketest# Makes and runs the tests.make coverage# Generate a coverage report.make doc# Generate html documentation.
The.gitignore file is a copy of theGithub C++.gitignore file,with the addition of ignoring the build directory (build/).
If the repository is activated with Travis-CI, then unit tests will be built and executed on each commit.The same is true if the repository is activated with Appveyor.
If the repository is activated with Coveralls/Codecov, then deployment to Travis will also calculate code coverage andupload this to Coveralls.io and/or Codecov.io
Click theUse this template button to make a new repository from this template.
When starting a new project, you probably don't want the history of this repository. To start fresh you can usethesetup script as follows:
git clone https://github.com/bsamseth/cpp-project# Or use ssh-link if you like.cd cpp-projectbash setup.sh
The result is a fresh Git repository with one commit adding all files from the boiler plate.
About
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors10
Uh oh!
There was an error while loading.Please reload this page.
