Hi supporters
Just started a larger project based on the VTK pipeline and in relation to this I am creating a number of modules, which could potentially be future remote modules of VTK. I looked into how vtk-dicom was made - but ignored any stuff related to VTK prior to 9.0.
I use CMake and the new vtk_module_build and vtk_module_wrap macros. Under Linux, it works flawlessly and after adding VTK::CommonExecutionModel to the DEPENDS in my module file, the functions GetOutput
and GetOutputPort
was added to the wrapper of module deriving from vtkPolyDataAlgorithm. For the Windows build, the functions never appear in the Python wrappers.
Module file
NAME
VTK::PCR
LIBRARY_NAME
vtkPCR
GROUPS
StandAlone
DEPENDS
VTK::CommonCore
VTK::CommonMath
VTK::CommonTransforms
VTK::CommonDataModel
VTK::CommonExecutionModel
PRIVATE_DEPENDS
VTK::CommonMisc
VTK::CommonSystem
VTK::FiltersCore
VTK::FiltersSources
VTK::vtksys
TEST_DEPENDS
VTK::TestingCore
CMakeLists.txt in top folder (the relevant part)
vtk_module_scan(
MODULE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Source/pcr.module" # What is scanned
REQUEST_MODULES "VTK::PCR" # What is searched for
PROVIDES_MODULES pcr_modules
ENABLE_TESTS "${BUILD_TESTING}")
vtk_module_build(
MODULES ${pcr_modules}
INSTALL_EXPORT PCR
ARCHIVE_DESTINATION "lib"
HEADERS_DESTINATION "include/pcr${PCR_SHORT_VERSION}"
CMAKE_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/vtk"
LICENSE_DESTINATION "${CMAKE_INSTALL_LIBDIR}/vtk"
HIERARCHY_DESTINATION "${CMAKE_INSTALL_LIBDIR}/vtk/hierarchy/${CMAKE_PROJECT_NAME}"
LIBRARY_NAME_SUFFIX "${PCR_CUSTOM_LIBRARY_SUFFIX}"
VERSION "${PCR_VERSION}"
SOVERSION "1")
vtk_module_wrap_python(
MODULES ${pcr_modules}
INSTALL_EXPORT PCRPython
PYTHON_PACKAGE "vtk.modules"
CMAKE_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/vtk"
LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
BUILD_STATIC OFF) # Python module is always dynamic built
CMakeLists.txt in the source folder
# When building as a module for VTK 8.90 or later
vtk_module_add_module(VTK::PCR
CLASSES ${classes})
vtk_module_link(VTK::PCR
PRIVATE
VTK::CommonDataModel)
Thanks in advance
Jens Munk