Skip to content
Advertisement

Bazel, how to add Python library built in C++ into Python Binary?

I have a C++ Library with Python Bindings built as follows, and a Python Binary that needs to import the libPerceptionPybind.so that is generated.

JavaScript

I see that the libPerceptionPybind.so has been generated in my bazel-bin/pybind folder. I tried to add PerceptionPybind to the deps as you can see, but it gives an error:

JavaScript

Advertisement

Answer

You can use the data field to have your dynamic library copied into the Python binary target folder:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement