A simple, cross-platform, and continuously integrated C++14 project template

Overview

Project Name

Travis Build Status Appveyor Build Status Coverity Scan Build Status codecov Codacy Badge Documentation

A simple, cross-platform, and continuously integrated C++14 project template.

Making cross platform C++ projects is widely known to be a troublesome ambition. This project attempts to demystify many of the common problems related to creating such a structure by providing a simple template that achieves this purpose.

Getting Started

Configuring the Template

(Unfortunately, a setup script isn't currently available but is being worked on in #3. Until it is, however, these steps have to be followed manually.)

In order to use this project, all you have to do is follow a few (Ok, more than a few) simple steps:

  1. git clone this project into a directory of choice.
  2. Open the file .codedocs and replace the variables PROJECT_NAME, PROJECT_NUMBER, and PROJECT_NUMBER with their corresponding values.
  3. Open the file .travis.yml, and replace the encrypted Coverity Scan token with the one for your project. In addition, modify the variables in the following section with their corresponding values:
    project:
      name: "arnavb/cpp14-project-template"
      description: "A cross-platform C++14 project template"
    notification_email: [email protected]
    
  4. In ./CMakeLists.txt, modify:
    1. Project-Name to match your project name.
    2. Project-Name_VERSION_MAJOR, Project-Name_VERSION_MINOR, and Project-Name_VERSION_PATCH to match the versioning of your project. Make sure to modify the names of the variables as well!
    3. Modify PROJ_NAME to be the name of your project.
    4. Do the same for PROJECT_DESCRIPTION.
    5. If you are building just a library, then remove ${CMAKE_SOURCE_DIR}/src/main.cpp from COVERAGE_EXCLUDES.
    6. Modify the LIBRARY_SOURCES variable to match your project sources. Exclude main.cpp, if it exists.
    7. If you are building a standalone library, then remove the following lines:
      add_executable(Project-Name main.cpp) # The main executable
      target_link_libraries(Project-Name Project-Name-lib) # Link our sources to the executable
      
      And later on in the file, remove:
      # Install the built library and executable into the appropriate directory
      install(TARGETS Project-Name DESTINATION bin)
      
    8. Change the name Project-Name and Project-Name-lib to match your project name.
    9. Change:
      install(FILES ${CMAKE_BINARY_DIR}/include/project-abbr/config.hpp DESTINATION include/project-abbr) # Install our configuration file
      
      to match the new folder name for your project, as described in step 8.
  5. Modify LICENSE to match your software license.
  6. Modify this file (README.md) to match the details of your project. You may want to keep the build steps, however.
  7. Open the folder doc. Then:
    1. Delete all the markdown pages from this directory and replace them with your own.
    2. If a main page is needed, it needs to be in a file called main_page.md.
  8. Open the folder include. Then:
    1. Change the name of the folder project-abbr to something that matches your project (name or abbreviation). Delete all the files except config.hpp.in in this directory and replace them with your public include files, if they exist.
  9. Open the folder src. Then:
    1. Remove all of the .cpp files in this folder and replace them with your source files and private includes.
  10. Open the folder test. Then:
    1. Replace all the files in this directory except for test_runner.cpp with your doctest unit testing files.
    2. In test/CMakeLists.txt, change Project-Name-lib to match the new name of your library. In addition, modify the TEST_SOURCES variable to match your new test files.
  11. Delete the by default hidden .git folder and then run git init to get a new repository!

For details on how to set up the various continuous integration tools used in this project, check the documentation.

Building the Code

Prerequisites

The following tools must be preinstalled before using this template:

  • CMake (At least v3.1): For building the code.
  • Doxygen: For generating documentation.
  • LCOV: For generating code coverage.

In the snippets below, CONFIGURATION needs to be a valid CMake configuration.

Linux/OSX

mkdir build && cd build
cmake -D<options> -DCMAKE_BUILD_TYPE=CONFIGURATION ..
make
make install

Windows

mkdir build && cd build
cmake -D<options> ..
cmake --build --config CONFIGURATION .
cmake --build --target INSTALL --config CONFIGURATION .

For more details on configuration options and build targets, see the documentation.

Running the Tests

In order to run the tests, the option BUILD_TESTS needs to be set to ON during configuration. Then, invoking the tests is as simple as running:

ctest

Code Coverage

In order to get the test coverage of the code, the option ENABLE_COVERAGE needs to be set to ON during configuration. In addition, CMAKE_BUILD_TYPE should be set to Debug (code coverage isn't supported for multi-config generators yet). Then, a coverage report can be generated by running:

make coverage

The resulting coverage will be placed in a directory called coverage in the build folder.

Documentation

The documentation for this project (sample code and usage of this project) is hosted on codedocs.xyz.

Documentation about build targets, CMake options, the directory structure used, and documentation are all available in the link above.

License

CC0

To the extent possible under law, Arnav Borborah has waived all copyright and related or neighboring rights to C++14 Project Template. This work is published from: United States.

The above basically means that while you do not have to give me attribution for this template, it would be gladly appreciated!

You might also like...
Practical mutation testing tool for C and C++

Mull Mull is a tool for Mutation Testing based on LLVM/Clang with a strong focus on C and C++ languages. For installation and usage please refer to th

A modern, C++11-native, single-file header-only, tiny framework for unit-tests, TDD and BDD (includes C++98 variant)

lest – lest errors escape testing This tiny C++11 test framework is based on ideas and examples by Kevlin Henney [1,2] and on ideas found in the CATCH

Modern c++17 unit testing framework on Microsoft Windows, Apple macOS, Linux, iOS and android.
Modern c++17 unit testing framework on Microsoft Windows, Apple macOS, Linux, iOS and android.

tunit Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android. Continuous Integration build status Operating system Status Windo

testing joystick under Linux environment, support monitoring disconnection state and auto recovery mode

qjoystick This qjoystick class is rewritten based on the library: https://github.com/drewnoakes/joystick. Please look at this library if you want to s

An area to test reading in ATLAS xAOD format and writing out to Parquet

xaod_to_parquet An area to test reading in ATLAS xAOD format and writing out to Parquet Getting the Code Clone the repository with the --recursive fla

Xerus - A general purpose library for numerical calculations with higher order tensors, Tensor-Train Decompositions / Matrix Product States and other Tensor Networks

About The xerus library is a general purpose library for numerical calculations with higher order tensors, Tensor-Train Decompositions / Matrix Produc

This package contains the common algorithms in robotic arm, and I have developed it based on universal robot. It will be continuously updateing.
This package contains the common algorithms in robotic arm, and I have developed it based on universal robot. It will be continuously updateing.

Robotic_Arm_Algorithms It contains the common algorithms in robotic arm, and will be recording the development as soon as I have completed the any one

U++ is a C++ cross-platform rapid application development framework focused on programmer's productivity. It includes a set of libraries (GUI, SQL, Network etc.), and integrated development environment (TheIDE).
U++ is a C++ cross-platform rapid application development framework focused on programmer's productivity. It includes a set of libraries (GUI, SQL, Network etc.), and integrated development environment (TheIDE).

Ultimate++ Ultimate++ is a C++ cross-platform rapid application development framework focused on programmers productivity. It includes a set of librar

Android studio native project template using cross platform raylib graphics library.

rayturbo Android studio native project template using cross platform raylib graphics library. https://www.raylib.com/ This project use Android Studio

Template for reliable, cross-platform C++ project setup using cmake.

The C++ CMake Project Template cmake-init is a sophisticated copy & paste template for modern C and C++ projects. The main goals include support of al

The Gecko SDK (GSDK) combines all Silicon Labs 32-bit IoT product software development kits (SDKs) based on Gecko Platform into a single, integrated SDK.

Silicon Labs Gecko SDK (GSDK) The Gecko SDK (GSDK) combines Silicon Labs wireless software development kits (SDKs) and Gecko Platform into a single, i

FSD-Template - A template UE4.25 project for BP modding.

FSD-Template Project generated by Archengius' UE4 Template Generator. Reflected C++ classes generated by CheatingMuppet & Archengius' UE4SS UHT Genera

A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs.

webview for golang and c/c++ A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. The goal of the project is to

OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.
OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.

OpenGL Template Engine is a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects. This is the template I personally use for my own projects and provides me with the general OpenGL 3D render setup with model import and UI.

TinyXML2 is a simple, small, efficient, C++ XML parser that can be easily integrated into other programs.
TinyXML2 is a simple, small, efficient, C++ XML parser that can be easily integrated into other programs.

TinyXML-2 TinyXML-2 is a simple, small, efficient, C++ XML parser that can be easily integrated into other programs. The master is hosted on github: h

C library designed for the TI MSP432P401R microprocessor and the TI Educational Booster Pack, to easily play and control songs with the integrated Piezo Buzzer.

MusicLib C library designed for the TI MSP432P401R microprocessor and the TI Educational Booster Pack, to easily play and control songs with the integ

A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking. The implementation is as limited and as simple as possible to create the lowest amount of overhead.

plf_nanotimer A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking. The implementation is as limited and simple a

Comments
  • ✨ Add Code Coverage Support

    ✨ Add Code Coverage Support

    Code coverage is a useful metric that shows the extent of a project's tests.

    This PR will:

    • [x] Enable local code coverage using CMake with LCOV/GCOV.
    • [x] Enable hosted code coverage using codecov.

    ~~ISSUE: LCOV/GCOV are both ignoring the header files in the code for some reason.~~ ^-- Solution: Switch to doctest for performance and proper code coverage.

    enhancement 
    opened by arnavb 0
  • ✨ Add a script for generating the project template

    ✨ Add a script for generating the project template

    Closes #2

    This script should have the following features:

    • [ ] Allow user to specify if they are making a library or application.
    • [ ] Allow user to specify directories for source code
    • [ ] Allow setup of all CMake related files (*/CMakeLists.txt).
    • [ ] Allow setup (Or exclusion) of documentation files.
    • [ ] Allow setup of CI tools
    • [ ] Allow specifying external files (Such as licenses/README files)
    enhancement WIP on hold 
    opened by arnavb 0
Owner
Arnav Borborah
Just a college freshman who loves programming.
Arnav Borborah
Project basicly find the test that fails some code.

Stress Test project Overview many and many times in competitve programming when you have a solution got WA(wrong answer) and you do not know why and c

Omar Abdel-Ghani 3 Feb 15, 2022
C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.

FakeIt GCC: MSC: FakeIt is a simple mocking framework for C++. It supports GCC, Clang and MS Visual C++. FakeIt is written in C++11 and can be used fo

Eran Pe'er 1.1k Jan 4, 2023
QuickCheck clone for C++ with the goal of being simple to use with as little boilerplate as possible.

RapidCheck RapidCheck is a C++ framework for property based testing inspired by QuickCheck and other similar frameworks. In property based testing, yo

null 860 Dec 27, 2022
Simple C testing framework

MrTest Simple C testing framework Usage Copy the mrtest.c and mrtest.h file into your project. In order to use the mrtest main: create a .c file that

Maarten Raasveldt 2 Jul 20, 2022
Simple, fast, accurate single-header microbenchmarking functionality for C++11/14/17/20

ankerl::nanobench ankerl::nanobench is a platform independent microbenchmarking library for C++11/14/17/20. #includ

Martin Leitner-Ankerl 909 Dec 25, 2022
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 16k Jan 9, 2023
TestFrame - This is a test framework that uses Raylib and ImGui together to help test and develop concepts

This is a test framework that uses Raylib and ImGui together to help test and develop concepts. It is made using C++ because it uses classes for windows and views.

Jeffery Myers 22 Dec 29, 2022
C++ Testing using spies and fakes for isolation and simulation

ELFspy is a library for linux for writing tests using fakes and spies in C++. For very large call graphs, the testing of the higher nodes can be diffi

Robin Nicholson 49 Dec 9, 2022
Native ApprovalTests for C++ on Linux, Mac and Windows

Approval Tests for C++ ⬇️ Download the latest version (v.10.8.0) of the single header file here. ?? Read the Docs Contents What are Approval Tests? Re

null 268 Dec 25, 2022
Googletest - Google Testing and Mocking Framework

GoogleTest OSS Builds Status Announcements Release 1.10.x Release 1.10.x is now available. Coming Soon Post 1.10.x googletest will follow Abseil Live

Google 28.8k Jan 9, 2023