Series
- Part 1: Interfacing C++ and Python with pybind11 on windows 10
- Part 2: Interfacing C++ and Python with pybind11 on ubuntu 16.04
Guide
requirements:
- pybind11 v2.3.dev0
- python 3.5
install pytest
1 | pip3 install pytest |
compile
1 | git clone https://github.com/pybind/pybind11.git |
with options
PYBIND11_CPP_STANDARD /std:c++11 # default c++14
PYTHON_EXECUTABLE /usr/bin/python3.5
CMAKE_INSTALL_PREFIX /usr/local
install
make and install
1 | make -j8 |
install to
/usr/local/include/pybind11
with onlyinclude
and/usr/local/share/cmake/pybind11
output
Install the project...
-- Install configuration: "MinSizeRel"
-- Installing: /usr/local/include/pybind11
-- Installing: /usr/local/include/pybind11/chrono.h
-- Installing: /usr/local/include/pybind11/eigen.h
-- Installing: /usr/local/include/pybind11/stl.h
-- Installing: /usr/local/include/pybind11/complex.h
-- Installing: /usr/local/include/pybind11/detail
-- Installing: /usr/local/include/pybind11/detail/internals.h
-- Installing: /usr/local/include/pybind11/detail/common.h
-- Installing: /usr/local/include/pybind11/detail/descr.h
-- Installing: /usr/local/include/pybind11/detail/init.h
-- Installing: /usr/local/include/pybind11/detail/class.h
-- Installing: /usr/local/include/pybind11/detail/typeid.h
-- Installing: /usr/local/include/pybind11/common.h
-- Installing: /usr/local/include/pybind11/iostream.h
-- Installing: /usr/local/include/pybind11/buffer_info.h
-- Installing: /usr/local/include/pybind11/attr.h
-- Installing: /usr/local/include/pybind11/numpy.h
-- Installing: /usr/local/include/pybind11/pybind11.h
-- Installing: /usr/local/include/pybind11/operators.h
-- Installing: /usr/local/include/pybind11/options.h
-- Installing: /usr/local/include/pybind11/cast.h
-- Installing: /usr/local/include/pybind11/eval.h
-- Installing: /usr/local/include/pybind11/embed.h
-- Installing: /usr/local/include/pybind11/pytypes.h
-- Installing: /usr/local/include/pybind11/functional.h
-- Installing: /usr/local/include/pybind11/stl_bind.h
-- Installing: /usr/local/share/cmake/pybind11/pybind11Config.cmake
-- Installing: /usr/local/share/cmake/pybind11/pybind11ConfigVersion.cmake
-- Installing: /usr/local/share/cmake/pybind11/FindPythonLibsNew.cmake
-- Installing: /usr/local/share/cmake/pybind11/pybind11Tools.cmake
-- Installing: /usr/local/share/cmake/pybind11/pybind11Targets.cmake
Usage
pybind11
CMakeLists.txt
1 | find_package(pybind11 CONFIG REQUIRED) |
embed
CMakeLists.txt
1 | find_package(pybind11 CONFIG REQUIRED) |
Reference
History
- 20181127: created.