An open API service indexing awesome lists of open source software.

https://github.com/andrenbrandao/bazel-cpp-boilerplate

Bazel boilerplate with C++ and GoogleTest.
https://github.com/andrenbrandao/bazel-cpp-boilerplate

bazel build-tool cpp

Last synced: 3 months ago
JSON representation

Bazel boilerplate with C++ and GoogleTest.

Awesome Lists containing this project

README

          

# bazel-cpp-boilerplate

Bazel boilerplate with C++ and GoogleTest.

## How to build and run

First, make sure you have [Bazel](https://bazel.build/install) installed.

```bash
bazel build :all
```

```bash
bazel run :hello_main
```

## Running the tests

```bash
bazel test --test_output=all :all
```

## Autocomplete with Neovim

Because we are using Bazel, `clangd` autocomplete in Neovim doesn't know where to find the headers. To fix it, I'm using [Hedron's Compile Commands Extractor for Bazel](https://github.com/hedronvision/bazel-compile-commands-extractor).

Execute the following command to fix autocomplete when new dependencies are installed:

```
bazel run @hedron_compile_commands//:refresh_all
```

## Resources

- [Bazel](https://bazel.build/) as the build tool.
- [Google Test](https://google.github.io/googletest/) for testing.
- [Abseil](https://abseil.io/) as an opensource collection of C++ libraries.
- [Bazel Compile Commands Extractor](https://github.com/hedronvision/bazel-compile-commands-extractor) to support autocompletion in Neovim and IDEs.