Created
February 9, 2018 20:10
-
-
Save jrk/acfc1630b2e5a6805b074fe305270c16 to your computer and use it in GitHub Desktop.
Trivial PyBind11 test module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pybind11/pybind11.h> | |
PYBIND11_MODULE(foobar, m) { | |
m.doc() = "pybind11 example plugin"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PYBIND11_INCLUDE ?= # -Ipath/to/pybind/include if not in other paths | |
PREFIX ?= $(shell python3-config --prefix) | |
INCLUDES = ${PYBIND11_INCLUDE} -I${PREFIX}/include/python3.6m -I${PREFIX}/include | |
CFLAGS = -std=c++11 ${INCLUDES} | |
LDFLAGS = -arch x86_64 -L${PREFIX}/lib -lpython3.6m -ldl | |
foobar.so: foobar.cpp | |
c++ ${CFLAGS} ${LDFLAGS} foobar.cpp -shared -o foobar.so | |
clean: | |
rm -f foobar.so | |
test: foobar.so | |
${PREFIX}/bin/python3.6m -c 'import foobar' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment