All Projects → kracejic → Cleancppproject

kracejic / Cleancppproject

Licence: mit
Clean C++ project for you to use. Features: Modern CMake, CPack, Doxygen, PlantUML, Catch Unit testing, static analysis

Projects that are alternatives of or similar to Cleancppproject

Modern Cpp Template
A template for modern C++ projects using CMake, Clang-Format, CI, unit testing and more, with support for downstream inclusion.
Stars: ✭ 690 (+150%)
Mutual labels:  cmake, static-analysis, project-template
Cmake Examples
Useful CMake Examples
Stars: ✭ 7,220 (+2515.94%)
Mutual labels:  cmake, static-analysis, unit-testing
Opengl cmake skeleton
❤️ A ready to use cmake skeleton using GLFW, Glew and glm. 👍
Stars: ✭ 118 (-57.25%)
Mutual labels:  cmake, example
Cmakeprotosgrpc
gRPC + protobuf using CMake example
Stars: ✭ 137 (-50.36%)
Mutual labels:  cmake, example
Learning Cmake
learning cmake
Stars: ✭ 2,524 (+814.49%)
Mutual labels:  cmake, example
Novuscore
A modern take on WoW emulation
Stars: ✭ 88 (-68.12%)
Mutual labels:  cmake, framework
Jni By Examples
🎇Fun Java JNI By Examples - with CMake and C++ (or C, of course!) ‼️ Accepting PRs
Stars: ✭ 99 (-64.13%)
Mutual labels:  cmake, example
Argagg
A simple C++11 command line argument parser
Stars: ✭ 180 (-34.78%)
Mutual labels:  cmake, doxygen
Ffmpeg Example
FFMPEG 0.11-4.4/LibAV 0.8-11 example application with byte exact reading
Stars: ✭ 44 (-84.06%)
Mutual labels:  cmake, example
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Stars: ✭ 3,019 (+993.84%)
Mutual labels:  unit-testing, static-analysis
UTBotCpp
Tool that generates unit test by C/C++ source code, trying to reach all branches and maximize code coverage
Stars: ✭ 59 (-78.62%)
Mutual labels:  unit-testing, static-analysis
mylib
Шаблон кросплатформенного CMake-проекта для языка C++ 🇬🇧 Modern CMake crossplatform project template for C++
Stars: ✭ 49 (-82.25%)
Mutual labels:  static-analysis, doxygen
Spirit
Atomistic Spin Simulation Framework
Stars: ✭ 67 (-75.72%)
Mutual labels:  cmake, framework
Clang Blueprint
🏰 Example C++11 CMake project that incorporates awesome Clang tooling 🐉
Stars: ✭ 63 (-77.17%)
Mutual labels:  cmake, doxygen
Moderncppci
This is an example of doing a Modern C++ project with CI
Stars: ✭ 109 (-60.51%)
Mutual labels:  cmake, unit-testing
Cxxctp
DEPRECATED. USE INSTEAD github.com/blockspacer/flextool
Stars: ✭ 58 (-78.99%)
Mutual labels:  cmake, static-analysis
Primitiv
A Neural Network Toolkit.
Stars: ✭ 164 (-40.58%)
Mutual labels:  cmake, framework
c-template
Boilerplate to set up a c project, include CuTest unit testing, cmake build setup
Stars: ✭ 69 (-75%)
Mutual labels:  cmake, doxygen
C cpp project framework
CMake build system( framework) with kconfig support for C/CPP projects
Stars: ✭ 26 (-90.58%)
Mutual labels:  cmake, framework
Cherish
🏰 Sketch- and image-based system for 3D representation and documentation of cultural heritage sites
Stars: ✭ 27 (-90.22%)
Mutual labels:  cmake, doxygen

cleanCppProject

Build Status

This is an empty frame for project in C++. It should help to start a new project without caring much about project/build environment setup.

Features

  • Modern, simple CMake build scripts, divided into several components for readability.
  • Sane and simple targets for everything (see targets section).
  • CPack script which can produce deb, rpm, windows installer, bundle app, dmg and various compressed packages.
  • Tests via CTest.
  • Unit tests via Catch.
  • Documentation generation via Doxygen (code + wiki + UML diagrams with Graphviz and PlanUML).
  • Static analysis support (clang-tidy, cppcheck).
  • Dynamic analysis helpers via sanitizers (see cmake/sanitizers.cmake).
  • Works with your favourite linux distro, Windows and MacOS.
  • Gitlab CI and Travis CI configuration examples.
  • Support for gold linker for faster linking time.
  • Helpers for adding external dependencies downloaded during configuration or build.
    • see external/CMakeLists.txt and cmake/cleanCppExtension.cmake

Important pages

\todo see how todo works

How to convert this to your new project

git clone https://github.com/kracejic/cleanCppProject.git yourNewProject
cd yourNewProject
mv .git .git-cleanCppProject
git init
git add .
git commit -m "first commit"

More in How to start working.

How to keep the link with us

We are improving this repo on a regular basis, if you want to get more from us, try to pull the main repo.

cd yourNewProject/ 
git pull --git-dir='.git-cleanCppProject'

Building instructions

Prerequisites

  • CMake 3.2 and newer
  • Compiler with support for C++14
  • git - for downloading external resources
  • Doxygen for docs (Graphviz for more graphs in docs, PlantUML for more UML diagrams, PlantUML needs java)
  • clang-tools for static analysis and formatting
  • cppcheck for another static analysis

Prerequisites on Linux

  • Arch Linux: sudo pacman -S cmake g++ graphviz git clang clang-tools-extra cppcheck java-runtime-common cppcheck

    • download plantuml.jar and have it somewhere where PATH points to
  • Ubuntu 16.04: sudo apt-get install cmake g++ graphviz plantuml git clang clang-tidy clang-format cppcheck

Prerequisites on Windows

Two ways, which were tested:

  • msys2 based

    • Minimal: pacman -S cmake g++ git
    • Additional software pacman -S clang mingw-w64-x86_64-clang-tools-extra mingw-w64-x86_64-clang-analyzer doxygen
    • For graphs in documentation install Graphviz (to c:\Program Files\Graphviz, so scripts can find it) and add its bin subdirectory to PATH, install java (have its bin directory on PATH), download PlantUML jar file and have it on PATH.
  • Microsoft Visual Studio

    • Install cmake
    • Install git
    • For additional features install clang with tools, doxygen, graphviz, plantuml, java and add them to the PATH (not tested)

Prerequisites on macOS

  • macOS Sierra brew install llvm doxygen cppcheck graphviz

Build on Linux & macOS

Standard Makefiles:

mkdir build ; cd build
cmake ..
make -j8

Ninja build witch clang, build all+doc and install it to dist folder:

mkdir build ; cd build
cmake -GNinja -DCMAKE_CXX_COMPILER="clang++" ..
ninja all doc install

Release build which will install itself into /usr after sudo make install

mkdir build ; cd build
cmake .. -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_BUILD_TYPE="Release"
make -j8 all
sudo make install

Build on windows

Build on windows using MSYS2 + ninja

On windows you should prefer Ninja since it is much faster than make (but has no color in shell).

With gcc:

mkdir build ; cd build
cmake -GNinja ..
ninja install

You can use cmake -G "MSYS Makefiles" .. if you want to use make.

Build on Windows using Microsoft Visual Studio 14

First you may wan to change project name in main CMakeLists.txt. Just go to the folder with the project and create new directory and create project files with this:

mkdir buildmsvc
cd buildmsvc
cmake -G "Visual Studio 14 2015" ..

and you can now open a .sln file with Visual Studio. You need to right click on executable target and Set as StartUp project. To really see the console window you want to do Start without debugging, since when run in debug mode only, console widow is closed too fast.

Targets

Note: Availability of some targets depends on availability certain executables (e.g. clang-format for format target)

  • Build
    • all (the default if no target is provided)
    • clean
    • install - install binaries into CMAKE_INSTALL_PREFIX
    • exampleApp - build exampleApp binary
    • exampleApp-run - build, install and run exampleApp binary (for your convenience)
    • exampleApp-gdb - build, install and run exampleApp binary in gdb (for your convenience)
    • run - alias for exampleApp-run (in order to keep it short)
  • Testing
    • check - run whole test suite (see test/CMakeLists.txt)
    • checkVerbose - run whole test suite (see test/CMakeLists.txt), but more verbose
    • unit - build and run unit tests only (see test/CMakeLists.txt)
    • unitall - same as previous, only prints even successful unit tests results
  • Releases
    • package - builds packages (zip,deb,rpm,windows installer depending on OS)
  • Miscellaneous
    • doc - build documentation (if doxygen is available)
      • docs can be found in build_dir/doc/doc/index.html
      • if you want them to be a part of install package, uncomment section at the end of doc/CMakeLists.txt
    • format - run clang-format on all source files (.clang-format in root directory of a project is used)
    • gdb - run target executable with gdb (does not work from ninja, needs gdb)
  • Static analysis
    • tidy - run clang static analysis on all sources
    • cppcheck - call cppcheck on all files (another static analysis)
  • External
    • update - update all external sources/projects

CMAKE variables

  • -DCMAKE_INSTALL_PREFIX - location for installation
  • -DVERSION_HOST - build machine name, see version.h.in
  • -DCMAKE_BUILD_TYPE - for build type
  • -DMEASURE_ALL=ON/OFF - Measure time of all compilations, best used with single threaded build. Needs time command (unix).
  • -DUSE_GOLD_LINKER=ON/OFF - whether to link with Gold linker.

License

Copyright (c) 2019 Kracejic

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].