Add build_defs.bzl, README, CONTRIBUTING.md
4 files changed
tree: c8842fd9e513e924584a1ab83b68e4f59fa999fc
  1. AUTHORS
  2. BUILD
  3. build_defs.bzl
  4. CONTRIBUTING.md
  5. LICENSE
  6. pybind11.BUILD
  7. README.md
README.md

Bazel extensions for pybind11

In your build file:

load("//third_party/pybind11_bazel:build_defs.bzl", "pybind_extension")

Provided rules:

  • pybind_extension: Builds a python extension, automatically adding the required build flags and pybind11 dependencies. It also defines a .so target which can be manually built and copied. The arguments match a py_extension.
  • pybind_library: Builds a C++ library, automatically adding the required build flags and pybind11 dependencies. This library can then be used as a dependency of a pybind_extension. The arguments match a cc_library.
  • pybind_library_test: Builds a C++ test for a pybind_library. The arguments match a cc_test.

To test a pybind_extension, the most common approach is to write the test in python and use the standard py_test build rule.