diff options
author | Ryan Volz <ryan.volz@gmail.com> | 2021-01-08 15:43:41 -0500 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2021-01-14 04:08:21 -0800 |
commit | 51d3ad973292763a6fc0cf8e971faa3cf89029e9 (patch) | |
tree | ac7e74ccc60615b700f693241379dedd77abbd4e /gr-blocks/lib/add_blk_impl.cc | |
parent | 518dc7eda3a2575292dc67374cad62c887f83d12 (diff) |
cmake: python: Fix linking when runtime py interpreter != build time.
This fixes a segmentation fault with the Pybind11 bindings when trying
to load any Python module on OSX with a different interpreter than
was used at build time (relevant to at least conda and homebrew). This
fix was already in place for the prior Swig bindings, but the Pybind11
changes do not incorporate it since they link with ${PYTHON_LIBRARIES}
instead of the (fixed) Python::Python target.
For clearer separation and to adopt the approach used by the new-ish
(3.12) builtin CMake FindPython module, this commit creates a separate
Python::Module target to be used when creating a Python extension module
(which includes "-undefined" and "dynamic_lookup" for macOS instead of
linking directly to the Python library). The Python::Python target
that does link to the Python library is still necessary for use as a
PRIVATE target (e.g. for runtime and qtgui).
For future reference and a general description of best practices for
linking Python extension modules, see
https://blog.tim-smith.us/2015/09/python-extension-modules-os-x.
Signed-off-by: Ryan Volz <ryan.volz@gmail.com>
Diffstat (limited to 'gr-blocks/lib/add_blk_impl.cc')
0 files changed, 0 insertions, 0 deletions