mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 08:32:02 +00:00
minor FAQ edits, referenced cppimport project
This commit is contained in:
parent
d1bfc4e0f8
commit
a439ccaa0e
@ -11,6 +11,16 @@ the [pbtest]_ repository.
|
|||||||
|
|
||||||
.. [pbtest] https://github.com/pybind/pbtest
|
.. [pbtest] https://github.com/pybind/pbtest
|
||||||
|
|
||||||
|
Building with cppimport
|
||||||
|
========================
|
||||||
|
|
||||||
|
cppimport is a small Python import hook that determines whether there is a C++
|
||||||
|
source file whose name matches the requested module. If there is, the file is
|
||||||
|
compiled as a Python extension using pybind11 and placed in the same folder as
|
||||||
|
the C++ source file. Python is then able to find the module and load it.
|
||||||
|
|
||||||
|
.. [cppimport] https://github.com/tbenthompson/cppimport
|
||||||
|
|
||||||
.. _cmake:
|
.. _cmake:
|
||||||
|
|
||||||
Building with CMake
|
Building with CMake
|
37
docs/faq.rst
37
docs/faq.rst
@ -24,6 +24,25 @@ The Python interpreter immediately crashes when importing my module
|
|||||||
|
|
||||||
See item 2 of the first answer.
|
See item 2 of the first answer.
|
||||||
|
|
||||||
|
CMake doesn't detect the right Python version, or it finds mismatched interpreter and library versions
|
||||||
|
======================================================================================================
|
||||||
|
|
||||||
|
The Python detection logic of CMake is flawed and can sometimes fail to find
|
||||||
|
the desired Python version, or it chooses mismatched interpreter and library
|
||||||
|
versions. A longer discussion is available on the pybind11 issue tracker
|
||||||
|
[#f1]_, though this is ultimately not a pybind11 issue.
|
||||||
|
|
||||||
|
To force the build system to choose a particular version, delete CMakeCache.txt
|
||||||
|
and then invoke CMake as follows:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cmake -DPYTHON_EXECUTABLE:FILEPATH=<...> \
|
||||||
|
-DPYTHON_LIBRARY:FILEPATH=<...> \
|
||||||
|
-DPYTHON_INCLUDE_DIR:PATH=<...> .
|
||||||
|
|
||||||
|
.. [#f1] http://github.com/pybind/pybind11/issues/99
|
||||||
|
|
||||||
Limitations involving reference arguments
|
Limitations involving reference arguments
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
@ -72,24 +91,6 @@ and the binding code
|
|||||||
|
|
||||||
m.def("foo", [](int i) { int rv = foo(i); return std::make_tuple(rv, i); });
|
m.def("foo", [](int i) { int rv = foo(i); return std::make_tuple(rv, i); });
|
||||||
|
|
||||||
CMake doesn't detect the right Python version, or it finds mismatched interpreter and library versions
|
|
||||||
======================================================================================================
|
|
||||||
|
|
||||||
The Python detection logic of CMake is flawed and can sometimes fail to find
|
|
||||||
the desired Python version, or it chooses mismatched interpreter and library
|
|
||||||
versions. A longer discussion is available on the pybind11 issue tracker
|
|
||||||
[#f1]_, though this is ultimately not a pybind11 issue.
|
|
||||||
|
|
||||||
To force the build system to choose a particular version, delete CMakeCache.txt
|
|
||||||
and then invoke CMake as follows:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
cmake -DPYTHON_EXECUTABLE:FILEPATH=<...> \
|
|
||||||
-DPYTHON_LIBRARY:FILEPATH=<...> \
|
|
||||||
-DPYTHON_INCLUDE_DIR:PATH=<...> .
|
|
||||||
|
|
||||||
.. [#f1] http://github.com/pybind/pybind11/issues/99
|
|
||||||
|
|
||||||
How can I reduce the build time?
|
How can I reduce the build time?
|
||||||
================================
|
================================
|
||||||
|
@ -16,7 +16,7 @@ pybind11 --- Seamless operability between C++11 and Python
|
|||||||
basics
|
basics
|
||||||
classes
|
classes
|
||||||
advanced
|
advanced
|
||||||
cmake
|
compiling
|
||||||
benchmark
|
benchmark
|
||||||
limitations
|
limitations
|
||||||
faq
|
faq
|
||||||
|
Loading…
Reference in New Issue
Block a user