Giter Club home page Giter Club logo

modern-cpp-bazel-starter's Introduction

Modern C++ with Bazel starter template

Introduction

This is a starter template for a multi lib, multi app project born out of my needs. This template is based on my other starter project modern-cpp-cmake-starter, but uses Bazel as the build system.

Guiding Principles

Repository Structure

  • As far as possible, all directories are self contained
  • Executables are in the “apps” directory, one directory per app
  • Libraries are in “libs” directory, one directory per library
  • Every app or library directory has one or all of directories viz. “include”, “src”, “tests”
  • Each namespace gets own directory inside the above three

Build System

  • Bazel is primary build system(version 6.0)
  • External dependencies are managed via WORKSPACE, bazel module to be added later

How to use this template

  1. Use the “Use this template” button on github to create a new repository with all the content of this starter, modify according to your needs.
  2. Clone this repo locally and remove/change the remote

Building with Bazel

# build everything
 bazel build //...
# build specific target
 bazel build //path/to/pkg:target
# analyse with clang tidy
bazel build --config clang-tidy //...
# analyse IWYU (Include What You Use)
bazel build --config=iwyu //path/to/pkg:target
# run codecoverage for tests (e.g. greeter tests)
 bazel coverage --combined_report=lcov [target].
# open the code coverage report
 genhtml --output genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat"

References

modern-cpp-bazel-starter's People

Contributors

amolgawai avatar

Stargazers

Keenan Johnson avatar

Watchers

 avatar

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.