Skip to content

A cmake starter project for c++ with basic infrastructure including logging, assertions, platform specifics, and a complete build lifecycle. Portable across Linux, OS X and Windows.

License

asap-projects/asap-app

 
 

Repository files navigation

Starter project for C++ with cmake

Start Now!!

Linux Build (Ubuntu latest) Windows Build (latest)

Overview

  • cmake as the build system with or without presets
  • cross-platform portability on Linux, OS X and Windows
  • multiple compilers: clang, g++ and MSVC
  • modular structure with each module self-contained in a subdirectory within the project
  • build helpers in common/cmake to facilitate declaration of library, exe, test modules, for the end-to-end lifecycle including doc generation, test, packaging etc...
  • common facilities (common module) for platform specifics, assertions support, logging
  • unit testing with Google Test
  • code coverage with clang or g++
  • zero-touch valgrind, clang-tidy, clang-format, google sanitizers, etc.

Development can be done locally or in a dev container with vscode.

Getting the code

git clone --recurse-submodules -j4 https://github.com/abdes/asap.git

NOTES:

  • -j4 requests git to parallelize cloning of repos. Needs a relatively recent version of git. If that is not available, simply do not use this option.

Requirements

Make sure you have a C++ compiler with C++-14 capabilities at least. Gnu, Clang and MSVC all can do that with a recent version.

Enabling husky/commitlint/standard-version

Only one time after the project is cloned, do the following:

npx husky install
npm install -g @commitlint/cli @commitlint/config-conventional
npm install -g standard-version

Building

mkdir _build && cd _build && cmake .. && cmake --build .

You can also use any of the cmake options, generators, etc...

By default the build will create shared libraries. If you want static libraries, pass -DBUILD_SHARED_LIBS=OFF to cmake during configuration:

cmake -DBUILD_SHARED_LIBS=OFF ..

You can also use any of the cmake options, generators, etc...

# Project options
option(BUILD_SHARED_LIBS        "Build shared instead of static libraries."              ON)
option(OPTION_SELF_CONTAINED    "Create a self-contained install with all dependencies." OFF)
option(OPTION_BUILD_TESTS       "Build tests."                                           ON)
option(OPTION_BUILD_DOCS        "Build documentation."                                   OFF)
option(OPTION_BUILD_EXAMPLES    "Build examples."                                        OFF)
option(ASAP_WITH_GOOGLE_ASAN    "Instrument code with address sanitizer"                 OFF)
option(ASAP_WITH_GOOGLE_UBSAN   "Instrument code with undefined behavior sanitizer"      OFF)
option(ASAP_WITH_GOOGLE_TSAN    "Instrument code with thread sanitizer"                  OFF)
option(ASAP_WITH_VALGRIND    "Builds targets with valgrind profilers added"              OFF)

About

A cmake starter project for c++ with basic infrastructure including logging, assertions, platform specifics, and a complete build lifecycle. Portable across Linux, OS X and Windows.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 30.1%
  • C++ 28.5%
  • CMake 28.1%
  • C 8.0%
  • HTML 1.9%
  • Dockerfile 1.3%
  • Other 2.1%