GithubHelp home page GithubHelp logo

vcatechnology / cmake-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 188 KB

Implements a fully featured CMake build

License: Other

CMake 29.10% Python 27.80% C 11.26% C++ 6.52% Batchfile 25.31%

cmake-boilerplate's Introduction

C/C++ CMake Boilerplate

Travis Build Status Appveyor Build Status Coverage Status

This project allows for a good start for any C/C++ project that would like to be built with CMake. It includes:

  • Auto detection of the latest C++ standard
  • Strict warning flags
  • Warnings as errors in release builds
  • Address sanitization in debug builds
  • Undefined behaviour detection in debug builds
  • C unit testing support with check
  • C++ unit testing support with catch
  • Travis support
  • Appveyor support with multiple compilers
  • Coveralls support

The idea behind the boilerplate is to get any project up and running with the tooling needed for a modern C or C++ codebase. The integration of coverage, unit testing and benchmarking allows almost instant access to those features of the tooling. The Travis and Appveyor YAML scripts allow for continuous integration to be running from the first push of new code.

Getting Started

  1. Clone the repository to get the boilerplate:
git clone https://github.com/vcatechnology/cmake.git my-project
cd my-project
  1. Update the project name in the CMakeList.txt file:
sed -i 's|project([^)]\+)|project(my_project)|' CMakeList.txt
  1. Modify the boilerplate to suit the needs of the of the new project. This will require changes to:

    • README.md
    • LICENSE.md
    • CONTRIBUTE.md
    • Namespaces in C++ files
    • Function prefixes in C files
    • Removal of the C or C++ part of the build if necessary
  2. Push up the changes to your new project

git remote set-url origin https://github.com/user/my-project.git
git push -u origin master
  1. Enable Travis, Appveyor and Coveralls for the project so that all the goodness of the tooling can occur.

  2. Start writing code! The README.md in src and test will provide more information

Building

The project is a standard out of tree CMake project. To build the code run the following commands:

mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
make test

On Windows it is possible to create and build Visual Studio projects from the command line:

mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..
set "msbuild_opts=/clp:OnlyErrors;OnlyWarnings /nologo /m /v:m"
msbuild %msbuild_opts% /p:Configuration=Release /p:Platform=x64 boilerplate.sln
msbuild %msbuild_opts% RUN_TESTS.vcxproj

cmake-boilerplate's People

Contributors

mattyclarkson avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

cmake-boilerplate's Issues

Integrate doxygen

Having doxygen integrated would lead to developers seeing the documentation of the project as not such an awful task.

This would required an upstream FindDoxygen.cmake that can build doxygen from source.

Benchmark integration

The Google benchmark library provides a nice way to benchmark C and C++ functions. Integration of this tool would allow for a way to monitor the speed of a project.

Would require an upstream FindLibBenchmark.cmake that can build that project from source.

Integrate catch unit testing

We need a C++ unit testing framework for the project to be useful. catch provides a simple and modern way to write unit tests and provides a CMake build.

Would require an upstream FindLibCatch.cmake to build the project from source.

readthedocs.org Integrate

Being able to upload the documentation to readthedocs.org would hopefully make the documentation seem like a worthwhile thing to do.

Requires #2 for documentation building.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.