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.
- Host: GitHub
- URL: https://github.com/andrenbrandao/bazel-cpp-boilerplate
- Owner: andrenbrandao
- License: mit
- Created: 2024-08-03T13:36:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-04T17:18:31.000Z (almost 2 years ago)
- Last Synced: 2025-07-07T19:45:29.183Z (about 1 year ago)
- Topics: bazel, build-tool, cpp
- Language: Starlark
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.