[vtk] Add feature gdal and geojson, re-factory the feature select part (#20147)

* [vtk] Add feature gdal and geojson, re-factory the feature select part

* version stuff

* Fix feature option MPI

* Fix find and use gdal.

* version

* Handle some of the same parameters

* version
This commit is contained in:
Jack·Boos·Yu 2021-10-12 02:01:04 +08:00 committed by GitHub
parent 10e699ca7e
commit ac3853c74e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 176 additions and 131 deletions

39
ports/vtk/fix-gdal.patch Normal file
View File

@ -0,0 +1,39 @@
diff --git a/CMake/vtkInstallCMakePackage.cmake b/CMake/vtkInstallCMakePackage.cmake
index bcb2044..c87bb9c 100644
--- a/CMake/vtkInstallCMakePackage.cmake
+++ b/CMake/vtkInstallCMakePackage.cmake
@@ -113,7 +113,6 @@ set(vtk_cmake_patch_files
patches/3.18/FindPython/Support.cmake
patches/3.18/FindPython2.cmake
patches/3.18/FindPython3.cmake
- patches/99/FindGDAL.cmake
patches/99/FindHDF5.cmake
patches/99/FindJPEG.cmake
patches/99/FindLibArchive.cmake
diff --git a/Geovis/GDAL/CMakeLists.txt b/Geovis/GDAL/CMakeLists.txt
index dfd58f0..f46177f 100644
--- a/Geovis/GDAL/CMakeLists.txt
+++ b/Geovis/GDAL/CMakeLists.txt
@@ -9,4 +9,7 @@ vtk_module_add_module(VTK::GeovisGDAL
CLASSES ${classes})
vtk_module_link(VTK::GeovisGDAL
PRIVATE
- GDAL::GDAL)
+ ${GDAL_LIBRARIES})
+vtk_module_include(VTK::GeovisGDAL
+ PRIVATE
+ ${GDAL_INCLUDE_DIRS})
diff --git a/IO/GDAL/CMakeLists.txt b/IO/GDAL/CMakeLists.txt
index 0a1248a..621a060 100644
--- a/IO/GDAL/CMakeLists.txt
+++ b/IO/GDAL/CMakeLists.txt
@@ -9,4 +9,7 @@ vtk_module_add_module(VTK::IOGDAL
CLASSES ${classes})
vtk_module_link(VTK::IOGDAL
PRIVATE
- GDAL::GDAL)
+ ${GDAL_LIBRARIES})
+vtk_module_include(VTK::IOGDAL
+ PRIVATE
+ ${GDAL_INCLUDE_DIRS})
\ No newline at end of file

View File

@ -2,134 +2,8 @@ if(NOT VCPKG_TARGET_IS_WINDOWS)
message(WARNING "You will need to install Xorg dependencies to build vtk:\napt-get install libxt-dev\n")
endif()
# TODO:
# - add loguru as a dependency requires #8682
# =============================================================================
# Options:
# Collect CMake options for optional components
if("qt" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_GROUP_ENABLE_Qt=YES
-DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES
-DVTK_MODULE_ENABLE_VTK_GUISupportQtSQL=YES
-DVTK_MODULE_ENABLE_VTK_RenderingQt=YES
-DVTK_MODULE_ENABLE_VTK_ViewsQt=YES
)
endif()
if("atlmfc" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_GUISupportMFC=YES
)
endif()
if("vtkm" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_AcceleratorsVTKmCore=YES
-DVTK_MODULE_ENABLE_VTK_AcceleratorsVTKmDataModel=YES
-DVTK_MODULE_ENABLE_VTK_AcceleratorsVTKmFilters=YES
-DVTK_MODULE_ENABLE_VTK_vtkm=YES
)
endif()
if("python" IN_LIST FEATURES)
vcpkg_find_acquire_program(PYTHON3)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_WRAP_PYTHON=ON
-DVTK_PYTHON_VERSION=3
-DPython3_FIND_REGISTRY=NEVER
"-DPython3_EXECUTABLE:PATH=${PYTHON3}"
-DVTK_MODULE_ENABLE_VTK_Python=YES
-DVTK_MODULE_ENABLE_VTK_PythonContext2D=YES
-DVTK_MODULE_ENABLE_VTK_PythonInterpreter=YES
)
#VTK_PYTHON_SITE_PACKAGES_SUFFIX should be set to the install dir of the site-packages
endif()
if("paraview" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_FiltersParallelStatistics=YES
-DVTK_MODULE_ENABLE_VTK_IOParallelExodus=YES
-DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingParallel=YES
-DVTK_MODULE_ENABLE_VTK_RenderingVolumeAMR=YES
-DVTK_MODULE_ENABLE_VTK_IOXdmf2=YES
-DVTK_MODULE_ENABLE_VTK_IOH5part=YES
-DVTK_MODULE_ENABLE_VTK_IOParallelLSDyna=YES
-DVTK_MODULE_ENABLE_VTK_IOTRUCHAS=YES
-DVTK_MODULE_ENABLE_VTK_IOVPIC=YES
-DVTK_MODULE_ENABLE_VTK_RenderingLICOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingAnnotation=YES
-DVTK_MODULE_ENABLE_VTK_DomainsChemistry=YES
-DVTK_MODULE_ENABLE_VTK_DomainsChemistryOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_FiltersParallelDIY2=YES
)
if("python" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_RenderingMatplotlib=YES
)
endif()
endif()
if("mpi" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_GROUP_ENABLE_MPI=YES
-DVTK_USE_MPI=YES
)
endif()
if("mpi" IN_LIST FEATURES AND "python" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_USE_EXTERNAL_VTK_mpi4py=OFF
)
endif()
if("opengl" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_DomainsChemistryOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_ImagingOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingGL2PSOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingLICOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingVolumeOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_opengl=YES
)
endif()
if ("openvr" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_RenderingOpenVR=YES
)
endif()
if("cuda" IN_LIST FEATURES AND CMAKE_HOST_WIN32)
vcpkg_add_to_path("$ENV{CUDA_PATH}/bin")
endif()
if("utf8" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_UTF8
)
endif()
if("all" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_USE_TK=OFF # TCL/TK currently not included in vcpkg
)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"cuda" VTK_USE_CUDA
"all" VTK_BUILD_ALL_MODULES
)
# =============================================================================
# Clone & patch
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Kitware/VTK
@ -153,6 +27,7 @@ vcpkg_from_github(
1f00a0c9.patch
156fb524.patch
d107698a.patch
fix-gdal.patch
)
# =============================================================================
@ -160,17 +35,124 @@ vcpkg_from_github(
file(COPY "${CURRENT_PORT_DIR}/FindHDF5.cmake" DESTINATION "${SOURCE_PATH}/CMake/patches/99") # due to usage of targets in netcdf-c
# =============================================================================
# =============================================================================
# Options:
# Collect CMake options for optional components
# TODO:
# - add loguru as a dependency requires #8682
vcpkg_check_features(OUT_FEATURE_OPTIONS VTK_FEATURE_OPTIONS
FEATURES
"qt" VTK_GROUP_ENABLE_Qt
"qt" VTK_MODULE_ENABLE_VTK_GUISupportQt
"qt" VTK_MODULE_ENABLE_VTK_GUISupportQtSQL
"qt" VTK_MODULE_ENABLE_VTK_RenderingQt
"qt" VTK_MODULE_ENABLE_VTK_ViewsQt
"atlmfc" VTK_MODULE_ENABLE_VTK_GUISupportMFC
"vtkm" VTK_MODULE_ENABLE_VTK_AcceleratorsVTKmCore
"vtkm" VTK_MODULE_ENABLE_VTK_AcceleratorsVTKmDataModel
"vtkm" VTK_MODULE_ENABLE_VTK_AcceleratorsVTKmFilters
"vtkm" VTK_MODULE_ENABLE_VTK_vtkm
"python" VTK_MODULE_ENABLE_VTK_Python
"python" VTK_MODULE_ENABLE_VTK_PythonContext2D
"python" VTK_MODULE_ENABLE_VTK_PythonInterpreter
"paraview" VTK_MODULE_ENABLE_VTK_FiltersParallelStatistics
"paraview" VTK_MODULE_ENABLE_VTK_IOParallelExodus
"paraview" VTK_MODULE_ENABLE_VTK_RenderingParallel
"paraview" VTK_MODULE_ENABLE_VTK_RenderingVolumeAMR
"paraview" VTK_MODULE_ENABLE_VTK_IOXdmf2
"paraview" VTK_MODULE_ENABLE_VTK_IOH5part
"paraview" VTK_MODULE_ENABLE_VTK_IOParallelLSDyna
"paraview" VTK_MODULE_ENABLE_VTK_IOTRUCHAS
"paraview" VTK_MODULE_ENABLE_VTK_IOVPIC
"paraview" VTK_MODULE_ENABLE_VTK_RenderingAnnotation
"paraview" VTK_MODULE_ENABLE_VTK_DomainsChemistry
"paraview" VTK_MODULE_ENABLE_VTK_FiltersParallelDIY2
"mpi" VTK_GROUP_ENABLE_MPI
"opengl" VTK_MODULE_ENABLE_VTK_ImagingOpenGL2
"opengl" VTK_MODULE_ENABLE_VTK_RenderingGL2PSOpenGL2
"opengl" VTK_MODULE_ENABLE_VTK_RenderingOpenGL2
"opengl" VTK_MODULE_ENABLE_VTK_RenderingVolumeOpenGL2
"opengl" VTK_MODULE_ENABLE_VTK_opengl
"openvr" VTK_MODULE_ENABLE_VTK_RenderingOpenVR
"gdal" VTK_MODULE_ENABLE_VTK_IOGDAL
"geojson" VTK_MODULE_ENABLE_VTK_IOGeoJSON
)
# Replace common value to vtk value
list(TRANSFORM VTK_FEATURE_OPTIONS REPLACE "=ON" "=YES")
list(TRANSFORM VTK_FEATURE_OPTIONS REPLACE "=OFF" "=DONT_WANT")
if("python" IN_LIST FEATURES)
vcpkg_find_acquire_program(PYTHON3)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_WRAP_PYTHON=ON
-DVTK_PYTHON_VERSION=3
-DPython3_FIND_REGISTRY=NEVER
"-DPython3_EXECUTABLE:PATH=${PYTHON3}"
)
#VTK_PYTHON_SITE_PACKAGES_SUFFIX should be set to the install dir of the site-packages
endif()
if ("paraview" IN_LIST FEATURES OR "opengl" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_RenderingLICOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_DomainsChemistryOpenGL2=YES
)
endif()
if("paraview" IN_LIST FEATURES AND "python" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_ENABLE_VTK_RenderingMatplotlib=YES
)
endif()
if("mpi" IN_LIST FEATURES AND "python" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_MODULE_USE_EXTERNAL_VTK_mpi4py=OFF
)
endif()
if("cuda" IN_LIST FEATURES AND CMAKE_HOST_WIN32)
vcpkg_add_to_path("$ENV{CUDA_PATH}/bin")
endif()
if("utf8" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_UTF8
)
endif()
if("all" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_USE_TK=OFF # TCL/TK currently not included in vcpkg
-DVTK_FORBID_DOWNLOADS=OFF
)
else()
list(APPEND ADDITIONAL_OPTIONS
-DVTK_FORBID_DOWNLOADS=ON
)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"cuda" VTK_USE_CUDA
"mpi" VTK_USE_MPI
"all" VTK_BUILD_ALL_MODULES
)
# =============================================================================
# Configure & Install
# We set all libraries to "system" and explicitly list the ones that should use embedded copies
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS ${FEATURE_OPTIONS}
OPTIONS
${FEATURE_OPTIONS}
${VTK_FEATURE_OPTIONS}
-DBUILD_TESTING=OFF
-DVTK_BUILD_TESTING=OFF
-DVTK_BUILD_EXAMPLES=OFF
-DVTK_FORBID_DOWNLOADS=ON
-DVTK_ENABLE_REMOTE_MODULES=OFF
# VTK groups to enable
-DVTK_GROUP_ENABLE_StandAlone=YES
@ -182,6 +164,8 @@ vcpkg_cmake_configure(
-DVTK_USE_EXTERNAL:BOOL=ON
-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps:BOOL=OFF # Not yet in VCPKG
${ADDITIONAL_OPTIONS}
-DVTK_DEBUG_MODULE_ALL=ON
-DVTK_DEBUG_MODULE=ON
)
vcpkg_cmake_install()

View File

@ -1,7 +1,7 @@
{
"name": "vtk",
"version-semver": "9.0.3-pv5.9.1",
"port-version": 2,
"port-version": 3,
"description": "Software system for 3D computer graphics, image processing, and visualization",
"homepage": "https://github.com/Kitware/VTK",
"dependencies": [
@ -50,12 +50,13 @@
"description": "Build all vtk modules",
"dependencies": [
"ffmpeg",
"gdal",
"libmysql",
{
"name": "vtk",
"default-features": false,
"features": [
"gdal",
"geojson",
"mpi",
"python",
"qt"
@ -87,6 +88,22 @@
"cuda"
]
},
"gdal": {
"description": "Support GDAL compilation",
"dependencies": [
"gdal",
{
"name": "vtk",
"default-features": false,
"features": [
"mpi"
]
}
]
},
"geojson": {
"description": "Convert Geo JSON format to vtkPolyData"
},
"mpi": {
"description": "MPI functionality for VTK",
"dependencies": [

View File

@ -6966,7 +6966,7 @@
},
"vtk": {
"baseline": "9.0.3-pv5.9.1",
"port-version": 2
"port-version": 3
},
"vtk-dicom": {
"baseline": "0.8.12",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1b201a8e060b6c2688ccc2e96cae175f2d8af205",
"version-semver": "9.0.3-pv5.9.1",
"port-version": 3
},
{
"git-tree": "5e50a05b2ff0cc2f4df601ddb146c75a2f266a6a",
"version-semver": "9.0.3-pv5.9.1",