I am trying to build my own custom (minimal) wheel of VTK. However, I am seeing that the VTK libraries (i.e. libvtkCommonCore.so
, etc.) are not getting included in wheel package. The .so
s for the Python module are included. What am I missing?
cmake_minimum_required(VERSION 3.14)
project(BuildVTKWheel)
include(ExternalProject)
find_package(Python3 COMPONENTS Interpreter REQUIRED)
# Specify the VTK version and download URL
set(VTK_VERSION "9.4")
set(VTK_VERSION_PATCH "2")
set(VTK_URL "https://vtk.org/files/release/${VTK_VERSION}/VTK-${VTK_VERSION}.${VTK_VERSION_PATCH}.tar.gz")
ExternalProject_Add(VTK
URL ${VTK_URL}
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
PREFIX ${CMAKE_BINARY_DIR}/vtk
BUILD_IN_SOURCE OFF
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/vtk/install
-DCMAKE_BUILD_TYPE=Release
-DPython3_EXECUTABLE=${Python3_EXECUTABLE}
# Enable Python wrapping
-DVTK_WRAP_PYTHON=ON
-DVTK_WHEEL_BUILD=ON
-DVTK_INSTALL_SDK=ON
-DVTK_VERSION_SUFFIX="custom"
-DVTK_ENABLE_REMOTE_MODULES=OFF
-DVTK_BUILD_PYI_FILES=ON
# Disable all modules by default, then explicitly enable the ones you need:
-DVTK_BUILD_ALL_MODULES:BOOL=OFF
-DVTK_GROUP_ENABLE_Imaging:BOOL=DONT_WANT
-DVTK_GROUP_ENABLE_Views:BOOL=NO
-DVTK_GROUP_ENABLE_Web:BOOL=NO
-DVTK_GROUP_ENABLE_Qt:BOOL=NO
-DVTK_GROUP_ENABLE_Rendering:BOOL=NO
-DVTK_GROUP_ENABLE_StandAlone:BOOL=DONT_WANT
# Enable specific VTK modules
-DVTK_MODULE_ENABLE_VTK_IOXML:STRING=YES
-DVTK_MODULE_ENABLE_VTK_IOLegacy=YES
-DVTK_MODULE_ENABLE_VTK_FiltersGeometry=YES
-DVTK_MODULE_ENABLE_VTK_FiltersFlowPaths=YES
# BUILD_COMMAND ${CMAKE_COMMAND} --build .
INSTALL_COMMAND
${Python3_EXECUTABLE} setup.py bdist_wheel
)
# Optional: create a "build all" target that depends on VTK
add_custom_target(build-vtk-wheel ALL
DEPENDS VTK
COMMENT "Downloading, building, installing VTK, and packaging Python wheel"
)
I am seeing this CMake warning too, not sure if it’s relevant:
CMake Warning (dev) at CMake/vtkWheelPreparation.cmake:42 (message):
Platform build directory warning: mismatch with manual computation:
"build/lib.linux-x86_64-cpython-310" vs. "build/lib.linux-x86_64-3.10"