Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMake/vtkMacroKitPythonWrap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ macro(vtkMacroKitPythonWrap)
endif()

if(VTK_WRAP_PYTHON AND BUILD_SHARED_LIBS)
set(VTK_WRAP_PYTHON_FIND_LIBS 1)
include(vtkWrapPython)

set(TMP_WRAP_FILES ${MY_KIT_SRCS} ${MY_KIT_WRAP_HEADERS})
Expand Down Expand Up @@ -280,6 +281,7 @@ macro(vtkMacroKitPythonWrap)
${MY_KIT_NAME}PythonD
${MY_KIT_NAME}
${VTK_PYTHON_CORE}
${VTK_Python3_LIBRARIES}
${VTK_KIT_PYTHON_LIBRARIES}
${MY_KIT_PYTHON_LIBRARIES}
)
Expand Down Expand Up @@ -340,6 +342,7 @@ macro(vtkMacroKitPythonWrap)
target_link_libraries(${MY_KIT_NAME}Python
PRIVATE
${MY_KIT_NAME}
${VTK_Python3_LIBRARIES}
VTK::WrappingPythonCore
VTK::Python
)
Expand Down
13 changes: 12 additions & 1 deletion CMake/vtkWrapPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,18 @@ $<$<BOOL:$<TARGET_PROPERTY:${TARGET},INCLUDE_DIRECTORIES>>:
endmacro()

if(VTK_WRAP_PYTHON_FIND_LIBS)
find_package(Python3 COMPONENTS Development.Module REQUIRED)
# Development.Module leaves the Python C-API symbols undefined for the host
# interpreter to provide. That is fine where the linker allows undefined
# symbols (macOS -undefined dynamic_lookup), but on Linux the wrapped modules
# link with -Wl,--no-undefined and must resolve the Python symbols at link
# time, so the full library (Python3::Python) is required there.
if(VTK_UNDEFINED_SYMBOLS_ALLOWED)
find_package(Python3 COMPONENTS Development.Module REQUIRED)
set(VTK_Python3_LIBRARIES "")
else()
find_package(Python3 COMPONENTS Development REQUIRED)
set(VTK_Python3_LIBRARIES Python3::Python)
endif()
endif()

# Determine the location of the supplied header in the include_dirs supplied.
Expand Down
Loading