ppetraki / cpp-skeleton-project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cpp skeleton project

A complete cmake project which includes gtest driven unit tests plus a highly customized vim configuration, including YCM for code completion and clang-format.

Tested on Ubuntu 16.04 and 18.04.

Bootstrap environment

This takes about 5 minutes, which is mostly due to building YCM from source. This installs everything you need to build, editor, and code coverage support.

./bootstrap.sh

Project Setup

Configure cmake project in Debug mode using Ninja. Optimizations are completely disabled in Debug mode so when you switch to GDB you can actually find things.

make setup-debug

build

make build-debug

and you can do the same thing for release mode.

test

Compile everything, run the sample unit tests via ctest.

make test-debug

code coverage

Just like before but...

make test-coverage

Every target created with the AddCxxExecutable wrapper automatically creates a gcov target with the name ${TARGET}_coverage. It also selects Debug mode for you.

TODO

  • refactor makefile with template functions so we can support debug/release/coverage targets with less boilerplate
  • create a add_test wrapper that adds the _coverage target to ctest

About


Languages

Language:C++ 84.5%Language:Python 11.5%Language:CMake 1.4%Language:Shell 0.7%Language:Makefile 0.7%Language:M4 0.6%Language:C 0.4%Language:Vim Script 0.2%