From fc5118086f5db341ee4ab3a7d4d64c0f39896270 Mon Sep 17 00:00:00 2001 From: jim wang <122244446+jimwang118@users.noreply.github.com> Date: Fri, 24 Jan 2025 17:12:14 +0800 Subject: [PATCH] [vtk] add feature (#43328) --- ports/vtk/fix-tbbsmptool.patch | 15 +++++++++++++++ ports/vtk/portfile.cmake | 15 +++++++++++++++ ports/vtk/vcpkg.json | 11 ++++++++++- versions/baseline.json | 2 +- versions/v-/vtk.json | 5 +++++ 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 ports/vtk/fix-tbbsmptool.patch diff --git a/ports/vtk/fix-tbbsmptool.patch b/ports/vtk/fix-tbbsmptool.patch new file mode 100644 index 0000000000..a7a3ce08a5 --- /dev/null +++ b/ports/vtk/fix-tbbsmptool.patch @@ -0,0 +1,15 @@ +diff --git a/Common/Core/SMP/TBB/vtkSMPToolsImpl.txx b/Common/Core/SMP/TBB/vtkSMPToolsImpl.txx +index e5792ee..e81d5ed 100644 +--- a/Common/Core/SMP/TBB/vtkSMPToolsImpl.txx ++++ b/Common/Core/SMP/TBB/vtkSMPToolsImpl.txx +@@ -190,6 +190,10 @@ int vtkSMPToolsImpl::GetEstimatedNumberOfThreads(); + template <> + bool vtkSMPToolsImpl::GetSingleThread(); + ++//-------------------------------------------------------------------------------- ++template <> ++VTKCOMMONCORE_EXPORT vtkSMPToolsImpl::vtkSMPToolsImpl(); ++ + VTK_ABI_NAMESPACE_END + } // namespace smp + } // namespace detail diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 5395637385..8949074eda 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -39,6 +39,7 @@ vcpkg_from_github( opencascade-7.8.0.patch no-libharu-for-ioexport.patch no-libproj-for-netcdf.patch + fix-tbbsmptool.patch #https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11530 ) # ============================================================================= @@ -241,11 +242,25 @@ else() ) endif() +if("tbb" IN_LIST FEATURES) + list(APPEND ADDITIONAL_OPTIONS + -DVTK_SMP_IMPLEMENTATION_TYPE=TBB + ) +endif() + +if("openmp" IN_LIST FEATURES) + list(APPEND ADDITIONAL_OPTIONS + -DVTK_SMP_IMPLEMENTATION_TYPE=OpenMP + ) +endif() + vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES "cuda" VTK_USE_CUDA "mpi" VTK_USE_MPI "all" VTK_BUILD_ALL_MODULES + "tbb" VTK_SMP_ENABLE_TBB + "openmp" VTK_SMP_ENABLE_OPENMP ) # ============================================================================= diff --git a/ports/vtk/vcpkg.json b/ports/vtk/vcpkg.json index 903f95f30f..20df92ba10 100644 --- a/ports/vtk/vcpkg.json +++ b/ports/vtk/vcpkg.json @@ -1,7 +1,7 @@ { "name": "vtk", "version-semver": "9.3.0-pv5.12.1", - "port-version": 6, + "port-version": 7, "description": "Software system for 3D computer graphics, image processing, and visualization", "homepage": "https://github.com/Kitware/VTK", "license": null, @@ -218,6 +218,9 @@ } ] }, + "openmp": { + "description": "Use openmp multithreading parallel implementation" + }, "openvr": { "description": "OpenVR functionality for VTK", "dependencies": [ @@ -317,6 +320,12 @@ "sqlite3" ] }, + "tbb": { + "description": "Use TBB multithreading parallel implementation", + "dependencies": [ + "tbb" + ] + }, "utf8": { "description": "Enables vtk reader/writer with utf-8 path support", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index 2a194c21e3..3204cc05e5 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9546,7 +9546,7 @@ }, "vtk": { "baseline": "9.3.0-pv5.12.1", - "port-version": 6 + "port-version": 7 }, "vtk-dicom": { "baseline": "0.8.16", diff --git a/versions/v-/vtk.json b/versions/v-/vtk.json index 148a4f6620..f41eeb099c 100644 --- a/versions/v-/vtk.json +++ b/versions/v-/vtk.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "99106a39e2e8608b7a33f937bdaa62be93fdbbca", + "version-semver": "9.3.0-pv5.12.1", + "port-version": 7 + }, { "git-tree": "5727b06657959909b4ffe7608c3d849acb38f286", "version-semver": "9.3.0-pv5.12.1",