aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neumann <30894796+Neumann-A@users.noreply.github.com>2020-05-11 22:39:50 +0200
committerGitHub <noreply@github.com>2020-05-11 13:39:50 -0700
commit3e2409f47ddd0f737851448faa63067a6816c285 (patch)
tree0d70fc1ae8794bc6fe843c194f2796f5a42e6924
parentc7cd6184d23686ffe54893a76bcd801b7940ba4b (diff)
downloadvcpkg-3e2409f47ddd0f737851448faa63067a6816c285.tar.gz
vcpkg-3e2409f47ddd0f737851448faa63067a6816c285.zip
[VTK/vtk-m] Update VTK to 9.0 and add vtk-m (#11148)
* [vtk-m] new port vtk-m * [VTK] Update to 9.0 * include local buildtree changes * [pcl] disable VTK due to API changes in VTK 9.0 * [vtk-m] add supports field to be only x64 * [vtk-dicom] add python executable. * fix vtkm dependency * [vtk-dicom] fix missing std:: namespace * [vtk-m] add uwp to unsupported triplets * [vtk] add pegtl include patch, reenable IOMotionFX * remove hdf5 changes for testing * use different pgetl patch which redirects to the installed config of pegtl * [pegtl-2] version file needs renaming too * [vtk] change dependency to pgetl-2 and fix the patch * [vtk] put in hdf5 fix again and correct manually installed include files * remove deprecated function to retrigger CI * [lz4] correctly lowercase the lz4 config * [vtk] remove unnecessary code * [pegtl-2] add homepage * [pegtl] modernize portfiles * [vtk-dicom] add homepage * [vtk-dicom] modernize portfile * [vtk-m] remove empty build depends * [vtk] try fixing the permission issue * bump control * Update FindHDF5.cmake * Update pegtl.patch * Update ports/vtk/pegtl.patch Co-authored-by: nicole mazzuca <mazzucan@outlook.com> * [vtk] refactor portfile, added a few deps on [core] and added feature cuda * [vtk] pegtl.patch: Add additional found message * [vtk-m] add more documentation comments * [vtk] fix string replacement Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
-rw-r--r--ports/lz4/CMakeLists.txt2
-rw-r--r--ports/lz4/CONTROL2
-rw-r--r--ports/pcl/CONTROL2
-rw-r--r--ports/pcl/portfile.cmake2
-rw-r--r--ports/pegtl-2/CONTROL3
-rw-r--r--ports/pegtl-2/portfile.cmake6
-rw-r--r--ports/pegtl/portfile.cmake1
-rw-r--r--ports/vtk-dicom/CONTROL5
-rw-r--r--ports/vtk-dicom/portfile.cmake10
-rw-r--r--ports/vtk-dicom/std.patch74
-rw-r--r--ports/vtk-m/CONTROL23
-rw-r--r--ports/vtk-m/portfile.cmake61
-rw-r--r--ports/vtk/CONTROL26
-rw-r--r--ports/vtk/FindGDAL.cmake127
-rw-r--r--ports/vtk/FindHDF5.cmake23
-rw-r--r--ports/vtk/FindLZ4.patch47
-rw-r--r--ports/vtk/FindLZMA.patch86
-rw-r--r--ports/vtk/FindLibHaru.patch37
-rw-r--r--ports/vtk/FindPostgreSQL.cmake269
-rw-r--r--ports/vtk/Findproj.patch13
-rw-r--r--ports/vtk/NoUndefDebug.patch13
-rw-r--r--ports/vtk/fix-VTKConfig-cmake.patch29
-rw-r--r--ports/vtk/fix-find-lz4.patch20
-rw-r--r--ports/vtk/fix-find-lzma.patch16
-rw-r--r--ports/vtk/fix-proj4.patch175
-rw-r--r--ports/vtk/fix-pugixml-link.patch28
-rw-r--r--ports/vtk/fix_ogg_linkage.patch12
-rw-r--r--ports/vtk/hdf5_static.patch22
-rw-r--r--ports/vtk/pegtl.patch71
-rw-r--r--ports/vtk/portfile.cmake362
-rw-r--r--ports/vtk/pythonwrapper.patch19
-rw-r--r--ports/vtk/vtkm.patch141
32 files changed, 1111 insertions, 616 deletions
diff --git a/ports/lz4/CMakeLists.txt b/ports/lz4/CMakeLists.txt
index 724b6fdaf..1e272dd45 100644
--- a/ports/lz4/CMakeLists.txt
+++ b/ports/lz4/CMakeLists.txt
@@ -40,7 +40,7 @@ list(REMOVE_ITEM lz4h "${CMAKE_CURRENT_LIST_DIR}/lib/xxhash.h")
INSTALL(FILES ${lz4h} DESTINATION "${INSTALL_INCLUDE_DIR}")
install(EXPORT lz4Config
- FILE lz4Config.cmake
+ FILE lz4-config.cmake
NAMESPACE lz4::
DESTINATION "${INSTALL_CMAKE_DIR}"
)
diff --git a/ports/lz4/CONTROL b/ports/lz4/CONTROL
index 749586988..280ec3cda 100644
--- a/ports/lz4/CONTROL
+++ b/ports/lz4/CONTROL
@@ -1,5 +1,5 @@
Source: lz4
-Version: 1.9.2-1
+Version: 1.9.2-2
Homepage: https://github.com/lz4/lz4
Description: Lossless compression algorithm, providing compression speed at 400 MB/s per core.
Build-Depends: xxhash
diff --git a/ports/pcl/CONTROL b/ports/pcl/CONTROL
index 9f23fc43e..d21a0b8fd 100644
--- a/ports/pcl/CONTROL
+++ b/ports/pcl/CONTROL
@@ -1,5 +1,5 @@
Source: pcl
-Version: 1.9.1-12
+Version: 1.9.1-13
Homepage: https://github.com/PointCloudLibrary/pcl
Description: Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing.
Build-Depends: eigen3, flann, qhull, vtk, libpng, boost-system, boost-filesystem, boost-thread, boost-date-time, boost-iostreams, boost-random, boost-foreach, boost-dynamic-bitset, boost-property-map, boost-graph, boost-multi-array, boost-signals2, boost-ptr-container, boost-uuid, boost-interprocess, boost-asio
diff --git a/ports/pcl/portfile.cmake b/ports/pcl/portfile.cmake
index ce3f91a8f..0f4c30127 100644
--- a/ports/pcl/portfile.cmake
+++ b/ports/pcl/portfile.cmake
@@ -45,7 +45,7 @@ vcpkg_configure_cmake(
-DWITH_LIBUSB=OFF
-DWITH_PNG=ON
-DWITH_QHULL=ON
- -DWITH_VTK=ON
+ -DWITH_VTK=OFF # disabled due to API changes in 9.0
# FEATURES
${FEATURE_OPTIONS}
)
diff --git a/ports/pegtl-2/CONTROL b/ports/pegtl-2/CONTROL
index aba1579d1..842c9080f 100644
--- a/ports/pegtl-2/CONTROL
+++ b/ports/pegtl-2/CONTROL
@@ -1,3 +1,4 @@
Source: pegtl-2
-Version: 2.8.1
+Version: 2.8.1-1
Description: The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only parser combinator library for creating parsers according to a Parsing Expression Grammar (PEG). This version maintains compatibility with C++11.
+Homepage: https://github.com/taocpp/PEGTL \ No newline at end of file
diff --git a/ports/pegtl-2/portfile.cmake b/ports/pegtl-2/portfile.cmake
index 4e43c40ce..5eedd0c40 100644
--- a/ports/pegtl-2/portfile.cmake
+++ b/ports/pegtl-2/portfile.cmake
@@ -1,4 +1,3 @@
-include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO taocpp/pegtl
@@ -25,7 +24,8 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH share/pegtl-2/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
# Handle copyright
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/pegtl-2/LICENSE ${CURRENT_PACKAGES_DIR}/share/pegtl-2/copyright)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
# Handle collision with latest pegtl
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/pegtl-2/pegtl-config.cmake ${CURRENT_PACKAGES_DIR}/share/pegtl-2/pegtl-2-config.cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/pegtl-config.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/pegtl-config-version.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config-version.cmake)
diff --git a/ports/pegtl/portfile.cmake b/ports/pegtl/portfile.cmake
index 0ff90c470..a9d4ff846 100644
--- a/ports/pegtl/portfile.cmake
+++ b/ports/pegtl/portfile.cmake
@@ -1,4 +1,3 @@
-include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO taocpp/pegtl
diff --git a/ports/vtk-dicom/CONTROL b/ports/vtk-dicom/CONTROL
index 2041f21e1..e8e3494d8 100644
--- a/ports/vtk-dicom/CONTROL
+++ b/ports/vtk-dicom/CONTROL
@@ -1,7 +1,8 @@
Source: vtk-dicom
-Version: 0.8.12
+Version: 0.8.12-1
Description: DICOM for VTK
-Build-Depends: vtk, zlib
+Homepage: https://github.com/dgobbi/vtk-dicom
+Build-Depends: vtk[core], zlib
Feature: gdcm
Description: Use gdcm for decompressing DICOM files.
diff --git a/ports/vtk-dicom/portfile.cmake b/ports/vtk-dicom/portfile.cmake
index bd137e61e..171a046a2 100644
--- a/ports/vtk-dicom/portfile.cmake
+++ b/ports/vtk-dicom/portfile.cmake
@@ -1,11 +1,10 @@
-include(vcpkg_common_functions)
-
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO dgobbi/vtk-dicom
REF 5034c68450de857b70fbe4a4b9f8dddb62badef3 # v0.8.12
SHA512 bad1ed6a4a412402a2cd69e5f85b2b73f1ee7ea46a6bbcac31c5f66d07ae006679ffbd9a3c70f9baa1b05b1af0a2d4ca0efc34ec0a85a92f5116b900e81635cd
HEAD_REF master
+ PATCHES std.patch # similar patch is already in master
)
if ("gdcm" IN_LIST FEATURES)
@@ -21,22 +20,23 @@ if(USE_GDCM)
-DUSE_DCMTK=OFF
)
endif()
-
+vcpkg_find_acquire_program(PYTHON3)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_PROGRAMS=OFF
-DBUILD_EXAMPLES=OFF
+ "-DPython3_EXECUTABLE=${PYTHON3}"
${ADDITIONAL_OPTIONS}
)
vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
-file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk-dicom)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/vtk-dicom/Copyright.txt ${CURRENT_PACKAGES_DIR}/share/vtk-dicom/copyright)
+file(INSTALL ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
diff --git a/ports/vtk-dicom/std.patch b/ports/vtk-dicom/std.patch
new file mode 100644
index 000000000..59160f089
--- /dev/null
+++ b/ports/vtk-dicom/std.patch
@@ -0,0 +1,74 @@
+diff --git a/Source/vtkScancoCTReader.cxx b/Source/vtkScancoCTReader.cxx
+index a71f2e46e..afe202ffc 100644
+--- a/Source/vtkScancoCTReader.cxx
++++ b/Source/vtkScancoCTReader.cxx
+@@ -176,7 +176,7 @@ int vtkScancoCTReader::CheckVersion(const char header[16])
+ //----------------------------------------------------------------------------
+ int vtkScancoCTReader::CanReadFile(const char *filename)
+ {
+- ifstream infile(filename, ios::in | ios::binary);
++ std::ifstream infile(filename, ios::in | ios::binary);
+
+ bool canRead = false;
+ if (infile.good())
+@@ -409,7 +409,7 @@ void vtkScancoCTReader::StripString(char *dest, const char *cp, size_t l)
+ }
+
+ //----------------------------------------------------------------------------
+-int vtkScancoCTReader::ReadISQHeader(ifstream *file, unsigned long bytesRead)
++int vtkScancoCTReader::ReadISQHeader(std::ifstream *file, unsigned long bytesRead)
+ {
+ if (bytesRead < 512)
+ {
+@@ -620,7 +620,7 @@ int vtkScancoCTReader::ReadISQHeader(ifstream *file, unsigned long bytesRead)
+ }
+
+ //----------------------------------------------------------------------------
+-int vtkScancoCTReader::ReadAIMHeader(ifstream *file, unsigned long bytesRead)
++int vtkScancoCTReader::ReadAIMHeader(std::ifstream *file, unsigned long bytesRead)
+ {
+ if (bytesRead < 160)
+ {
+@@ -987,7 +987,7 @@ int vtkScancoCTReader::RequestInformation(
+ const char *ufilename = filename;
+ #endif
+
+- ifstream infile(ufilename, ios::in | ios::binary);
++ std::ifstream infile(ufilename, ios::in | ios::binary);
+ if (!infile.good())
+ {
+ vtkErrorMacro("Cannot open file " << filename);
+@@ -1115,7 +1115,7 @@ int vtkScancoCTReader::RequestData(
+ static_cast<unsigned char *>(data->GetScalarPointer());
+
+ // open the file
+- ifstream infile(filename, ios::in | ios::binary);
++ std::ifstream infile(filename, ios::in | ios::binary);
+ if (!infile.good())
+ {
+ vtkErrorMacro("Cannot open file " << filename);
+diff --git a/Source/vtkScancoCTReader.h b/Source/vtkScancoCTReader.h
+index ca31d7572..240d532f2 100644
+--- a/Source/vtkScancoCTReader.h
++++ b/Source/vtkScancoCTReader.h
+@@ -34,6 +34,7 @@
+ #ifndef vtkScancoCTReader_h
+ #define vtkScancoCTReader_h
+
++#include <iosfwd>
+ #include "vtkImageReader2.h"
+ #include "vtkDICOMModule.h" // For export macro
+ #include "vtkDICOMConfig.h" // For configuration details
+@@ -185,10 +186,10 @@ protected:
+ void InitializeHeader();
+
+ //! Read an ISQ header.
+- int ReadISQHeader(ifstream *file, unsigned long bytesRead);
++ int ReadISQHeader(std::ifstream *file, unsigned long bytesRead);
+
+ //! Read AIM header.
+- int ReadAIMHeader(ifstream *file, unsigned long bytesRead);
++ int ReadAIMHeader(std::ifstream *file, unsigned long bytesRead);
+
+ //! Check the file header to see what type of file it is.
+ /*!
diff --git a/ports/vtk-m/CONTROL b/ports/vtk-m/CONTROL
new file mode 100644
index 000000000..6fe2933c2
--- /dev/null
+++ b/ports/vtk-m/CONTROL
@@ -0,0 +1,23 @@
+Source: vtk-m
+Version: 1.5.0
+Homepage: https://gitlab.kitware.com/vtk/vtk-m/
+Description: VTK-m is a toolkit of scientific visualization algorithms for emerging processor architectures.
+Supports: x64 & !uwp
+
+Feature: cuda
+Description: Use the NVIDIA CUDA device adapter.
+Build-Depends: cuda
+
+Feature: omp
+Description: Use the OpenMP device adapter.
+
+Feature: tbb
+Description: Use the Intel TBB device adapter.
+Build-Depends: tbb
+
+Feature: mpi
+Description: Use the MPI controller.
+Build-Depends: mpi
+
+Feature: double
+Description: Use double precision in floating point calculations
diff --git a/ports/vtk-m/portfile.cmake b/ports/vtk-m/portfile.cmake
new file mode 100644
index 000000000..658a12d2e
--- /dev/null
+++ b/ports/vtk-m/portfile.cmake
@@ -0,0 +1,61 @@
+# VENDORED DEPENDENCIES!
+# TODO: Should be replaced in the future with VCPKG internal versions
+# add_subdirectory(thirdparty/diy)
+# add_subdirectory(thirdparty/lodepng)
+# if(VTKm_ENABLE_LOGGING)
+ # add_subdirectory(thirdparty/loguru)
+# endif()
+# add_subdirectory(thirdparty/optionparser)
+# add_subdirectory(thirdparty/taotuple)
+# add_subdirectory(thirdparty/lcl)
+
+vcpkg_check_features (OUT_FEATURE_OPTIONS OPTIONS
+ FEATURES
+ cuda VTKm_ENABLE_CUDA
+ omp VTKm_ENABLE_OPENMP
+ tbb VTKm_ENABLE_TBB
+ mpi VTKm_ENABLE_MPI
+ double VTKm_USE_DOUBLE_PRECISION
+ )
+
+if("cuda" IN_LIST FEATURES AND NOT ENV{CUDACXX})
+ set(ENV{CUDACXX} "$ENV{CUDA_PATH}/bin/nvcc")
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ message(STATUS "Feature CUDA forces static build!")
+ endif()
+ set(VCPKG_LIBRARY_LINKAGE "static") # CUDA forces static build.
+endif()
+
+list(APPEND OPTIONS -DVTKm_ENABLE_RENDERING=ON)
+list(APPEND OPTIONS -DVTKm_ENABLE_DEVELOPER_FLAGS=OFF)
+list(APPEND OPTIONS -DVTKm_ENABLE_CPACK=OFF)
+list(APPEND OPTIONS -DVTKm_USE_DEFAULT_TYPES_FOR_VTK=ON)
+# For port customizations on unix systems.
+# Please feel free to make these port features if it makes any sense
+#list(APPEND OPTIONS -DVTKm_ENABLE_GL_CONTEXT=ON) # or
+#list(APPEND OPTIONS -DVTKm_ENABLE_EGL_CONTEXT=ON) # or
+#list(APPEND OPTIONS -DVTKm_ENABLE_OSMESA_CONTEXT=ON)
+list(APPEND OPTIONS -DBUILD_TESTING=OFF)
+
+vcpkg_from_gitlab(GITLAB_URL "https://gitlab.kitware.com"
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO vtk/vtk-m
+ REF f2aa6ad5be1a97e3fb41ef4680ee2c76c3434ac0 # v1.5.0 Version is strongly locked to VTK 9.0. Upgrading will most likly brake the VTK build
+ SHA512 2f2a273f74d9a583df9e25a4792440d8d89652fa14b3153f2ea5afbd329b50970e7b9bd68e0ccd036baf5c1f3ad7a8302d95c01dbb30d9a46c045987eebf5370)
+ # For people only wanting vtk-m and not VTK
+ #REF 74ffad9bd0679d061bc87e544a728f1c3c926269 # v1.5.1
+ #SHA512 c9e1c18432b6c11ae086445255acf9477fe4c888122a2b2a9713dc63a40d2e4c2375742157526b5f0869f14c62a4ad66d81ee58d6cc75a1d53a1d615525a03c9)
+vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS ${OPTIONS})
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/vtkm-1.5 TARGET_PATH share/vtkm)
+
+file(READ ${CURRENT_PACKAGES_DIR}/share/vtkm/VTKmConfig.cmake _contents)
+string(REPLACE [[set_and_check(VTKm_CONFIG_DIR "${PACKAGE_PREFIX_DIR}/lib/cmake/vtkm-1.5")]] [[set_and_check(VTKm_CONFIG_DIR "${PACKAGE_PREFIX_DIR}/share/vtkm")]] _contents ${_contents})
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtkm/VTKmConfig.cmake ${_contents})
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL
index 09d241702..9db2f31e8 100644
--- a/ports/vtk/CONTROL
+++ b/ports/vtk/CONTROL
@@ -1,8 +1,12 @@
Source: vtk
-Version: 8.2.0-13
+Version: 9.0
Description: Software system for 3D computer graphics, image processing, and visualization
Homepage: https://github.com/Kitware/VTK
-Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora, eigen3, double-conversion, pugixml, libharu, sqlite3, netcdf-c
+Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5[core], libjpeg-turbo, proj4, lz4, liblzma, libtheora, eigen3, double-conversion, pugixml, libharu[notiffsymbols], sqlite3, netcdf-c, utfcpp, libogg, pegtl-2
+
+Feature: vtkm
+Description: Build with vtk-m accelerator and module.
+Build-Depends: vtk-m[core]
Feature: openvr
Description: OpenVR functionality for VTK
@@ -10,11 +14,11 @@ Build-Depends: sdl2, openvr
Feature: qt
Description: Qt functionality for VTK
-Build-Depends: qt5
+Build-Depends: qt5-xmlpatterns, qt5-tools, qt5-imageformats, qt5-x11extras (linux)
Feature: mpi
Description: MPI functionality for VTK
-Build-Depends: mpi, hdf5[parallel]
+Build-Depends: mpi, hdf5[core, parallel], vtk-m[core,mpi]
Feature: python
Description: Python functionality for VTK
@@ -22,4 +26,16 @@ Build-Depends: python3
Feature: atlmfc
Description: Mfc functionality for vtk on Windows
-Build-Depends: atlmfc (windows) \ No newline at end of file
+Build-Depends: atlmfc (windows)
+
+Feature: paraview
+Description: Build vtk modules required by paraview
+Build-Depends: vtk[core, qt], vtk[core, atlmfc] (windows)
+
+Feature: cuda
+Description: Support CUDA compilation
+Build-Depends: cuda
+
+Feature: all
+Description: Build vtk modules required by paraview
+Build-Depends: libmysql, ffmpeg, gdal, vtk[core, qt, python, mpi], vtk[core, atlmfc] (windows) \ No newline at end of file
diff --git a/ports/vtk/FindGDAL.cmake b/ports/vtk/FindGDAL.cmake
deleted file mode 100644
index e4f2f303b..000000000
--- a/ports/vtk/FindGDAL.cmake
+++ /dev/null
@@ -1,127 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# FindGDAL
-# --------
-#
-#
-#
-# Locate gdal
-#
-# This module accepts the following environment variables:
-#
-# ::
-#
-# GDAL_DIR or GDAL_ROOT - Specify the location of GDAL
-#
-#
-#
-# This module defines the following CMake variables:
-#
-# ::
-#
-# GDAL_FOUND - True if libgdal is found
-# GDAL_LIBRARY - A variable pointing to the GDAL library
-# GDAL_INCLUDE_DIR - Where to find the headers
-
-#
-# $GDALDIR is an environment variable that would
-# correspond to the ./configure --prefix=$GDAL_DIR
-# used in building gdal.
-#
-# Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it
-# for osgTerrain so I whipped this module together for completeness.
-# I actually don't know the conventions or where files are typically
-# placed in distros.
-# Any real gdal users are encouraged to correct this (but please don't
-# break the OS X framework stuff when doing so which is what usually seems
-# to happen).
-
-# This makes the presumption that you are include gdal.h like
-#
-#include "gdal.h"
-
-find_path(GDAL_INCLUDE_DIR gdal.h
- HINTS
- ENV GDAL_DIR
- ENV GDAL_ROOT
- PATH_SUFFIXES
- include/gdal
- include/GDAL
- include
- PATHS
- ~/Library/Frameworks/gdal.framework/Headers
- /Library/Frameworks/gdal.framework/Headers
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
-)
-
-if(UNIX)
- # Use gdal-config to obtain the library version (this should hopefully
- # allow us to -lgdal1.x.y where x.y are correct version)
- # For some reason, libgdal development packages do not contain
- # libgdal.so...
- find_program(GDAL_CONFIG gdal-config
- HINTS
- ENV GDAL_DIR
- ENV GDAL_ROOT
- PATH_SUFFIXES bin
- PATHS
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
- )
-
- if(GDAL_CONFIG)
- exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
- if(GDAL_CONFIG_LIBS)
- string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS})
- string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}")
- string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS})
- string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}")
- endif()
- endif()
-endif()
-
-find_library(GDAL_LIBRARY_RELEASE
- NAMES ${_gdal_lib} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
- HINTS
- ENV GDAL_DIR
- ENV GDAL_ROOT
- ${_gdal_libpath}
- PATH_SUFFIXES lib
- PATHS
- /sw
- /opt/local
- /opt/csw
- /opt
- /usr/freeware
-)
-
-find_library(GDAL_LIBRARY_DEBUG
- NAMES ${_gdal_lib} gdald gdald_i gdald1.5.0 gdald1.4.0 gdald1.3.2 GDALD
- HINTS
- ENV GDAL_DIR
- ENV GDAL_ROOT
- ${_gdal_libpath}
- PATH_SUFFIXES lib
- PATHS
- /sw
- /opt/local
- /opt/csw
- /opt
- /usr/freeware
-)
-
-include(SelectLibraryConfigurations)
-select_library_configurations(GDAL)
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR)
-
-set(GDAL_LIBRARIES ${GDAL_LIBRARY})
-set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
diff --git a/ports/vtk/FindHDF5.cmake b/ports/vtk/FindHDF5.cmake
new file mode 100644
index 000000000..1be15731b
--- /dev/null
+++ b/ports/vtk/FindHDF5.cmake
@@ -0,0 +1,23 @@
+#The original VTK file is overdoing it and still prdouces errors that the target hdf5::hdf5_hl-shared cannot be found in dynamic builds
+find_package(hdf5 QUIET NO_MODULE)
+if(TARGET hdf5::hdf5-shared)
+ set_target_properties(hdf5::hdf5-shared PROPERTIES IMPORTED_GLOBAL TRUE)
+ add_library(hdf5::hdf5 ALIAS hdf5::hdf5-shared)
+elseif(TARGET hdf5::hdf5-static)
+ set_target_properties(hdf5::hdf5-static PROPERTIES IMPORTED_GLOBAL TRUE)
+ add_library(hdf5::hdf5 ALIAS hdf5::hdf5-static)
+else()
+ message(FATAL_ERROR "HDF5 target not found")
+endif()
+if(TARGET hdf5::hdf5_hl-shared)
+ set_target_properties(hdf5::hdf5_hl-shared PROPERTIES IMPORTED_GLOBAL TRUE)
+ add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-shared)
+elseif(TARGET hdf5::hdf5_hl-static)
+ set_target_properties(hdf5::hdf5_hl-static PROPERTIES IMPORTED_GLOBAL TRUE)
+ add_library(hdf5::hdf5_hl ALIAS hdf5::hdf5_hl-static)
+else()
+ message(FATAL_ERROR "HDF5 HL target not found")
+endif()
+set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL} CACHE BOOL "" FORCE)
+set(HDF5_FOUND ON CACHE BOOL "" FORCE)
+set(hdf5_FOUND ON CACHE BOOL "" FORCE)
diff --git a/ports/vtk/FindLZ4.patch b/ports/vtk/FindLZ4.patch
new file mode 100644
index 000000000..dced8bf56
--- /dev/null
+++ b/ports/vtk/FindLZ4.patch
@@ -0,0 +1,47 @@
+diff --git a/CMake/FindLZ4.cmake b/CMake/FindLZ4.cmake
+index 8c94e3bcd..ade3f9451 100644
+--- a/CMake/FindLZ4.cmake
++++ b/CMake/FindLZ4.cmake
+@@ -1,38 +1,3 @@
+-find_path(LZ4_INCLUDE_DIR
+- NAMES lz4.h
+- DOC "lz4 include directory")
+-mark_as_advanced(LZ4_INCLUDE_DIR)
+-find_library(LZ4_LIBRARY
+- NAMES lz4 liblz4
+- DOC "lz4 library")
+-mark_as_advanced(LZ4_LIBRARY)
+-
+-if (LZ4_INCLUDE_DIR)
+- file(STRINGS "${LZ4_INCLUDE_DIR}/lz4.h" _lz4_version_lines
+- REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)")
+- string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}")
+- string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}")
+- string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}")
+- set(LZ4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}")
+- unset(_lz4_version_major)
+- unset(_lz4_version_minor)
+- unset(_lz4_version_release)
+- unset(_lz4_version_lines)
+-endif ()
+-
+-include(FindPackageHandleStandardArgs)
+-find_package_handle_standard_args(LZ4
+- REQUIRED_VARS LZ4_LIBRARY LZ4_INCLUDE_DIR
+- VERSION_VAR LZ4_VERSION)
+-
+-if (LZ4_FOUND)
+- set(LZ4_INCLUDE_DIRS "${LZ4_INCLUDE_DIR}")
+- set(LZ4_LIBRARIES "${LZ4_LIBRARY}")
+-
+- if (NOT TARGET LZ4::LZ4)
+- add_library(LZ4::LZ4 UNKNOWN IMPORTED)
+- set_target_properties(LZ4::LZ4 PROPERTIES
+- IMPORTED_LOCATION "${LZ4_LIBRARY}"
+- INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}")
+- endif ()
+-endif ()
++find_package(LZ4 CONFIG REQUIRED)
++set_target_properties(lz4::lz4 PROPERTIES IMPORTED_GLOBAL TRUE)
++add_library(LZ4::LZ4 ALIAS lz4::lz4)
+\ No newline at end of file
diff --git a/ports/vtk/FindLZMA.patch b/ports/vtk/FindLZMA.patch
new file mode 100644
index 000000000..8da36b06b
--- /dev/null
+++ b/ports/vtk/FindLZMA.patch
@@ -0,0 +1,86 @@
+diff --git a/CMake/FindLZMA.cmake b/CMake/FindLZMA.cmake
+index 0c8c7943c..d60669484 100644
+--- a/CMake/FindLZMA.cmake
++++ b/CMake/FindLZMA.cmake
+@@ -1,9 +1,17 @@
+ find_path(LZMA_INCLUDE_DIR
+ NAMES lzma.h
+ DOC "lzma include directory")
+-find_library(LZMA_LIBRARY
++# Note LZMA_LIBRARY is set somewhere else. Maybe one of the configs/wrappers installed by VCPKG defines it.
++# The original FindLZMA chokes on it since it contains optimized/debug keywords
++# VTK should probably switch to FindLibLZMA from CMake
++find_library(LZMA_LIBRARY_RELEASE
+ NAMES lzma
+ DOC "lzma library")
++find_library(LZMA_LIBRARY_DEBUG
++ NAMES lzmad lzma NAMES_PER_DIR
++ DOC "lzma library")
++ include(SelectLibraryConfigurations)
++ select_library_configurations( LZMA )
+
+ if (LZMA_INCLUDE_DIR)
+ file(STRINGS "${LZMA_INCLUDE_DIR}/lzma/version.h" _lzma_version_lines
+@@ -20,22 +26,50 @@ endif ()
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(LZMA
+- REQUIRED_VARS LZMA_LIBRARY LZMA_INCLUDE_DIR
++ REQUIRED_VARS LZMA_LIBRARY LZMA_LIBRARY_RELEASE LZMA_LIBRARY_DEBUG LZMA_INCLUDE_DIR
+ VERSION_VAR LZMA_VERSION)
+
+ if (LZMA_FOUND)
+ set(LZMA_LIBRARIES "${LZMA_LIBRARY}")
+ set(LZMA_INCLUDE_DIRS "${LZMA_INCLUDE_DIR}")
+-
++
+ if (NOT TARGET LZMA::LZMA)
+ include(vtkDetectLibraryType)
+- vtk_detect_library_type(lzma_library_type
+- PATH "${LZMA_LIBRARY}")
+- add_library(LZMA::LZMA "${lzma_library_type}" IMPORTED)
+- unset(lzma_library_type)
+- set_target_properties(LZMA::LZMA PROPERTIES
+- IMPORTED_LOCATION "${LZMA_LIBRARY}"
+- IMPORTED_IMPLIB "${LZMA_LIBRARY}"
+- INTERFACE_INCLUDE_DIRECTORIES "${LZMA_INCLUDE_DIR}")
+- endif ()
++ if(LZMA_LIBRARY_RELEASE)
++ vtk_detect_library_type(lzma_library_type
++ PATH "${LZMA_LIBRARY_RELEASE}")
++ elseif(LZMA_LIBRARY_DEBUG)
++ vtk_detect_library_type(lzma_library_type
++ PATH "${LZMA_LIBRARY_DEBUG}")
++ else()
++ vtk_detect_library_type(lzma_library_type
++ PATH "${LZMA_LIBRARY}")
++ endif()
++
++ add_library(LZMA::LZMA "${lzma_library_type}" IMPORTED)
++ set_target_properties(LZMA::LZMA PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${LZMA_INCLUDE_DIR}")
++ if(LZMA_LIBRARY_RELEASE)
++ set_target_properties(LZMA::LZMA PROPERTIES
++ IMPORTED_LOCATION_RELEASE "${LZMA_LIBRARY_RELEASE}"
++ IMPORTED_IMPLIB_RELEASE "${LZMA_LIBRARY_RELEASE}")
++ endif()
++ if(LZMA_LIBRARY_DEBUG)
++ set_target_properties(LZMA::LZMA PROPERTIES
++ IMPORTED_LOCATION_DEBUG "${LZMA_LIBRARY_DEBUG}"
++ IMPORTED_IMPLIB_DEBUG "${LZMA_LIBRARY_DEBUG}")
++ endif()
++
++ # Guard against possible stupidity of VTK reading only LOCATION without configuration
++ if(CMAKE_BUILD_TYPE MATCHES "Debug")
++ set_target_properties(LZMA::LZMA PROPERTIES
++ IMPORTED_LOCATION "${LZMA_LIBRARY_DEBUG}"
++ IMPORTED_IMPLIB "${LZMA_LIBRARY_DEBUG}")
++ else()
++ set_target_properties(LZMA::LZMA PROPERTIES
++ IMPORTED_LOCATION "${LZMA_LIBRARY_RELEASE}"
++ IMPORTED_IMPLIB "${LZMA_LIBRARY_RELEASE}")
++ endif()
++ endif()
++ #set_target_properties(LZMA::LZMA PROPERTIES IMPORTED_GLOBAL TRUE)
+ endif ()
+ \ No newline at end of file
diff --git a/ports/vtk/FindLibHaru.patch b/ports/vtk/FindLibHaru.patch
new file mode 100644
index 000000000..1b47a14b7
--- /dev/null
+++ b/ports/vtk/FindLibHaru.patch
@@ -0,0 +1,37 @@
+diff --git a/CMake/FindLibHaru.cmake b/CMake/FindLibHaru.cmake
+index 7ef877a49..2a18e0694 100644
+--- a/CMake/FindLibHaru.cmake
++++ b/CMake/FindLibHaru.cmake
+@@ -43,6 +43,31 @@ if (LibHaru_FOUND)
+ set(LibHaru_INCLUDE_DIRS "${LibHaru_INCLUDE_DIR}")
+ set(LibHaru_LIBRARIES "${LibHaru_LIBRARY}")
+
++ add_library(LibHaru::LibHaru UNKNOWN IMPORTED)
++ set_target_properties(LibHaru::LibHaru PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${LibHaru_INCLUDE_DIR}")
++ if(LZMA_LIBRARY_RELEASE)
++ set_target_properties(LibHaru::LibHaru PROPERTIES
++ IMPORTED_LOCATION_RELEASE "${LibHaru_LIBRARY_RELEASE}"
++ IMPORTED_IMPLIB_RELEASE "${LibHaru_LIBRARY_RELEASE}")
++ endif()
++ if(LZMA_LIBRARY_DEBUG)
++ set_target_properties(LibHaru::LibHaru PROPERTIES
++ IMPORTED_LOCATION_DEBUG "${LibHaru_LIBRARY_DEBUG}"
++ IMPORTED_IMPLIB_DEBUG "${LibHaru_LIBRARY_DEBUG}")
++ endif()
++
++ # Guard against possible stupidity of VTK reading only LOCATION without configuration
++ if(CMAKE_BUILD_TYPE MATCHES "Debug")
++ set_target_properties(LibHaru::LibHaru PROPERTIES
++ IMPORTED_LOCATION "${LibHaru_LIBRARY_DEBUG}"
++ IMPORTED_IMPLIB "${LibHaru_LIBRARY_DEBUG}")
++ else()
++ set_target_properties(LibHaru::LibHaru PROPERTIES
++ IMPORTED_LOCATION "${LibHaru_LIBRARY_RELEASE}"
++ IMPORTED_IMPLIB "${LibHaru_LIBRARY_RELEASE}")
++ endif()
++
+ if (NOT TARGET LibHaru::LibHaru)
+ include(vtkDetectLibraryType)
+ vtk_detect_library_type(libharu_library_type
+ \ No newline at end of file
diff --git a/ports/vtk/FindPostgreSQL.cmake b/ports/vtk/FindPostgreSQL.cmake
new file mode 100644
index 000000000..913c8b9ae
--- /dev/null
+++ b/ports/vtk/FindPostgreSQL.cmake
@@ -0,0 +1,269 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindPostgreSQL
+--------------
+
+Find the PostgreSQL installation.
+
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``PostgreSQL::PostgreSQL``
+if PostgreSQL has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``PostgreSQL_FOUND``
+ True if PostgreSQL is found.
+``PostgreSQL_LIBRARIES``
+ the PostgreSQL libraries needed for linking
+``PostgreSQL_INCLUDE_DIRS``
+ the directories of the PostgreSQL headers
+``PostgreSQL_LIBRARY_DIRS``
+ the link directories for PostgreSQL libraries
+``PostgreSQL_VERSION_STRING``
+ the version of PostgreSQL found
+#]=======================================================================]
+
+# ----------------------------------------------------------------------------
+# History:
+# This module is derived from the module originally found in the VTK source tree.
+#
+# ----------------------------------------------------------------------------
+# Note:
+# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the
+# version number of the implementation of PostgreSQL.
+# In Windows the default installation of PostgreSQL uses that as part of the path.
+# E.g C:\Program Files\PostgreSQL\8.4.
+# Currently, the following version numbers are known to this module:
+# "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0"
+#
+# To use this variable just do something like this:
+# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4")
+# before calling find_package(PostgreSQL) in your CMakeLists.txt file.
+# This will mean that the versions you set here will be found first in the order
+# specified before the default ones are searched.
+#
+# ----------------------------------------------------------------------------
+# You may need to manually set:
+# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are.
+# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are.
+# If FindPostgreSQL.cmake cannot find the include files or the library files.
+#
+# ----------------------------------------------------------------------------
+# The following variables are set if PostgreSQL is found:
+# PostgreSQL_FOUND - Set to true when PostgreSQL is found.
+# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL
+# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
+# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
+#
+# The ``PostgreSQL::PostgreSQL`` imported target is also created.
+#
+# ----------------------------------------------------------------------------
+# If you have installed PostgreSQL in a non-standard location.
+# (Please note that in the following comments, it is assumed that <Your Path>
+# points to the root directory of the include directory of PostgreSQL.)
+# Then you have three options.
+# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to <Your Path>/include and
+# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is
+# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path()
+# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file
+# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
+# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have
+# installed PostgreSQL, e.g. <Your Path>.
+#
+# ----------------------------------------------------------------------------
+
+set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include")
+set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}")
+set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.")
+set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}")
+set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4")
+
+
+set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
+ "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
+
+# Define additional search paths for root directories.
+set( PostgreSQL_ROOT_DIRECTORIES
+ ENV PostgreSQL_ROOT
+ ${PostgreSQL_ROOT}
+)
+foreach(suffix ${PostgreSQL_KNOWN_VERSIONS})
+ if(WIN32)
+ list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES
+ "PostgreSQL/${suffix}/lib")
+ list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES
+ "PostgreSQL/${suffix}/include")
+ list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
+ "PostgreSQL/${suffix}/include/server")
+ endif()
+ if(UNIX)
+ list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES
+ "pgsql-${suffix}/lib")
+ list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES
+ "pgsql-${suffix}/include")
+ list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
+ "postgresql/${suffix}/server"
+ "pgsql-${suffix}/include/server")
+ endif()
+endforeach()
+
+#
+# Look for an installation.
+#
+find_path(PostgreSQL_INCLUDE_DIR
+ NAMES libpq-fe.h
+ PATHS
+ # Look in other places.
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ pgsql
+ postgresql
+ include
+ ${PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES}
+ # Help the user find it if we cannot.
+ DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
+)
+
+find_path(PostgreSQL_TYPE_INCLUDE_DIR
+ NAMES catalog/pg_type.h
+ PATHS
+ # Look in other places.
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ postgresql
+ pgsql/server
+ postgresql/server
+ include/server
+ ${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES}
+ # Help the user find it if we cannot.
+ DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
+)
+
+# The PostgreSQL library.
+set (PostgreSQL_LIBRARY_TO_FIND pq)
+# Setting some more prefixes for the library
+set (PostgreSQL_LIB_PREFIX "")
+if ( WIN32 )
+ set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib")
+ set (PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND})
+endif()
+
+function(__postgresql_find_library _name)
+ find_library(${_name}
+ NAMES ${ARGN}
+ PATHS
+ ${PostgreSQL_ROOT_DIRECTORIES}
+ PATH_SUFFIXES
+ lib
+ ${PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES}
+ # Help the user find it if we cannot.
+ DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}"
+ )
+endfunction()
+
+# For compatibility with versions prior to this multi-config search, honor
+# any PostgreSQL_LIBRARY that is already specified and skip the search.
+if(PostgreSQL_LIBRARY)
+ set(PostgreSQL_LIBRARIES "${PostgreSQL_LIBRARY}")
+ get_filename_component(PostgreSQL_LIBRARY_DIR "${PostgreSQL_LIBRARY}" PATH)
+else()
+ __postgresql_find_library(PostgreSQL_LIBRARY_RELEASE ${PostgreSQL_LIBRARY_TO_FIND})
+ __postgresql_find_library(PostgreSQL_LIBRARY_DEBUG ${PostgreSQL_LIBRARY_TO_FIND}d)
+ include(SelectLibraryConfigurations)
+ select_library_configurations(PostgreSQL)
+ mark_as_advanced(PostgreSQL_LIBRARY_RELEASE PostgreSQL_LIBRARY_DEBUG)
+ if(PostgreSQL_LIBRARY_RELEASE)
+ get_filename_component(PostgreSQL_LIBRARY_DIR "${PostgreSQL_LIBRARY_RELEASE}" PATH)
+ elseif(PostgreSQL_LIBRARY_DEBUG)
+ get_filename_component(PostgreSQL_LIBRARY_DIR "${PostgreSQL_LIBRARY_DEBUG}" PATH)
+ else()
+ set(PostgreSQL_LIBRARY_DIR "")
+ endif()
+endif()
+
+if (PostgreSQL_INCLUDE_DIR)
+ # Some platforms include multiple pg_config.hs for multi-lib configurations
+ # This is a temporary workaround. A better solution would be to compile
+ # a dummy c file and extract the value of the symbol.
+ file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h")
+ foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
+ if(EXISTS "${_PG_CONFIG_HEADER}")
+ file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
+ REGEX "^#define[\t ]+PG_VERSION_NUM[\t ]+.*")
+ if(pgsql_version_str)
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION_NUM[\t ]+([0-9]*).*"
+ "\\1" _PostgreSQL_VERSION_NUM "${pgsql_version_str}")
+ break()
+ endif()
+ endif()
+ endforeach()
+ if (_PostgreSQL_VERSION_NUM)
+ math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000")
+ math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000")
+ set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}")
+ unset(_PostgreSQL_major_version)
+ unset(_PostgreSQL_minor_version)
+ else ()
+ foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
+ if(EXISTS "${_PG_CONFIG_HEADER}")
+ file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
+ REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+ if(pgsql_version_str)
+ string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
+ "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+ break()
+ endif()
+ endif()
+ endforeach()
+ endif ()
+ unset(_PostgreSQL_VERSION_NUM)
+ unset(pgsql_version_str)
+endif()
+
+# Did we find anything?
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PostgreSQL
+ REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR
+ VERSION_VAR PostgreSQL_VERSION_STRING)
+set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
+
+function(__postgresql_import_library _target _var _config)
+ if(_config)
+ set(_config_suffix "_${_config}")
+ else()
+ set(_config_suffix "")
+ endif()
+
+ set(_lib "${${_var}${_config_suffix}}")
+ if(EXISTS "${_lib}")
+ if(_config)
+ set_property(TARGET ${_target} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS ${_config})
+ endif()
+ set_target_properties(${_target} PROPERTIES
+ IMPORTED_LOCATION${_config_suffix} "${_lib}")
+ endif()
+endfunction()
+
+# Now try to get the include and library path.
+if(PostgreSQL_FOUND)
+ if (NOT TARGET PostgreSQL::PostgreSQL)
+ add_library(PostgreSQL::PostgreSQL UNKNOWN IMPORTED)
+ set_target_properties(PostgreSQL::PostgreSQL PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIR};${PostgreSQL_TYPE_INCLUDE_DIR}")
+ __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "")
+ __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "RELEASE")
+ __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY "DEBUG")
+ endif ()
+ set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} )
+ set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} )
+endif()
+
+mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR)
diff --git a/ports/vtk/Findproj.patch b/ports/vtk/Findproj.patch
new file mode 100644
index 000000000..d83b0f451
--- /dev/null
+++ b/ports/vtk/Findproj.patch
@@ -0,0 +1,13 @@
+diff --git a/CMake/FindLibPROJ.cmake b/CMake/FindLibPROJ.cmake
+index e2344bb17..bac4c747e 100644
+--- a/CMake/FindLibPROJ.cmake
++++ b/CMake/FindLibPROJ.cmake
+@@ -9,7 +9,7 @@ find_library(LibPROJ_LIBRARY_RELEASE
+ mark_as_advanced(LibPROJ_LIBRARY_RELEASE)
+
+ find_library(LibPROJ_LIBRARY_DEBUG
+- NAMES projd
++ NAMES projd proj_d proj NAMES_PER_DIR
+ DOC "libproj debug library")
+ mark_as_advanced(LibPROJ_LIBRARY_DEBUG)
+
diff --git a/ports/vtk/NoUndefDebug.patch b/ports/vtk/NoUndefDebug.patch
new file mode 100644
index 000000000..3fc8f5de8
--- /dev/null
+++ b/ports/vtk/NoUndefDebug.patch
@@ -0,0 +1,13 @@
+diff --git a/Utilities/Python/vtkPython.h b/Utilities/Python/vtkPython.h
+index 166f24104..79ae1d371 100644
+--- a/Utilities/Python/vtkPython.h
++++ b/Utilities/Python/vtkPython.h
+@@ -50,7 +50,7 @@
+ # include <sys/stat.h>
+ # include <time.h>
+ # include <wchar.h>
+-# undef _DEBUG
++
+ # if defined(_MSC_VER)
+ # define _CRT_NOFORCE_MANIFEST 1
+ # endif
diff --git a/ports/vtk/fix-VTKConfig-cmake.patch b/ports/vtk/fix-VTKConfig-cmake.patch
deleted file mode 100644
index a507d22a8..000000000
--- a/ports/vtk/fix-VTKConfig-cmake.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/CMake/VTKConfig.cmake.in b/CMake/VTKConfig.cmake.in
-index 13e4db42..d28e0cc2 100644
---- a/CMake/VTKConfig.cmake.in
-+++ b/CMake/VTKConfig.cmake.in
-@@ -66,19 +66,11 @@ set(VTK_USE_FILE "${VTK_CMAKE_DIR}/UseVTK.cmake")
- # The rendering backend VTK was configured to use.
- set(VTK_RENDERING_BACKEND "@VTK_RENDERING_BACKEND@")
-
--if (__vtk_install_tree)
-- if (WIN32)
-- set (VTK_RUNTIME_DIRS "@CMAKE_INSTALL_PREFIX@/@VTK_INSTALL_RUNTIME_DIR@")
-- else ()
-- set (VTK_RUNTIME_DIRS "@CMAKE_INSTALL_PREFIX@/@VTK_INSTALL_LIBRARY_DIR@")
-- endif ()
--else()
-- if (WIN32)
-- set (VTK_RUNTIME_DIRS "@CMAKE_BINARY_DIR@/bin")
-- else ()
-- set (VTK_RUNTIME_DIRS "@CMAKE_BINARY_DIR@/lib")
-- endif ()
--endif()
-+if (WIN32)
-+ set (VTK_RUNTIME_DIRS "@CMAKE_INSTALL_PREFIX@/@VTK_INSTALL_RUNTIME_DIR@")
-+else ()
-+ set (VTK_RUNTIME_DIRS "@CMAKE_INSTALL_PREFIX@/@VTK_INSTALL_LIBRARY_DIR@")
-+endif ()
-
- # Setup VTK-m if it was enabled
- set(VTK_HAS_VTKM @VTK_HAS_VTKM@)
diff --git a/ports/vtk/fix-find-lz4.patch b/ports/vtk/fix-find-lz4.patch
deleted file mode 100644
index 488640de8..000000000
--- a/ports/vtk/fix-find-lz4.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-diff --git a/CMake/FindLZ4.cmake b/CMake/FindLZ4.cmake
-index 07343e1f79..b43a9af2c7 100644
---- a/CMake/FindLZ4.cmake
-+++ b/CMake/FindLZ4.cmake
-@@ -1,7 +1,13 @@
--
--find_library(LZ4_LIBRARIES NAMES lz4)
-+find_library(LZ4_LIBRARY NAMES lz4 PATH_SUFFIXES lib)
-+find_library(LZ4_LIBRARY_DEBUG NAMES lz4d PATH_SUFFIXES debug/lib)
- find_path(LZ4_INCLUDE_DIRS NAMES lz4.h)
-
-+if(NOT LZ4_LIBRARY_DEBUG)
-+ set(LZ4_LIBRARY_DEBUG ${LZ4_LIBRARY})
-+endif(NOT LZ4_LIBRARY_DEBUG)
-+
-+set(LZ4_LIBRARIES optimized ${LZ4_LIBRARY} debug ${LZ4_LIBRARY_DEBUG})
-+
- include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(LZ4
- DEFAULT_MSG
diff --git a/ports/vtk/fix-find-lzma.patch b/ports/vtk/fix-find-lzma.patch
deleted file mode 100644
index b2e375fc4..000000000
--- a/ports/vtk/fix-find-lzma.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/CMake/FindLZMA.cmake b/CMake/FindLZMA.cmake
-index 213ab18df1..1e290da4cb 100644
---- a/CMake/FindLZMA.cmake
-+++ b/CMake/FindLZMA.cmake
-@@ -1,7 +1,10 @@
-
--find_library(LZMA_LIBRARIES NAMES lzma)
-+find_library(LZMA_LIBRARY_RELEASE NAMES lzma PATH_SUFFIXES lib)
-+find_library(LZMA_LIBRARY_DEBUG NAMES lzmad PATH_SUFFIXES debug/lib)
- find_path(LZMA_INCLUDE_DIRS NAMES lzma.h)
-
-+select_library_configurations(LZMA)
-+
- include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(LZMA
- DEFAULT_MSG
diff --git a/ports/vtk/fix-proj4.patch b/ports/vtk/fix-proj4.patch
deleted file mode 100644
index ad49b1523..000000000
--- a/ports/vtk/fix-proj4.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-diff --git a/Geovis/Core/vtkGeoProjection.cxx b/Geovis/Core/vtkGeoProjection.cxx
-index f3a8852..8240603 100644
---- a/Geovis/Core/vtkGeoProjection.cxx
-+++ b/Geovis/Core/vtkGeoProjection.cxx
-@@ -72,6 +72,9 @@ public:
- }
-
- std::map< std::string, std::string > OptionalParameters;
-+#if PROJ_VERSION_MAJOR >= 5
-+ PJ_PROJ_INFO ProjInfo;
-+#endif
- };
-
- //-----------------------------------------------------------------------------
-@@ -80,7 +83,7 @@ int vtkGeoProjection::GetNumberOfProjections()
- if ( vtkGeoProjectionNumProj < 0 )
- {
- vtkGeoProjectionNumProj = 0;
-- for ( const PJ_LIST* pj = pj_get_list_ref(); pj && pj->id; ++ pj )
-+ for ( const PJ_LIST* pj = proj_list_operations(); pj && pj->id; ++ pj )
- ++ vtkGeoProjectionNumProj;
- }
- return vtkGeoProjectionNumProj;
-@@ -91,7 +94,7 @@ const char* vtkGeoProjection::GetProjectionName( int projection )
- if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
- return nullptr;
-
-- return pj_get_list_ref()[projection].id;
-+ return proj_list_operations()[projection].id;
- }
- //-----------------------------------------------------------------------------
- const char* vtkGeoProjection::GetProjectionDescription( int projection )
-@@ -99,7 +102,7 @@ const char* vtkGeoProjection::GetProjectionDescription( int projection )
- if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
- return nullptr;
-
-- return pj_get_list_ref()[projection].descr[0];
-+ return proj_list_operations()[projection].descr[0];
- }
- //-----------------------------------------------------------------------------
- vtkGeoProjection::vtkGeoProjection()
-@@ -144,7 +147,7 @@ void vtkGeoProjection::PrintSelf( ostream& os, vtkIndent indent )
- int vtkGeoProjection::GetIndex()
- {
- int i = 0;
-- for ( const PJ_LIST* proj = pj_get_list_ref(); proj && proj->id; ++ proj, ++ i )
-+ for ( const PJ_LIST* proj = proj_list_operations(); proj && proj->id; ++ proj, ++ i )
- {
- if ( ! strcmp( proj->id, this->Name ) )
- {
-@@ -161,7 +164,11 @@ const char* vtkGeoProjection::GetDescription()
- {
- return nullptr;
- }
-+#if PROJ_VERSION_MAJOR >= 5
-+ return this->Internals->ProjInfo.description;
-+#else
- return this->Projection->descr;
-+#endif
- }
- //-----------------------------------------------------------------------------
- projPJ vtkGeoProjection::GetProjection()
-@@ -232,6 +239,9 @@ int vtkGeoProjection::UpdateProjection()
- this->ProjectionMTime = this->GetMTime();
- if ( this->Projection )
- {
-+#if PROJ_VERSION_MAJOR >= 5
-+ this->Internals->ProjInfo = proj_pj_info(this->Projection);
-+#endif
- return 0;
- }
- return 1;
-diff --git a/Geovis/Core/vtkGeoTransform.cxx b/Geovis/Core/vtkGeoTransform.cxx
-index aeeabc1..b80a8c0 100644
---- a/Geovis/Core/vtkGeoTransform.cxx
-+++ b/Geovis/Core/vtkGeoTransform.cxx
-@@ -167,9 +167,17 @@ void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int
- double* coord = x;
- for ( vtkIdType i = 0; i < numPts; ++ i )
- {
-+#if PROJ_VERSION_MAJOR >= 5
-+ xy.x = coord[0]; xy.y = coord[1];
-+#else
- xy.u = coord[0]; xy.v = coord[1];
-+#endif
- lp = pj_inv( xy, src );
-+#if PROJ_VERSION_MAJOR >= 5
-+ coord[0] = lp.lam; coord[1] = lp.phi;
-+#else
- coord[0] = lp.u; coord[1] = lp.v;
-+#endif
- coord += stride;
- }
- }
-@@ -191,9 +199,17 @@ void vtkGeoTransform::InternalTransformPoints( double* x, vtkIdType numPts, int
- double* coord = x;
- for ( vtkIdType i = 0; i < numPts; ++ i )
- {
-+#if PROJ_VERSION_MAJOR >= 5
-+ lp.lam = coord[0]; lp.phi = coord[1];
-+#else
- lp.u = coord[0]; lp.v = coord[1];
-+#endif
- xy = pj_fwd( lp, dst );
-+#if PROJ_VERSION_MAJOR >= 5
-+ coord[0] = xy.x; coord[1] = xy.y;
-+#else
- coord[0] = xy.u; coord[1] = xy.v;
-+#endif
- coord += stride;
- }
- }
-diff --git a/ThirdParty/libproj/CMakeLists.txt b/ThirdParty/libproj/CMakeLists.txt
-index a19609e..e23e44b 100644
---- a/ThirdParty/libproj/CMakeLists.txt
-+++ b/ThirdParty/libproj/CMakeLists.txt
-@@ -1,4 +1,9 @@
- vtk_module_third_party(LibPROJ
- LIBRARIES vtklibproj
-+ USE_VARIABLES LibPROJ_MAJOR_VERSION
- INCLUDE_DIRS ${vtklibproj_SOURCE_DIR}/vtklibproj
- ${vtklibproj_BINARY_DIR}/vtklibproj)
-+
-+if (NOT VTK_MODULE_USE_EXTERNAL_VTK_libproj)
-+ set(LibPROJ_MAJOR_VERSION "4")
-+endif ()
-\ No newline at end of file
-diff --git a/ThirdParty/libproj/vtk_libproj.h.in b/ThirdParty/libproj/vtk_libproj.h.in
-index cd9edc3..d441a1a 100644
---- a/ThirdParty/libproj/vtk_libproj.h.in
-+++ b/ThirdParty/libproj/vtk_libproj.h.in
-@@ -17,8 +17,23 @@
-
- /* Use the libproj library configured for VTK. */
- #cmakedefine VTK_USE_SYSTEM_LIBPROJ
-+
-+#define VTK_LibPROJ_MAJOR_VERSION @LibPROJ_MAJOR_VERSION@
-+
-+#if VTK_LibPROJ_MAJOR_VERSION < 5
-+# define PROJ_VERSION_MAJOR @LibPROJ_MAJOR_VERSION@
-+# define proj_list_operations pj_get_list_ref
-+#endif
- #ifdef VTK_USE_SYSTEM_LIBPROJ
--# include <projects.h>
-+# if VTK_LibPROJ_MAJOR_VERSION >= 5
-+# include <proj.h>
-+# endif
-+# if VTK_LibPROJ_MAJOR_VERSION < 6
-+# include <projects.h>
-+# endif
-+# if VTK_LibPROJ_MAJOR_VERSION >= 6
-+# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
-+# endif
- # include <proj_api.h>
- # include <geodesic.h>
- #else
-diff --git a/CMake/FindLibPROJ.cmake b/CMake/FindLibPROJ.cmake
-index 2d8301d..d8d08cd 100644
---- a/CMake/FindLibPROJ.cmake
-+++ b/CMake/FindLibPROJ.cmake
-@@ -5,6 +5,14 @@
- # LibPROJ_LIBRARIES to libproj4 and any dependent libraries
- # If LibPROJ_REQUIRED is defined, then a fatal error message will be generated if libproj4 is not found
-
-+find_package(PROJ4 6 CONFIG REQUIRED)
-+if (PROJ4_FOUND)
-+ set(LibPROJ_FOUND 1)
-+ set(LibPROJ_INCLUDE_DIR ${PROJ4_INCLUDE_DIRS})
-+ set(LibPROJ_LIBRARIES ${PROJ_LIBRARY})
-+ set(LibPROJ_MAJOR_VERSION 6)
-+endif()
-+
- if ( NOT LibPROJ_INCLUDE_DIR OR NOT LibPROJ_LIBRARIES OR NOT LibPROJ_FOUND )
-
- if ( $ENV{LibPROJ_DIR} )
diff --git a/ports/vtk/fix-pugixml-link.patch b/ports/vtk/fix-pugixml-link.patch
deleted file mode 100644
index aadd41adb..000000000
--- a/ports/vtk/fix-pugixml-link.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff --git a/CMake/VTKConfig.cmake.in b/CMake/VTKConfig.cmake.in
-index d28e0cc..7ed48bc 100644
---- a/CMake/VTKConfig.cmake.in
-+++ b/CMake/VTKConfig.cmake.in
-@@ -88,6 +88,9 @@ if(VTK_HAS_VTKM AND NOT TARGET vtkm_cont)
- )
- endif()
-
-+# Find dependencies
-+include(CMakeFindDependencyMacro)
-+find_dependency(pugixml REQUIRED)
-
- #-----------------------------------------------------------------------------
- # Load requested modules.
-diff --git a/IO/CityGML/CMakeLists.txt b/IO/CityGML/CMakeLists.txt
-index ce979ba..744c6f1 100644
---- a/IO/CityGML/CMakeLists.txt
-+++ b/IO/CityGML/CMakeLists.txt
-@@ -4,8 +4,5 @@ vtk_module_library(vtkIOCityGML ${Module_SRCS})
- # pugixml does not set _INCLUDE_DIRS or _LIBRARIES
- if(VTK_USE_SYSTEM_PUGIXML AND NOT pugixml_INCLUDE_DIRS)
- find_package(pugixml REQUIRED)
-- get_target_property(pugixml_INCLUDE_DIRS pugixml INTERFACE_INCLUDE_DIRECTORIES)
-- get_target_property(pugixml_LIBRARIES pugixml LOCATION)
-- include_directories(${pugixml_INCLUDE_DIRS})
-- vtk_module_link_libraries(vtkIOCityGML LINK_PRIVATE ${pugixml_LIBRARIES})
-+ vtk_module_link_libraries(vtkIOCityGML LINK_PUBLIC pugixml)
- endif()
diff --git a/ports/vtk/fix_ogg_linkage.patch b/ports/vtk/fix_ogg_linkage.patch
deleted file mode 100644
index c7f22f4c8..000000000
--- a/ports/vtk/fix_ogg_linkage.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/IO/Movie/module.cmake b/IO/Movie/module.cmake
-index 4275171..88204ad 100644
---- a/IO/Movie/module.cmake
-+++ b/IO/Movie/module.cmake
-@@ -14,6 +14,7 @@ vtk_module(vtkIOMovie
- vtkIO
- DEPENDS
- ${vtkIOMovie_vtkoggtheora}
-+ vtkogg
- vtkCommonExecutionModel
- PRIVATE_DEPENDS
- vtkCommonCore
diff --git a/ports/vtk/hdf5_static.patch b/ports/vtk/hdf5_static.patch
deleted file mode 100644
index 52ade3f08..000000000
--- a/ports/vtk/hdf5_static.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/CMake/FindHDF5.cmake b/CMake/FindHDF5.cmake
-index 6d558e39..c301e165 100644
---- a/CMake/FindHDF5.cmake
-+++ b/CMake/FindHDF5.cmake
-@@ -8,7 +8,16 @@ if(CMAKE_VERSION VERSION_LESS 3.6.1)
- else()
- include(${CMAKE_ROOT}/Modules/FindHDF5.cmake)
- endif()
--
-+#It would be better if VTK would actually use HDF5 & SZIP targets.
-+#But current module load order is wrong which will lead to the target being used before it is defined!
-+if("${HDF5_LIBRARIES}" MATCHES "libhdf5")
-+ find_library(SZIP_LIBRARY_RELEASE NAMES sz libsz szip libszip NAMES_PER_DIR)
-+ find_library(SZIP_LIBRARY_DEBUG NAMES sz_d libsz_d szip_d libszip_d NAMES_PER_DIR)
-+ select_library_configurations(SZIP)
-+ list(APPEND HDF5_LIBRARIES "${SZIP_LIBRARIES}")
-+ find_package(ZLIB)
-+ list(APPEND HDF5_LIBRARIES "${ZLIB_LIBRARIES}")
-+endif()
- if(HDF5_FOUND AND (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL))
- include(vtkMPI)
- if(MPI_C_INCLUDE_PATH)
diff --git a/ports/vtk/pegtl.patch b/ports/vtk/pegtl.patch
new file mode 100644
index 000000000..6374bb3a8
--- /dev/null
+++ b/ports/vtk/pegtl.patch
@@ -0,0 +1,71 @@
+diff --git a/CMake/FindPEGTL.cmake b/CMake/FindPEGTL.cmake
+index 73eee02f7..22d8bc159 100644
+--- a/CMake/FindPEGTL.cmake
++++ b/CMake/FindPEGTL.cmake
+@@ -19,31 +19,40 @@
+ # Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+ # Redistribution and use is allowed according to the terms of the 2-clause BSD license.
+
+-find_path(PEGTL_INCLUDE_DIR
+- NAMES pegtl/version.hpp
+- PATH_SUFFIXES tao
+- DOC "Path to PEGTL headers")
+-mark_as_advanced(PEGTL_INCLUDE_DIR)
++message(STATUS "Searching for PEGTL")
++find_package(PEGTL CONFIG NAMES PEGTL-2)
++if(TARGET taocpp::pegtl)
++ message(STATUS "Searching for PEGTL - found target taocpp::pegtl")
++ set_target_properties(taocpp::pegtl PROPERTIES IMPORTED_GLOBAL TRUE)
++ add_library(PEGTL::PEGTL ALIAS taocpp::pegtl)
++else()
++ find_path(PEGTL_INCLUDE_DIR
++ NAMES pegtl/version.hpp
++ PATH_SUFFIXES tao
++ DOC "Path to PEGTL headers")
++ mark_as_advanced(PEGTL_INCLUDE_DIR)
+
+-if (PEGTL_INCLUDE_DIR)
+- file(STRINGS "${PEGTL_INCLUDE_DIR}/pegtl/version.hpp" _pegtl_version_header
+- REGEX "TAO_PEGTL_VERSION")
+- string(REGEX MATCH "define[ \t]+TAO_PEGTL_VERSION[ \t]+\"([0-9.]+)\"" _pegtl_version_match "${_pegtl_version_header}")
+- set(PEGTL_VERSION "${CMAKE_MATCH_1}")
+- unset(_pegtl_version_header)
+- unset(_pegtl_version_match)
+-endif ()
++ if (PEGTL_INCLUDE_DIR)
++ file(STRINGS "${PEGTL_INCLUDE_DIR}/pegtl/version.hpp" _pegtl_version_header
++ REGEX "TAO_PEGTL_VERSION")
++ string(REGEX MATCH "define[ \t]+TAO_PEGTL_VERSION[ \t]+\"([0-9.]+)\"" _pegtl_version_match "${_pegtl_version_header}")
++ set(PEGTL_VERSION "${CMAKE_MATCH_1}")
++ unset(_pegtl_version_header)
++ unset(_pegtl_version_match)
++ endif ()
+
+-include(FindPackageHandleStandardArgs)
+-find_package_handle_standard_args(PEGTL
+- REQUIRED_VARS PEGTL_INCLUDE_DIR
+- VERSION_VAR PEGTL_VERSION)
++ include(FindPackageHandleStandardArgs)
++ find_package_handle_standard_args(PEGTL
++ REQUIRED_VARS PEGTL_INCLUDE_DIR
++ VERSION_VAR PEGTL_VERSION)
+
+-if (PEGTL_FOUND)
+- set(PEGTL_INCLUDE_DIRS "${PEGTL_INCLUDE_DIR}")
+- if (NOT TARGET PEGTL::PEGTL)
+- add_library(PEGTL::PEGTL INTERFACE IMPORTED)
+- set_target_properties(PEGTL::PEGTL PROPERTIES
+- INTERFACE_INCLUDE_DIRECTORIES "${PEGTL_INCLUDE_DIR}")
+- endif ()
+-endif ()
++ if (PEGTL_FOUND)
++ set(PEGTL_INCLUDE_DIRS "${PEGTL_INCLUDE_DIR}")
++ if (NOT TARGET PEGTL::PEGTL)
++ add_library(PEGTL::PEGTL INTERFACE IMPORTED)
++ set_target_properties(PEGTL::PEGTL PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${PEGTL_INCLUDE_DIR}")
++ endif ()
++ message(STATUS "Searching for PEGTL - found")
++ endif ()
++endif ()
+\ No newline at end of file
diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake
index b42f0d356..790a90115 100644
--- a/ports/vtk/portfile.cmake
+++ b/ports/vtk/portfile.cmake
@@ -2,122 +2,152 @@ 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()
-set(VTK_SHORT_VERSION "8.2")
-set(VTK_LONG_VERSION "${VTK_SHORT_VERSION}.0")
-# =============================================================================
-# Options:
-vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
- qt VTK_WITH_QT
- mpi VTK_Group_MPI
- python VTK_WITH_PYTHON
- openvr Module_vtkRenderingOpenVR
- atlmfc Module_vtkGUISupportMFC
-)
-
-set(VTK_WITH_ALL_MODULES OFF) # IMPORTANT: if ON make sure `qt5`, `mpi`, `python3`, `ffmpeg`, `gdal`, `fontconfig`,
- # `libmysql` and `atlmfc` are listed as dependency in the CONTROL file
-
-# =============================================================================
-# Clone & patch
-vcpkg_from_github(
- OUT_SOURCE_PATH SOURCE_PATH
- REPO Kitware/VTK
- REF "v${VTK_LONG_VERSION}"
- SHA512 fd1d9c2872baa6eca7f8105b0057b56ec554e9d5eaf25985302e7fc032bdce72255d79e3f5f16ca50504151bda49cb3a148272ba32e0f410b4bdb70959b8f3f4
- HEAD_REF master
- PATCHES
- fix-find-lz4.patch
- fix_ogg_linkage.patch
- fix-pugixml-link.patch
- hdf5_static.patch
- fix-find-lzma.patch
- fix-proj4.patch
- fix-VTKConfig-cmake.patch
-)
-
-# Remove the FindGLEW.cmake and FindPythonLibs.cmake that are distributed with VTK,
-# since they do not detect the debug libraries correctly.
-# The default files distributed with CMake (>= 3.9) should be superior by all means.
-# For GDAL, the one distributed with CMake does not detect the debug libraries correctly,
-# so we provide an own one.
-file(REMOVE ${SOURCE_PATH}/CMake/FindGLEW.cmake)
-file(REMOVE ${SOURCE_PATH}/CMake/FindPythonLibs.cmake)
-
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindGDAL.cmake DESTINATION ${SOURCE_PATH}/CMake)
+# TODO:
+# - add loguru as a dependency requires #8682
# =============================================================================
+# Options:
# Collect CMake options for optional components
-if(VTK_WITH_QT)
+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("vtkm" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
- -DVTK_Group_Qt=ON
- -DVTK_QT_VERSION=5
- -DVTK_BUILD_QT_DESIGNER_PLUGIN=OFF
+ -DVTK_MODULE_ENABLE_VTK_AcceleratorsVTKm=YES
+ -DVTK_MODULE_ENABLE_VTK_vtkm=YES
)
endif()
-if(VTK_WITH_PYTHON)
+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
+ -DCMAKE_DISABLE_FIND_PACKAGE_Python3=TRUE
+ "-DPython3_EXECUTABLE:PATH=${PYTHON3}"
)
+
+ if(VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND ADDITIONAL_OPTIONS "-DPython3_LIBRARY_RELEASE:PATH=${CURRENT_INSTALLED_DIR}/lib/python37.lib"
+ "-DPython3_LIBRARY_DEBUG:PATH=${CURRENT_INSTALLED_DIR}/debug/lib/python37_d.lib"
+ "-DPython3_LIBRARIES:STRING=debug\\\\\\\;${CURRENT_INSTALLED_DIR}/debug/lib/python37_d.lib\\\\\\\;optimized\\\\\\\;${CURRENT_INSTALLED_DIR}/lib/python37.lib"
+ "-DPYTHON_DEBUG_LIBRARY:PATH=${CURRENT_INSTALLED_DIR}/debug/lib/python37_d.lib"
+ "-DPython3_INCLUDE_DIR:PATH=${CURRENT_INSTALLED_DIR}/include/python3.7")
+ elseif(VCPKG_TARGET_IS_LINUX)
+ list(APPEND ADDITIONAL_OPTIONS "-DPython3_LIBRARY_RELEASE:PATH=${CURRENT_INSTALLED_DIR}/lib/libpython37m.a"
+ "-DPython3_LIBRARY_DEBUG:PATH=${CURRENT_INSTALLED_DIR}/debug/lib/libpython37md.a"
+ "-DPython3_LIBRARIES:STRING=debug\\\\\\\;${CURRENT_INSTALLED_DIR}/debug/lib/libpython37md.a\\\\\\\;optimized\\\\\\\;${CURRENT_INSTALLED_DIR}/lib/libpython37m.a"
+ "-DPYTHON_DEBUG_LIBRARY:PATH=${CURRENT_INSTALLED_DIR}/debug/lib/libpython37md.a"
+ "-DPython3_INCLUDE_DIR:PATH=${CURRENT_INSTALLED_DIR}/include/python3.7m")
+ elseif(VCPKG_TARGET_IS_OSX)
+ #Need Python3 information on OSX within VCPKG
+ endif()
+
+ #VTK_PYTHON_SITE_PACKAGES_SUFFIX should be set to the install dir of the site-packages
endif()
-if(VTK_WITH_ALL_MODULES)
+if("paraview" IN_LIST FEATURES)
list(APPEND ADDITIONAL_OPTIONS
- -DVTK_BUILD_ALL_MODULES=ON
- -DVTK_USE_TK=OFF # TCL/TK currently not included in vcpkg
- # -DVTK_USE_SYSTEM_AUTOBAHN=ON
- # -DVTK_USE_SYSTEM_SIX=ON
- # -DVTK_USE_SYSTEM_MPI4PY=ON
- # -DVTK_USE_SYSTEM_CONSTANTLY=ON
- # -DVTK_USE_SYSTEM_INCREMENTAL=ON
- # -DVTK_USE_SYSTEM_TWISTED=ON
- # -DVTK_USE_SYSTEM_XDMF2=ON
- # -DVTK_USE_SYSTEM_XDMF3=ON
- # -DVTK_USE_SYSTEM_ZFP=ON
- # -DVTK_USE_SYSTEM_ZOPE=ON
- # -DVTK_USE_SYSTEM_LIBPROJ=ON
+ -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
)
+ if("python" IN_LIST FEATURES)
+ list(APPEND ADDITIONAL_OPTIONS
+ -DVTK_MODULE_ENABLE_VTK_RenderingMatplotlib=YES
+ )
+ endif()
endif()
-if (VCPKG_TARGET_IS_WINDOWS)
- set(PROJ_LIBRARY_REL "${CURRENT_INSTALLED_DIR}/lib/proj.lib")
- set(PROJ_LIBRARY_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/proj_d.lib")
-else()
- set(PROJ_LIBRARY_REL "${CURRENT_INSTALLED_DIR}/lib/libproj.a")
- set(PROJ_LIBRARY_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libproj.a")
+if("mpi" IN_LIST FEATURES)
+ list(APPEND ADDITIONAL_OPTIONS
+ -DVTK_GROUP_ENABLE_MPI=YES
+ )
+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
+ "cuda" VTK_USE_CUDA
+ "all" VTK_BUILD_ALL_MODULES
+)
+
+
+# =============================================================================
+# Clone & patch
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Kitware/VTK
+ REF ab278e87b181e3a02082bea7361fbaa3ddafb3ad # v9.0
+ SHA512 50a324f55b58bc4415f972f711420e83b41a100b27729266db4541c24bc7d7bcd27d9158ce2588178b9b2e43c20b9695ffe382605f5cde331e8371e213655164
+ HEAD_REF master
+ PATCHES
+ FindLibHaru.patch
+ FindLZMA.patch
+ FindLZ4.patch
+ Findproj.patch
+ vtkm.patch # To include an external VTKm build (v.1.5 required)
+ pegtl.patch
+ ##pythonwrapper.patch # needs checking with paraview PR if still required
+ ##NoUndefDebug.patch # needs checking with paraview PR if still required
+ # Last patch TODO: Patch out internal loguru
+)
+
+# =============================================================================
+#Overwrite outdated modules if they have not been patched:
+file(COPY "${CURRENT_PORT_DIR}/FindPostgreSQL.cmake" DESTINATION "${SOURCE_PATH}/CMake")
+file(COPY "${CURRENT_PORT_DIR}/FindHDF5.cmake" DESTINATION "${SOURCE_PATH}/CMake/patches/99")
+# =============================================================================
+
# =============================================================================
# Configure & Install
+# We set all libraries to "system" and explicitly list the ones that should use embedded copies
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
-DBUILD_TESTING=OFF
- -DBUILD_EXAMPLES=OFF
+ -DVTK_BUILD_TESTING=OFF
+ -DVTK_BUILD_EXAMPLES=OFF
-DVTK_INSTALL_INCLUDE_DIR=include
-DVTK_INSTALL_DATA_DIR=share/vtk/data
-DVTK_INSTALL_DOC_DIR=share/vtk/doc
-DVTK_INSTALL_PACKAGE_DIR=share/vtk
-DVTK_INSTALL_RUNTIME_DIR=bin
-DVTK_FORBID_DOWNLOADS=ON
-
- # We set all libraries to "system" and explicitly list the ones that should use embedded copies
- -DVTK_USE_SYSTEM_LIBRARIES=ON
- -DVTK_USE_SYSTEM_GL2PS=OFF
-
+ # VTK groups to enable
+ -DVTK_GROUP_ENABLE_StandAlone=YES
+ -DVTK_GROUP_ENABLE_Rendering=YES
+ -DVTK_GROUP_ENABLE_Views=YES
+ # Disable deps not in VCPKG
+ -DVTK_USE_TK=OFF # TCL/TK currently not included in vcpkg
# Select modules / groups to install
- -DVTK_Group_Imaging=ON
- -DVTK_Group_Views=ON
- -DPYTHON_EXECUTABLE=${PYTHON3}
+ -DVTK_USE_EXTERNAL:BOOL=ON
+ -DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps:BOOL=OFF # Not yet in VCPKG
${ADDITIONAL_OPTIONS}
- OPTIONS_RELEASE
- -DPROJ_LIBRARY=${PROJ_LIBRARY_REL}
- OPTIONS_DEBUG
- -DPROJ_LIBRARY=${PROJ_LIBRARY_DBG}
)
vcpkg_install_cmake()
@@ -125,99 +155,71 @@ vcpkg_copy_pdbs()
# =============================================================================
# Fixup target files
-vcpkg_fixup_cmake_targets()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/vtk-9.0)
+# TODO: Check if the following is still required
# For some reason the references to the XDMF libraries in the target files do not end up
# correctly, so we fix them here.
-if(VTK_WITH_ALL_MODULES)
- if(EXISTS ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake)
- file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake VTK_TARGETS_RELEASE_CONTENT)
- string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
- string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
- string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
- string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
- file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake "${VTK_TARGETS_RELEASE_CONTENT}")
- endif()
+# if(VTK_WITH_ALL_MODULES)
+ # file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake VTK_TARGETS_RELEASE_CONTENT)
+ # string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
+ # string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
+ # string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
+ # string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}")
+ # file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake "${VTK_TARGETS_RELEASE_CONTENT}")
- if(EXISTS ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake)
- file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake VTK_TARGETS_DEBUG_CONTENT)
- string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
- string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
- string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
- string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
- file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake "${VTK_TARGETS_DEBUG_CONTENT}")
- endif()
-endif()
-
-#file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" VTK_TARGETS_CONTENT)
-# Remove unset of _IMPORT_PREFIX in VTKTargets.cmake
-#_IMPORT_PREFIX is required by vtkModules due to vcpkg_fixup_cmake_targets changing all cmake files (to use _IMPORT_PREFIX).
-#STRING(REPLACE [[set(_IMPORT_PREFIX)]]
-#[[
-# VCPKG: The value of _IMPORT_PREFIX should not be unset.
-#set(_IMPORT_PREFIX)
-#]]
-#VTK_TARGETS_CONTENT "${VTK_TARGETS_CONTENT}")
-#file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" "${VTK_TARGETS_CONTENT}")
-
-#file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" VTK_TARGETS_CONTENT)
-
-# Fix _IMPORT_PREFIX. It is not set within the Modules cmake (only set in VTKTargets.cmake).
-# Since for VCPKG _IMPORT_PREFIX == VTK_INSTALL_PREFIX we just replace it with that.
-file(GLOB_RECURSE CMAKE_FILES ${CURRENT_PACKAGES_DIR}/share/vtk/Modules/*.cmake)
-foreach(FILE IN LISTS CMAKE_FILES)
- file(READ "${FILE}" _contents)
- string(REPLACE "\${_IMPORT_PREFIX}" "\${VTK_INSTALL_PREFIX}" _contents "${_contents}")
- file(WRITE "${FILE}" "${_contents}")
-endforeach()
+ # file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake VTK_TARGETS_DEBUG_CONTENT)
+ # string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
+ # string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
+ # string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
+ # string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}")
+ # file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake "${VTK_TARGETS_DEBUG_CONTENT}")
+# endif()
+# =============================================================================
+# Remove other files and directories that are not valid for vcpkg
+# if(VTK_WITH_ALL_MODULES)
+ # file(REMOVE ${CURRENT_PACKAGES_DIR}/XdmfConfig.cmake)
+ # file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/XdmfConfig.cmake)
+# endif()
# =============================================================================
# Clean-up other directories
+
# Delete the debug binary TOOL_NAME that is not required
function(_vtk_remove_debug_tool TOOL_NAME)
- # on windows, the tools end with .exe
- set(filename_win ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME}.exe)
- if(EXISTS ${filename_win})
- file(REMOVE ${filename_win})
+ set(filename ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME}${VCPKG_TARGET_EXECUTABLE_SUFFIX})
+ if(EXISTS ${filename})
+ file(REMOVE ${filename})
endif()
- # on other OS, it doesn't
- set(filename_unix ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME})
- if(EXISTS ${filename_unix})
- file(REMOVE ${filename_unix})
+ set(filename ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME}d${VCPKG_TARGET_EXECUTABLE_SUFFIX})
+ if(EXISTS ${filename})
+ file(REMOVE ${filename})
endif()
# we also have to bend the lines referencing the tools in VTKTargets-debug.cmake
# to make them point to the release version of the tools
- if(EXISTS ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake)
- file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake" VTK_TARGETS_CONTENT_DEBUG)
- string(REPLACE "debug/bin/${TOOL_NAME}" "tools/vtk/${TOOL_NAME}" VTK_TARGETS_CONTENT_DEBUG "${VTK_TARGETS_CONTENT_DEBUG}")
- file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake" "${VTK_TARGETS_CONTENT_DEBUG}")
- endif()
+ file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTK-targets-debug.cmake" VTK_TARGETS_CONTENT_DEBUG)
+ string(REPLACE "debug/bin/${TOOL_NAME}" "tools/vtk/${TOOL_NAME}" VTK_TARGETS_CONTENT_DEBUG "${VTK_TARGETS_CONTENT_DEBUG}")
+ string(REPLACE "tools/vtk/${TOOL_NAME}d" "tools/vtk/${TOOL_NAME}" VTK_TARGETS_CONTENT_DEBUG "${VTK_TARGETS_CONTENT_DEBUG}")
+ file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTK-targets-debug.cmake" "${VTK_TARGETS_CONTENT_DEBUG}")
endfunction()
# Move the release binary TOOL_NAME from bin to tools
function(_vtk_move_release_tool TOOL_NAME)
- # on windows, the tools end with .exe
- set(old_filename_win "${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}.exe")
- if(EXISTS ${old_filename_win})
- file(INSTALL ${old_filename_win} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/vtk")
- file(REMOVE ${old_filename_win})
- endif()
- # on other OS, it doesn't
- set(old_filename_unix "${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}")
- if(EXISTS ${old_filename_unix})
- file(INSTALL ${old_filename_unix} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/vtk")
- file(REMOVE ${old_filename_unix})
+ set(old_filename "${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
+ if(EXISTS ${old_filename})
+ file(INSTALL ${old_filename} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/vtk" USE_SOURCE_PERMISSIONS)
+ file(REMOVE ${old_filename})
endif()
+
# we also have to bend the lines referencing the tools in VTKTargets-release.cmake
# to make them point to the tool folder
- if(EXISTS ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake)
- file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake" VTK_TARGETS_CONTENT_RELEASE)
- string(REPLACE "bin/${TOOL_NAME}" "tools/vtk/${TOOL_NAME}" VTK_TARGETS_CONTENT_RELEASE "${VTK_TARGETS_CONTENT_RELEASE}")
- file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake" "${VTK_TARGETS_CONTENT_RELEASE}")
- endif()
+ file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTK-targets-release.cmake" VTK_TARGETS_CONTENT_RELEASE)
+ string(REPLACE "bin/${TOOL_NAME}" "tools/vtk/${TOOL_NAME}" VTK_TARGETS_CONTENT_RELEASE "${VTK_TARGETS_CONTENT_RELEASE}")
+ file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTK-targets-release.cmake" "${VTK_TARGETS_CONTENT_RELEASE}")
endfunction()
+set(VTK_SHORT_VERSION 9.0)
set(VTK_TOOLS
vtkEncodeString-${VTK_SHORT_VERSION}
vtkHashSource-${VTK_SHORT_VERSION}
@@ -229,27 +231,18 @@ set(VTK_TOOLS
vtkWrapHierarchy-${VTK_SHORT_VERSION}
vtkParseJava-${VTK_SHORT_VERSION}
vtkParseOGLExt-${VTK_SHORT_VERSION}
+ vtkProbeOpenGLVersion-${VTK_SHORT_VERSION}
+ vtkTestOpenGLVersion-${VTK_SHORT_VERSION}
vtkpython
pvtkpython
)
-
+# TODO: Replace with vcpkg_copy_tools if known which tools are built with which feature
+# or add and option to vcpkg_copy_tools which does not require the tool to be present
foreach(TOOL_NAME IN LISTS VTK_TOOLS)
_vtk_remove_debug_tool("${TOOL_NAME}")
_vtk_move_release_tool("${TOOL_NAME}")
endforeach()
-file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/Modules/vtkhdf5.cmake" _contents)
-string(REPLACE "vtk::hdf5::hdf5_hl" "" _contents "${_contents}")
-string(REPLACE "vtk::hdf5::hdf5" "" _contents "${_contents}")
-file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/Modules/vtkhdf5.cmake" "${_contents}")
-
-# =============================================================================
-# Remove other files and directories that are not valid for vcpkg
-if(VTK_WITH_ALL_MODULES)
- file(REMOVE ${CURRENT_PACKAGES_DIR}/XdmfConfig.cmake)
- file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/XdmfConfig.cmake)
-endif()
-
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
@@ -258,8 +251,45 @@ endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
-vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/vtk)
-
# =============================================================================
# Handle copyright
-file(INSTALL ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/vtk/Copyright.txt ${CURRENT_PACKAGES_DIR}/share/vtk/copyright)
+
+vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/vtk")
+
+## Files Modules needed by ParaView
+if("paraview" IN_LIST FEATURES)
+ set(VTK_CMAKE_NEEDED vtkCompilerChecks vtkCompilerPlatformFlags vtkCompilerExtraFlags vtkInitializeBuildType vtkSupportMacros vtkDirectories vtkVersion FindPythonModules)
+ foreach(module ${VTK_CMAKE_NEEDED})
+ file(INSTALL "${SOURCE_PATH}/CMake/${module}.cmake" DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk)
+ endforeach()
+ file(INSTALL "${SOURCE_PATH}/CMake/vtkRequireLargeFilesSupport.cxx" DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk)
+
+ #ParaView requires some internal headers
+ file(INSTALL ${SOURCE_PATH}/Rendering/Annotation/vtkScalarBarActorInternal.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/vtk-${VTK_SHORT_VERSION})
+ file(INSTALL ${SOURCE_PATH}/Filters/Statistics/vtkStatisticsAlgorithmPrivate.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/vtk-${VTK_SHORT_VERSION})
+ file(INSTALL ${SOURCE_PATH}/Rendering/OpenGL2/vtkCompositePolyDataMapper2Internal.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/vtk-${VTK_SHORT_VERSION})
+ file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Rendering/OpenGL2/vtkTextureObjectVS.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/vtk-${VTK_SHORT_VERSION})
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/CMakeFiles/static_python) #python headers
+ file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/CMakeFiles/static_python DESTINATION ${CURRENT_PACKAGES_DIR}/include/vtk-${VTK_SHORT_VERSION})
+ endif()
+endif()
+
+#remove one get_filename_component(_vtk_module_import_prefix "${_vtk_module_import_prefix}" DIRECTORY) from vtk-prefix.cmake and VTK-vtk-module-properties and vtk-python.cmake
+set(filenames_fix_prefix vtk-prefix VTK-vtk-module-properties vtk-python)
+foreach(name IN LISTS filenames_fix_prefix)
+if(EXISTS "${CURRENT_PACKAGES_DIR}/share/vtk/${name}.cmake")
+ file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/${name}.cmake" _contents)
+ string(REPLACE
+[[set(_vtk_module_import_prefix "${CMAKE_CURRENT_LIST_DIR}")
+get_filename_component(_vtk_module_import_prefix "${_vtk_module_import_prefix}" DIRECTORY)]]
+[[set(_vtk_module_import_prefix "${CMAKE_CURRENT_LIST_DIR}")]] _contents "${_contents}")
+ file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/${name}.cmake" "${_contents}")
+else()
+ debug_message("FILE:${CURRENT_PACKAGES_DIR}/share/vtk/${name}.cmake does not exist! No prefix correction!")
+endif()
+endforeach()
diff --git a/ports/vtk/pythonwrapper.patch b/ports/vtk/pythonwrapper.patch
new file mode 100644
index 000000000..d7585cf0f
--- /dev/null
+++ b/ports/vtk/pythonwrapper.patch
@@ -0,0 +1,19 @@
+diff --git a/CMake/vtkModuleWrapPython.cmake b/CMake/vtkModuleWrapPython.cmake
+index 5d2c2e1bf..e33a16d68 100644
+--- a/CMake/vtkModuleWrapPython.cmake
++++ b/CMake/vtkModuleWrapPython.cmake
+@@ -75,10 +75,13 @@ function (_vtk_module_wrap_python_sources module sources classes)
+ "$<TARGET_PROPERTY:${_vtk_python_target_name},COMPILE_DEFINITIONS>")
+ set(_vtk_python_genex_include_directories
+ "$<TARGET_PROPERTY:${_vtk_python_target_name},INCLUDE_DIRECTORIES>")
++ set(_vtk_python_genex_interface_include_directories
++ "$<TARGET_PROPERTY:${_vtk_python_target_name},INTERFACE_INCLUDE_DIRECTORIES>")
+ file(GENERATE
+ OUTPUT "${_vtk_python_args_file}"
+ CONTENT "$<$<BOOL:${_vtk_python_genex_compile_definitions}>:\n-D\'$<JOIN:${_vtk_python_genex_compile_definitions},\'\n-D\'>\'>\n
+-$<$<BOOL:${_vtk_python_genex_include_directories}>:\n-I\'$<JOIN:${_vtk_python_genex_include_directories},\'\n-I\'>\'>\n")
++$<$<BOOL:${_vtk_python_genex_include_directories}>:\n-I\'$<JOIN:${_vtk_python_genex_include_directories},\'\n-I\'>\'>\n
++$<$<BOOL:${_vtk_python_genex_interface_include_directories}>:\n-I\'$<JOIN:${_vtk_python_genex_interface_include_directories},\'\n-I\'>\'>\n")
+
+ _vtk_module_get_module_property("${module}"
+ PROPERTY "hierarchy"
diff --git a/ports/vtk/vtkm.patch b/ports/vtk/vtkm.patch
new file mode 100644
index 000000000..27b7f4094
--- /dev/null
+++ b/ports/vtk/vtkm.patch
@@ -0,0 +1,141 @@
+diff --git a/Accelerators/Vtkm/CMakeLists.txt b/Accelerators/Vtkm/CMakeLists.txt
+index 4297575bd..643df6fd5 100644
+--- a/Accelerators/Vtkm/CMakeLists.txt
++++ b/Accelerators/Vtkm/CMakeLists.txt
+@@ -14,8 +14,10 @@
+ ##
+ ##=============================================================================
+
+-list(INSERT 0 CMAKE_MODULE_PATH
+- "${VTK_SOURCE_DIR}/ThirdParty/vtkm/vtkvtkm/vtk-m/CMake")
++find_package(VTKm CONFIG REQUIRED)
++
++#list(INSERT 0 CMAKE_MODULE_PATH
++# "${VTK_SOURCE_DIR}/ThirdParty/vtkm/vtkvtkm/vtk-m/CMake")
+
+ set(sources
+ vtkmlib/ArrayConvertersReal.cxx
+diff --git a/Accelerators/Vtkm/CMakeLists.txt b/Accelerators/Vtkm/CMakeLists.txt
+index a01a6bda3..889c87ebb 100644
+--- a/Accelerators/Vtkm/CMakeLists.txt
++++ b/Accelerators/Vtkm/CMakeLists.txt
+@@ -126,9 +126,9 @@ vtkm_add_target_information(${vtkm_accel_target}
+ MODIFY_CUDA_FLAGS
+ DEVICE_SOURCES ${sources})
+
+-vtk_module_set_property(VTK::AcceleratorsVTKm
+- PROPERTY JOB_POOL_COMPILE
+- VALUE vtkm_pool)
++#vtk_module_set_property(VTK::AcceleratorsVTKm
++# PROPERTY JOB_POOL_COMPILE
++# VALUE vtkm_pool)
+ vtk_module_link(VTK::AcceleratorsVTKm
+ PRIVATE
+ vtkm_worklet
+diff --git a/CMake/FindVTKm.cmake b/CMake/FindVTKm.cmake
+new file mode 100644
+index 000000000..c0fe00c0e
+--- /dev/null
++++ b/CMake/FindVTKm.cmake
+@@ -0,0 +1 @@
++find_package(VTKm CONFIG REQUIRED)
+\ No newline at end of file
+diff --git a/CMake/vtkCompilerPlatformFlags.cmake b/CMake/vtkCompilerPlatformFlags.cmake
+index b0bdba1e6..69c570a25 100644
+--- a/CMake/vtkCompilerPlatformFlags.cmake
++++ b/CMake/vtkCompilerPlatformFlags.cmake
+@@ -107,7 +107,7 @@ if(MSVC)
+ if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+ STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ else()
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /bigobj")
+ endif()
+ endif()
+
+diff --git a/ThirdParty/vtkm/CMakeLists.txt b/ThirdParty/vtkm/CMakeLists.txt
+index 5817d42f8..bc5a33d93 100644
+--- a/ThirdParty/vtkm/CMakeLists.txt
++++ b/ThirdParty/vtkm/CMakeLists.txt
+@@ -1,6 +1,47 @@
+-vtk_module_third_party_internal(
+- LICENSE_FILES "vtkvtkm/vtk-m/LICENSE.txt"
+- VERSION "master"
+- SUBDIRECTORY vtkvtkm
+- STANDARD_INCLUDE_DIRS
+- INTERFACE)
++#vtk_module_third_party_internal(
++# LICENSE_FILES "vtkvtkm/vtk-m/LICENSE.txt"
++# VERSION "master"
++# SUBDIRECTORY vtkvtkm
++# STANDARD_INCLUDE_DIRS
++# INTERFACE)
++
++message(STATUS "VTK_MODULE_USE_EXTERNAL_VTK_vtkm: ${VTK_MODULE_USE_EXTERNAL_VTK_vtkm}")
++if(TRUE)
++ message(STATUS "Searching for external VTKm")
++ find_package(VTKm CONFIG REQUIRED)
++ if(TARGET vtkm_compiler_flags)
++ get_target_property(VTKm_INCLUDE_DIRS vtkm_compiler_flags INTERFACE_INCLUDE_DIRECTORIES)
++ message(STATUS "INCLUDE: ${VTKm_INCLUDE_DIRS}")
++ get_target_property(VTKm_DIY_INCLUDE_DIRS vtkm_diy INTERFACE_INCLUDE_DIRECTORIES)
++ get_target_property(VTKm_OPTION_INCLUDE_DIRS vtkm_optionparser INTERFACE_INCLUDE_DIRECTORIES)
++ get_target_property(VTKm_TAO_INCLUDE_DIRS vtkm_taotuple INTERFACE_INCLUDE_DIRECTORIES)
++ if(MSVC)
++ set(VTKm_DEFINITIONS /bigobj)
++ endif()
++ else()
++ message(FATAL_ERROR "VTKM target missing")
++ endif()
++ if(VTKM_FOUND)
++ message(STATUS "Found VTKm")
++ endif()
++endif()
++
++vtk_module_third_party(
++ INTERNAL
++ HEADER_ONLY
++ LICENSE_FILES "vtkvtkm/vtk-m/LICENSE.txt"
++ VERSION "master"
++ SUBDIRECTORY vtkvtkm
++ STANDARD_INCLUDE_DIRS
++ INTERFACE
++ EXTERNAL
++ PACKAGE VTKm
++ TARGETS vtkm_cont vtkm_filter vtkm_diy vtkm_optionparser vtkm_taotuple
++ #LIBRARIES vtkm_cont vtkm_filter vtkm_diy vtkm_optionparser vtkm_taotuple
++ INCLUDE_DIRS VTKm_INCLUDE_DIRS VTKm_DIY_INCLUDE_DIRS VTKm_OPTION_INCLUDE_DIRS VTKm_TAO_INCLUDE_DIRS)
++# configure_file(
++ # "${CMAKE_CURRENT_SOURCE_DIR}/vtk_utf8.h.in"
++ # "${CMAKE_CURRENT_BINARY_DIR}/vtk_utf8.h")
++
++# vtk_module_install_headers(
++ # FILES "${CMAKE_CURRENT_BINARY_DIR}/vtk_utf8.h")
+diff --git a/ThirdParty/vtkm/vtk.module b/ThirdParty/vtkm/vtk.module
+index a8e4dad0f..c7bbbf0e8 100644
+--- a/ThirdParty/vtkm/vtk.module
++++ b/ThirdParty/vtkm/vtk.module
+@@ -3,5 +3,7 @@ NAME
+ PRIVATE_DEPENDS
+ # While not needed to satisfy symbols, this is necessary to guarantee that
+ # VTK_SMP_IMPLEMENTATION_TYPE is available when configuring vtk-m.
+- VTK::CommonCore
++ # VTK::CommonCore
++LIBRARY_NAME
++ VTKm
+ THIRD_PARTY
+diff --git a/CMake/vtk-config.cmake.in b/CMake/vtk-config.cmake.in
+index 1ecfde326..ae5576e66 100644
+--- a/CMake/vtk-config.cmake.in
++++ b/CMake/vtk-config.cmake.in
+@@ -114,9 +114,7 @@ set("${CMAKE_FIND_PACKAGE_NAME}_AVAILABLE_COMPONENTS" "@vtk_all_components@")
+ unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
+ set("${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm" "@vtk_has_vtkm@")
+ if (${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm)
+- find_package(VTKm
+- PATHS "${CMAKE_CURRENT_LIST_DIR}/vtkm"
+- NO_DEFAULT_PATH)
++ find_package(VTKm CONFIG REQUIRED)
+ if (NOT VTKm_FOUND)
+ set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
+ endif ()