Skip to content

Instantly share code, notes, and snippets.

View ossareh's full-sized avatar

P. Michael Ossareh ossareh

View GitHub Profile
@ossareh
ossareh / CMakeLists.txt
Created July 21, 2020 16:29 — forked from hovren/CMakeLists.txt
pybind11 with CMake and setup.py
# Build a Python extension module using pybind11
# pybindings_add_module(<module>)
# Here <module> should be the fully qualified name for the module,
# e.g. pybindings_add_module(foo.bar._baz)
# <module> becomes the target name in case you wish to do something to it later
# The source for the binding *must* be placed in src/pybindings/{relpath}/py{name}.cc
# E.g. for module=foo.bar._baz -> src/pybindings/bar/py_baz.cc
function(pybindings_add_module module)
set(target_name ${module})
string(REPLACE "." "/" modpath ${module})