Github-CI:
| OS | Bazel | CMake |
|---|---|---|
| Linux | ||
| MacOS | ||
| MacOS | ||
| Windows | ||
| Docker |
Bazel C++ and pybind11 sample with tests and GitHub CI support.
This project should run on GNU/Linux, MacOS and Windows.
note: A CMake support is also provided as comparison
You'll need:
- "Bazel >= 7.0".
- "CMake >= 3.25".
The project layout is as follow:
- MODULE.bazel Top-level for Bazel based build.
- WORKSPACE Top-level for Bazel legacy based build.
- CMakeLists.txt Top-level for CMake based build.
- pure_lib Pure python library to check Bazel Python support.
- bp11 Python package name.
note: Due to a limitation of bazel and protoc directory layout must follow
the python module hierarchy (ed in CMake we create our python layout in the
${PROJECT_BINARY_DIR}/python so we don't have any constraint on the source
layout).
ref: protocolbuffers/protobuf#7061
To build this example you should use:
bazel build -c opt //...To build this example you should use:
bazel test -c opt --test_output=errors --nocache_test_results //...Please take a look at .github/workflows to find the configuration file for each jobs.
To install bazel on each hosted runner, follow these links: ref: https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-windows-runners
- Linux (Ubuntu latest LTS) ->
apt-get install bazel
ref: https://docs.bazel.build/versions/main/install-ubuntu.html
(as of 06/2021 Ubuntu 20.04 LTS is still not supported according to the doc...) - MacOS ->
brew install bazel
ref: https://formulae.brew.sh/formula/bazel#default - Windows ->
choco install bazel
ref: https://community.chocolatey.org/packages/bazel/
Few links on the subject...
Project layout:
Bazel:
CMake:
- https://llvm.org/docs/CMakePrimer.html
- https://cliutils.gitlab.io/modern-cmake/
- https://cgold.readthedocs.io/en/latest/
Python:
Image has been generated using plantuml:
plantuml -Tsvg docs/{file}.dotSo you can find the dot source files in docs.
Apache 2. See the LICENSE file for details.
This is not an official Google product, it is just code that happens to be owned by Google.