Giter Club home page Giter Club logo

pybind11_bazel's Introduction

Bazel extensions for pybind11

Provided rules:

  • pybind_extension: Builds a python extension, automatically adding the required build flags and pybind11 dependencies. It defines a target which can be included as a data dependency of a py_* target.
  • 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.

To embed Python, add @rules_python//python/cc:current_py_cc_libs as a dependency to your cc_binary.

Installation

In your WORKSPACE file:

http_archive(
  name = "pybind11_bazel",
  strip_prefix = "pybind11_bazel-<version>",
  urls = ["https://github.com/pybind/pybind11_bazel/archive/v<version>.zip"],
)
# We still require the pybind library.
http_archive(
  name = "pybind11",
  build_file = "@pybind11_bazel//:pybind11-BUILD.bazel",
  strip_prefix = "pybind11-<version>",
  urls = ["https://github.com/pybind/pybind11/archive/v<version>.zip"],
)

Then, in your BUILD file:

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

Bzlmod

In your MODULE.bazel file:

bazel_dep(name = "pybind11_bazel", version = "<version>")

Usage in your BUILD file is as described previously.

pybind11_bazel's People

Contributors

junyer avatar rwgk avatar petebu avatar jblespiau avatar dapplegate avatar thebutlah avatar quval avatar stdbug avatar 8w9ag avatar virgile-hogman avatar rickeylev avatar sammymax avatar m-kerr avatar hofbi avatar kersson avatar kerrick-lyft avatar hzeller avatar dmadisetti avatar chriscummins avatar chuckx avatar apronchenkov 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.