loading...

pybind11-cmake: Straightforward boilerplate generation for pybind11 + cmake

safijari profile image Jariullah Safi ・1 min read

pybind11 is great for making python wrappers of C++ code and I use it all the time. In most cases I need to work with a cmake file so I start the project off using their cmake example. This usually involves copying the CMakeExtension / Builder class to my setup.py file and adding pybind11 to my project as a git submodule. I could do without cmake in simpler projects as shown in the python_example but I find it difficult to use for more complicated projects.

So I made a boilerplate generator (https://github.com/safijari/pybind11-cmake) that also encapsulates the extension module and provides a script to generate all the files you would need to get started with a project. This allows you to work on a pybind11 project purely in a virtualenv using cmake (no need to make a git submodule).

I've already simplified my existing projects with this and hope it is useful to others as well.

Posted on by:

Discussion

markdown guide