[vtk-developers] python wrapping with VTK 7
Schuyler Kylstra
schuyler.kylstra at kitware.com
Tue Mar 29 11:23:45 EDT 2016
Hi devs,
I'm working on a VTK 7 based project that I'm trying to wrap in python. I'm
stuck at a point where the project builds but the python library cannot be
included. I'm doing the following in my CMakeLists.txt file:
SET(SRCS
....
)
SET_SOURCE_FILES_PROPERTIES(
<subset of SRCS>
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
SET(VTK_LIBRARIES
<vtk libraries>
)
SET(KIT_PYTHON_LIBRARIES ${VTK_LIBRARIES})
SET(LIBRARY_MODE "SHARED")
INCLUDE(${VTK_CMAKE_DIR}/vtkWrapPython.cmake)
VTK_WRAP_PYTHON3(${LIB_NAME}Python PYTHON_SRCS "${SRCS}")
ADD_LIBRARY(${LIB_NAME}PythonD ${LIBRARY_MODE} ${PYTHON_SRCS})
ADD_LIBRARY(${LIB_NAME}Python MODULE ${LIB_NAME}PythonInit.cxx)
TARGET_LINK_LIBRARIES(${LIB_NAME}PythonD ${LIB_NAME})
FOREACH(c ${KIT_PYTHON_LIBRARIES})
TARGET_LINK_LIBRARIES(${LIB_NAME}PythonD ${c}PythonD)
ENDFOREACH(c)
TARGET_LINK_LIBRARIES(${LIB_NAME}Python ${LIB_NAME}PythonD)
As I said before, this all builds without error but when I try to run any
python script that includes the library I get the following error:
ImportError: dynamic module does not define init function
Is there something I need to add to ensure that the init function is
created?
--
Schuyler Kylstra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160329/df22cc21/attachment.html>
More information about the vtk-developers
mailing list