Skip to content

Commit

Permalink
[vtk]: Convert dependencies into default features (#40279)
Browse files Browse the repository at this point in the history
  • Loading branch information
DownerCase authored Aug 14, 2024
1 parent a4cfba0 commit 333ba63
Show file tree
Hide file tree
Showing 12 changed files with 232 additions and 40 deletions.
7 changes: 5 additions & 2 deletions ports/opencv3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencv3",
"version": "3.4.18",
"port-version": 15,
"port-version": 16,
"description": "Open Source Computer Vision Library",
"homepage": "https://github.com/opencv/opencv",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -300,7 +300,10 @@
"contrib"
]
},
"vtk"
{
"name": "vtk",
"default-features": false
}
]
},
"webp": {
Expand Down
7 changes: 5 additions & 2 deletions ports/opencv4/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencv4",
"version": "4.8.0",
"port-version": 21,
"port-version": 22,
"description": "computer vision library",
"homepage": "https://github.com/opencv/opencv",
"license": "Apache-2.0",
Expand Down Expand Up @@ -372,7 +372,10 @@
"contrib"
]
},
"vtk"
{
"name": "vtk",
"default-features": false
}
]
},
"vulkan": {
Expand Down
6 changes: 4 additions & 2 deletions ports/pcl/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "pcl",
"version": "1.14.1",
"port-version": 1,
"description": "Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing.",
"homepage": "https://github.com/PointCloudLibrary/pcl",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -55,8 +56,7 @@
"description": "CUDA support for PCL",
"supports": "x64",
"dependencies": [
"cuda",
"vtk"
"cuda"
]
},
"examples": {
Expand Down Expand Up @@ -115,6 +115,7 @@
"dependencies": [
{
"name": "vtk",
"default-features": false,
"features": [
"qt"
]
Expand Down Expand Up @@ -152,6 +153,7 @@
"dependencies": [
{
"name": "vtk",
"default-features": false,
"features": [
"opengl"
]
Expand Down
12 changes: 12 additions & 0 deletions ports/vtk/no-libharu-for-ioexport.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/IO/Export/vtk.module b/IO/Export/vtk.module
index 01b18a48..dcac24c0 100644
--- a/IO/Export/vtk.module
+++ b/IO/Export/vtk.module
@@ -36,7 +36,6 @@ PRIVATE_DEPENDS
VTK::IOGeometry
VTK::ImagingCore
VTK::nlohmannjson
- VTK::libharu
VTK::utf8
TEST_DEPENDS
VTK::ChartsCore
24 changes: 24 additions & 0 deletions ports/vtk/no-libproj-for-netcdf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/IO/NetCDF/vtk.module b/IO/NetCDF/vtk.module
index a0cc0741..07f3606b 100644
--- a/IO/NetCDF/vtk.module
+++ b/IO/NetCDF/vtk.module
@@ -26,7 +26,6 @@ PRIVATE_DEPENDS
VTK::CommonDataModel
VTK::netcdf
VTK::vtksys
- VTK::libproj
TEST_DEPENDS
VTK::CommonExecutionModel
VTK::FiltersGeometry
diff --git a/IO/NetCDF/vtkNetCDFCFWriter.cxx b/IO/NetCDF/vtkNetCDFCFWriter.cxx
index 756ff87..d71de89 100644
--- a/IO/NetCDF/vtkNetCDFCFWriter.cxx
+++ b/IO/NetCDF/vtkNetCDFCFWriter.cxx
@@ -33,7 +33,6 @@
#include <sstream>
#include <vector>

-#include "vtk_libproj.h"
#include "vtk_netcdf.h"

VTK_ABI_NAMESPACE_BEGIN
53 changes: 53 additions & 0 deletions ports/vtk/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ vcpkg_from_github(
remove-prefix-changes.patch
hdf5helper.patch
opencascade-7.8.0.patch
no-libharu-for-ioexport.patch
no-libproj-for-netcdf.patch
)

# =============================================================================
Expand Down Expand Up @@ -120,6 +122,38 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS VTK_FEATURE_OPTIONS
"gdal" VTK_MODULE_ENABLE_VTK_IOGDAL
"geojson" VTK_MODULE_ENABLE_VTK_IOGeoJSON
"ioocct" VTK_MODULE_ENABLE_VTK_IOOCCT
"libtheora" VTK_MODULE_ENABLE_VTK_IOOggTheora
"libharu" VTK_MODULE_ENABLE_VTK_IOExportPDF
"cgns" VTK_MODULE_ENABLE_VTK_IOCGNSReader
"seacas" VTK_MODULE_ENABLE_VTK_IOIOSS
"seacas" VTK_MODULE_ENABLE_VTK_IOExodus
"sql" VTK_MODULE_ENABLE_VTK_IOSQL
"proj" VTK_MODULE_ENABLE_VTK_IOCesium3DTiles
"proj" VTK_MODULE_ENABLE_VTK_GeovisCore
"netcdf" VTK_MODULE_ENABLE_VTK_IONetCDF
"netcdf" VTK_MODULE_ENABLE_VTK_IOMINC
)

# Require port features to prevent accidental finding of transitive dependencies
vcpkg_check_features(OUT_FEATURE_OPTIONS PACKAGE_FEATURE_OPTIONS
FEATURES
"libtheora" CMAKE_REQUIRE_FIND_PACKAGE_THEORA
"libharu" CMAKE_REQUIRE_FIND_PACKAGE_LibHaru
"cgns" CMAKE_REQUIRE_FIND_PACKAGE_CGNS
"seacas" CMAKE_REQUIRE_FIND_PACKAGE_SEACASIoss
"seacas" CMAKE_REQUIRE_FIND_PACKAGE_SEACASExodus
"sql" CMAKE_REQUIRE_FIND_PACKAGE_SQLite3
"proj" CMAKE_REQUIRE_FIND_PACKAGE_PROJ
"netcdf" CMAKE_REQUIRE_FIND_PACKAGE_NetCDF
INVERTED_FEATURES
"libtheora" CMAKE_DISABLE_FIND_PACKAGE_THEORA
"libharu" CMAKE_DISABLE_FIND_PACKAGE_LibHaru
"cgns" CMAKE_DISABLE_FIND_PACKAGE_CGNS
"seacas" CMAKE_DISABLE_FIND_PACKAGE_SEACASIoss
"seacas" CMAKE_DISABLE_FIND_PACKAGE_SEACASExodus
"sql" CMAKE_DISABLE_FIND_PACKAGE_SQLite3
"proj" CMAKE_DISABLE_FIND_PACKAGE_PROJ
"netcdf" CMAKE_DISABLE_FIND_PACKAGE_NetCDF
)

# Replace common value to vtk value
Expand Down Expand Up @@ -227,6 +261,7 @@ vcpkg_cmake_configure(
OPTIONS
${FEATURE_OPTIONS}
${VTK_FEATURE_OPTIONS}
${PACKAGE_FEATURE_OPTIONS}
-DBUILD_TESTING=OFF
-DVTK_BUILD_TESTING=OFF
-DVTK_BUILD_EXAMPLES=OFF
Expand Down Expand Up @@ -254,6 +289,24 @@ vcpkg_cmake_configure(
VTK_MODULE_ENABLE_VTK_GUISupportMFC # only windows
VTK_QT_VERSION # Only with Qt
CMAKE_INSTALL_QMLDIR
# When working properly these should be unused
CMAKE_DISABLE_FIND_PACKAGE_CGNS
CMAKE_DISABLE_FIND_PACKAGE_LibHaru
CMAKE_DISABLE_FIND_PACKAGE_NetCDF
CMAKE_DISABLE_FIND_PACKAGE_PROJ
CMAKE_DISABLE_FIND_PACKAGE_SEACASExodus
CMAKE_DISABLE_FIND_PACKAGE_SEACASIoss
CMAKE_DISABLE_FIND_PACKAGE_SQLite3
CMAKE_DISABLE_FIND_PACKAGE_THEORA
CMAKE_REQUIRE_FIND_PACKAGE_CGNS
CMAKE_REQUIRE_FIND_PACKAGE_LibHaru
CMAKE_REQUIRE_FIND_PACKAGE_NetCDF
CMAKE_REQUIRE_FIND_PACKAGE_PROJ
CMAKE_REQUIRE_FIND_PACKAGE_SEACASExodus
CMAKE_REQUIRE_FIND_PACKAGE_SEACASIoss
CMAKE_REQUIRE_FIND_PACKAGE_SQLite3
CMAKE_REQUIRE_FIND_PACKAGE_THEORA

)

vcpkg_cmake_install()
Expand Down
Loading

0 comments on commit 333ba63

Please sign in to comment.