Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/cpp-projectPublic template

Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.

License

NotificationsYou must be signed in to change notification settings

bsamseth/cpp-project

Repository files navigation

Project Status: Active – The project has reached a stable, usable state and is being actively developed.Build StatusBuild statusCoverage StatuscodecovCodacy BadgeLanguage grade: C/C++Total alertslicenseLines of CodeAverage time to resolve an issuePercentage of issues still open

Boiler plate for C++ projects

This is a boiler plate for C++ projects. What you get:

Demo of usage

Structure

.├── CMakeLists.txt├── app│   └── main.cpp├── include│   ├── example.h│   └── exampleConfig.h.in├── src│   └── example.cpp└── tests    ├── dummy.cpp    └── main.cpp

Sources 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.

Building

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.

.gitignore

The.gitignore file is a copy of theGithub C++.gitignore file,with the addition of ignoring the build directory (build/).

Services

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

Setup

Using the GitHub template

Click theUse this template button to make a new repository from this template.

From command line

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors10


[8]ページ先頭

©2009-2025 Movatter.jp