From eb5b7e149f93e073d6c6587942013cf31bf83cf9 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sun, 6 Aug 2017 11:37:27 +0200 Subject: [PATCH 01/10] Update VTK to version 8.0. --- ports/vtk/CONTROL | 2 +- ports/vtk/disable-workaround-findhdf5.patch | 23 ---------- ports/vtk/dont-define-ssize_t.patch | 13 ------ ports/vtk/fix-findhdf5-shared.patch | 20 --------- ports/vtk/netcdf-use-hdf5-definitions.patch | 10 ----- ports/vtk/portfile.cmake | 44 ++++++++----------- ...ransfer-3rd-party-module-definitions.patch | 26 ----------- ports/vtk/transfer-hdf5-definitions.patch | 10 ----- 8 files changed, 20 insertions(+), 128 deletions(-) delete mode 100644 ports/vtk/disable-workaround-findhdf5.patch delete mode 100644 ports/vtk/dont-define-ssize_t.patch delete mode 100644 ports/vtk/fix-findhdf5-shared.patch delete mode 100644 ports/vtk/netcdf-use-hdf5-definitions.patch delete mode 100644 ports/vtk/transfer-3rd-party-module-definitions.patch delete mode 100644 ports/vtk/transfer-hdf5-definitions.patch diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL index 2b273560a..b1a06c9ad 100644 --- a/ports/vtk/CONTROL +++ b/ports/vtk/CONTROL @@ -1,4 +1,4 @@ Source: vtk -Version: 7.1.1-1 +Version: 8.0.0 Description: Software system for 3D computer graphics, image processing, and visualization Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi diff --git a/ports/vtk/disable-workaround-findhdf5.patch b/ports/vtk/disable-workaround-findhdf5.patch deleted file mode 100644 index c896af2f5..000000000 --- a/ports/vtk/disable-workaround-findhdf5.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/CMake/vtkModuleMacros.cmake b/CMake/vtkModuleMacros.cmake -index fdd83ed8fc..4986582a5b 100644 ---- a/CMake/vtkModuleMacros.cmake -+++ b/CMake/vtkModuleMacros.cmake -@@ -885,18 +885,6 @@ macro(vtk_module_third_party _pkg) - set(vtk${_lower}_DEFINITIONS ${${_upper}_DEFINITIONS}) - endif() - -- #a workaround for bad FindHDF5 behavior in which deb or opt can -- #end up empty. cmake >= 2.8.12.2 makes this uneccessary -- string(REGEX MATCH "debug;.*optimized;.*" -- _remove_deb_opt "${vtk${_lower}_LIBRARIES}") -- if (_remove_deb_opt) -- set(_tmp ${vtk${_lower}_LIBRARIES}) -- list(REMOVE_ITEM _tmp "debug") -- list(REMOVE_ITEM _tmp "optimized") -- list(REMOVE_DUPLICATES _tmp) -- set(vtk${_lower}_LIBRARIES ${_tmp}) -- endif() -- - set(vtk${_lower}_INCLUDE_DIRS "") - else() - if(_nolibs) diff --git a/ports/vtk/dont-define-ssize_t.patch b/ports/vtk/dont-define-ssize_t.patch deleted file mode 100644 index ba9b5e605..000000000 --- a/ports/vtk/dont-define-ssize_t.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in b/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in -index 0a19c41..0d92371 100644 ---- a/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in -+++ b/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in -@@ -110,7 +110,7 @@ - #cmakedefine HAVE_LIBHDF5_HL - - /* Define to `int' if system doesn't define. */ --#cmakedefine ssize_t @ssize_t@ -+/* #cmakedefine ssize_t @ssize_t@ */ - - /* Define to `int' if system doesn't define. */ - #cmakedefine ptrdiff_t @ptrdiff_t@ diff --git a/ports/vtk/fix-findhdf5-shared.patch b/ports/vtk/fix-findhdf5-shared.patch deleted file mode 100644 index 762a9ab07..000000000 --- a/ports/vtk/fix-findhdf5-shared.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/CMake/FindHDF5.cmake b/CMake/FindHDF5.cmake -index 6d558e39b1..9511e9a1ad 100644 ---- a/CMake/FindHDF5.cmake -+++ b/CMake/FindHDF5.cmake -@@ -3,11 +3,11 @@ - # (BUG #0014363). - - # include the default FindHDF5.cmake. --if(CMAKE_VERSION VERSION_LESS 3.6.1) -+#if(CMAKE_VERSION VERSION_LESS 3.6.1) - include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindHDF5.cmake) --else() -- include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) --endif() -+#else() -+# include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) -+#endif() - - if(HDF5_FOUND AND (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)) - include(vtkMPI) diff --git a/ports/vtk/netcdf-use-hdf5-definitions.patch b/ports/vtk/netcdf-use-hdf5-definitions.patch deleted file mode 100644 index a6a3528ca..000000000 --- a/ports/vtk/netcdf-use-hdf5-definitions.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/ThirdParty/netcdf/vtknetcdf/CMakeLists.txt Mon Nov 14 17:59:47 2016 -+++ b/ThirdParty/netcdf/vtknetcdf/CMakeLists.txt Thu Jan 05 21:15:28 2017 -@@ -330,6 +330,7 @@ - ${netcdf_dispatch_SOURCES} - ${netcdf_liblib_SOURCES}) - target_link_libraries(vtkNetCDF ${vtkhdf5_LIBRARIES}) -+target_compile_definitions(vtkNetCDF PRIVATE ${vtkhdf5_DEFINITIONS}) - - if (UNIX) - # link against the math library. diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 269e6cc79..26cbb3d45 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -1,29 +1,15 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/VTK-7.1.1) -vcpkg_download_distfile(ARCHIVE - URLS "http://www.vtk.org/files/release/7.1/VTK-7.1.1.tar.gz" - FILENAME "VTK-7.1.1.tar.gz" - SHA512 34a068801fe45f98325e5334d2569fc9b15ed38620386f1b5b860c9735e5fb8510953b50a3340d3ef9795e22fecf798c25bf750215b2ff1ff1eb7a1ecd87b623 -) -vcpkg_extract_source_archive(${ARCHIVE}) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/transfer-3rd-party-module-definitions.patch - ${CMAKE_CURRENT_LIST_DIR}/transfer-hdf5-definitions.patch - ${CMAKE_CURRENT_LIST_DIR}/netcdf-use-hdf5-definitions.patch - ${CMAKE_CURRENT_LIST_DIR}/dont-define-ssize_t.patch - ${CMAKE_CURRENT_LIST_DIR}/fix-findhdf5-shared.patch - ${CMAKE_CURRENT_LIST_DIR}/disable-workaround-findhdf5.patch +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO "Kitware/VTK" + REF "v8.0.0" + SHA512 1a328f24df0b1c40c623ae80c9d49f8b27570144b10af02aeed41b90b50b8d4e0dd83d1341961f6818cde36e2cd793c578ebc95a46950cebfc518f486f249791 + HEAD_REF "master" ) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - # HACK: The FindHDF5.cmake script does not seem to detect the HDF5_DEFINITIONS correctly - # if HDF5 has been built without the tools (which is the case in the HDF5 port), - # so we set the BUILT_AS_DYNAMIC_LIB=1 flag here explicitly because we know HDF5 - # has been build as dynamic library in the current case. - list(APPEND ADDITIONAL_OPTIONS "-DHDF5_DEFINITIONS=-DH5_BUILT_AS_DYNAMIC_LIB=1") + list(APPEND ADDITIONAL_OPTIONS "-DVTK_EXTERNAL_HDF5_IS_SHARED=ON") endif() vcpkg_configure_cmake( @@ -68,6 +54,8 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() +# Remove tools from the bin directory. +# We make sure no references to the deleted files are left in the CMake config files. file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake VTK_TARGETS_RELEASE_MODULE) string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" VTK_TARGETS_RELEASE_MODULE "${VTK_TARGETS_RELEASE_MODULE}") string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" VTK_TARGETS_RELEASE_MODULE "${VTK_TARGETS_RELEASE_MODULE}") @@ -82,10 +70,16 @@ file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake "${VTK_TARGE file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-7.1.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-7.1.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkEncodeString-7.1.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkHashSource-7.1.exe) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-8.0.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-8.0.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkEncodeString-8.0.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkHashSource-8.0.exe) +else() + # On static builds there should be no bin directory at all + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() # Handle copyright file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk) diff --git a/ports/vtk/transfer-3rd-party-module-definitions.patch b/ports/vtk/transfer-3rd-party-module-definitions.patch deleted file mode 100644 index 7b402892f..000000000 --- a/ports/vtk/transfer-3rd-party-module-definitions.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/CMake/vtkModuleMacros.cmake Mon Nov 14 17:59:47 2016 -+++ b/CMake/vtkModuleMacros.cmake Thu Jan 05 21:36:06 2017 -@@ -665,6 +665,9 @@ - if(${dep}_LIBRARY_DIRS) - link_directories(${${dep}_LIBRARY_DIRS}) - endif() -+ if(${dep}_DEFINITIONS) -+ target_compile_definitions(${vtk-module} PRIVATE ${${dep}_DEFINITIONS}) -+ endif() - vtk_module_link_libraries(${vtk-module} LINK_PRIVATE ${${dep}_LIBRARIES}) - if(_help_vs7 AND ${dep}_LIBRARIES) - add_dependencies(${vtk-module} ${${dep}_LIBRARIES}) -@@ -870,6 +873,13 @@ - set(vtk${_lower}_LIBRARIES "${${_pkg}_LIBRARIES}") - else() - set(vtk${_lower}_LIBRARIES "${${_upper}_LIBRARIES}") -+ endif() -+ if(${_pkg}_DEFINITIONS) -+ set(vtk${_lower}_DEFINITIONS ${${_pkg}_DEFINITIONS}) -+ elseif(${_upper}_DEFINITIONS) -+ set(vtk${_lower}_DEFINITIONS ${${_upper}_DEFINITIONS}) -+ else() -+ set(vtk${_lower}_DEFINITIONS ${${_upper}_DEFINITIONS}) - endif() - - #a workaround for bad FindHDF5 behavior in which deb or opt can diff --git a/ports/vtk/transfer-hdf5-definitions.patch b/ports/vtk/transfer-hdf5-definitions.patch deleted file mode 100644 index 6184fdf7a..000000000 --- a/ports/vtk/transfer-hdf5-definitions.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/ThirdParty/hdf5/module.cmake Mon Nov 14 17:59:47 2016 -+++ b/ThirdParty/hdf5/module.cmake Thu Jan 05 21:23:20 2017 -@@ -5,6 +5,7 @@ - endif() - if(VTK_USE_SYSTEM_HDF5) - set(vtkhdf5_LIBRARIES ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) -+ set(vtkhdf5_DEFINITIONS ${HDF5_DEFINITIONS}) - endif() - vtk_module(vtkhdf5 - EXCLUDE_FROM_WRAPPING From 614218c18cdc361a394a06180a7b646d42b9843c Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Tue, 8 Aug 2017 17:56:09 +0200 Subject: [PATCH 02/10] [vtk] reenable patch to disable a FindHDF5 workaround --- ports/vtk/disable-workaround-findhdf5.patch | 21 +++++++++++++++++++++ ports/vtk/portfile.cmake | 6 ++++++ 2 files changed, 27 insertions(+) create mode 100644 ports/vtk/disable-workaround-findhdf5.patch diff --git a/ports/vtk/disable-workaround-findhdf5.patch b/ports/vtk/disable-workaround-findhdf5.patch new file mode 100644 index 000000000..004397048 --- /dev/null +++ b/ports/vtk/disable-workaround-findhdf5.patch @@ -0,0 +1,21 @@ +--- a/CMake/vtkModuleMacros.cmake Mon Jun 26 15:29:04 2017 ++++ b/CMake/vtkModuleMacros.cmake Tue Aug 08 17:54:03 2017 +@@ -893,18 +893,6 @@ + set(vtk${_lower}_LIBRARIES "${${_upper_pkg_name}_LIBRARIES}") + endif() + +- #a workaround for bad FindHDF5 behavior in which deb or opt can +- #end up empty. cmake >= 2.8.12.2 makes this unnecessary +- string(REGEX MATCH "debug;.*optimized;.*" +- _remove_deb_opt "${vtk${_lower}_LIBRARIES}") +- if (_remove_deb_opt) +- set(_tmp ${vtk${_lower}_LIBRARIES}) +- list(REMOVE_ITEM _tmp "debug") +- list(REMOVE_ITEM _tmp "optimized") +- list(REMOVE_DUPLICATES _tmp) +- set(vtk${_lower}_LIBRARIES ${_tmp}) +- endif() +- + set(vtk${_lower}_INCLUDE_DIRS "") + else() + if(_nolibs) diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 26cbb3d45..0e6e551f2 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -8,6 +8,12 @@ vcpkg_from_github( HEAD_REF "master" ) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/disable-workaround-findhdf5.patch +) + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) list(APPEND ADDITIONAL_OPTIONS "-DVTK_EXTERNAL_HDF5_IS_SHARED=ON") endif() From c344e708ec292ac8269819c2e384d7d3aef329c4 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 11:56:23 +0200 Subject: [PATCH 03/10] [vtk] fix issue where release libraries are referenced from VTK debug build --- ports/vtk/CleanLibraryList.cmake | 77 ++++++++++++++++++++ ports/vtk/dont-define-ssize_t.patch | 13 ++++ ports/vtk/portfile.cmake | 104 ++++++++++++++++++++++++---- ports/vtk/use-fixed-find-hdf5.patch | 20 ++++++ 4 files changed, 199 insertions(+), 15 deletions(-) create mode 100644 ports/vtk/CleanLibraryList.cmake create mode 100644 ports/vtk/dont-define-ssize_t.patch create mode 100644 ports/vtk/use-fixed-find-hdf5.patch diff --git a/ports/vtk/CleanLibraryList.cmake b/ports/vtk/CleanLibraryList.cmake new file mode 100644 index 000000000..899039e44 --- /dev/null +++ b/ports/vtk/CleanLibraryList.cmake @@ -0,0 +1,77 @@ +# - A smarter replacement for list(REMOVE_DUPLICATES) for library lists +# +# Note that, in the case of cyclic link dependencies, you _do_ actually need +# a library in a list multiple times. So, only use this function when you know +# that the dependency graph is acyclic. +# +# clean_library_list( <_default>) - where +# listvar is the name of a destination variable, and the the source, and +# it is followed by either "debug", "optimized" or "general" which will be +# applied to libraries without any prefix. +# +# Removes duplicates from the list, leaving only the last instance, while +# preserving the meaning of the "optimized", "debug", and "general" labeling. +# (Libraries listed as general are listed in the result instead as optimized and +# debug) +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__clean_library_list) + return() +endif() +set(__clean_library_list YES) + +function(clean_library_list _var _default) + set(_work ${${_var}}) + if(_work) + # Turn each of optimized, debug, and general into flags + # prefixed on their respective library (combining list items) + string(REGEX REPLACE "optimized;" "1CLL%O%" _work "${_work}") + string(REGEX REPLACE "debug;" "1CLL%D%" _work "${_work}") + string(REGEX REPLACE "general;" "1CLL%G%" _work "${_work}") + + # Any library that doesn't have a prefix is _default, and a general + # library is both debug and optimized so stdize it + set(_std) + foreach(_lib ${_work}) + if(NOT "${_lib}" MATCHES "^1CLL%.%") + if("${_default}" STREQUAL "optimized") + list(APPEND _std "1CLL%O%${_lib}") + elseif("${_default}" STREQUAL "debug") + list(APPEND _std "1CLL%D%${_lib}") + else() + list(APPEND _std "1CLL%D%${_lib}" "1CLL%O%${_lib}") + endif() + elseif("${_lib}" MATCHES "^1CLL%G%") + string(REPLACE "1CLL%G%" "" _justlib "${_lib}") + list(APPEND _std "1CLL%D%${_justlib}" "1CLL%O%${_justlib}") + else() + list(APPEND _std "${_lib}") + endif() + endforeach() + + # REMOVE_DUPLICATES leaves the first - so we reverse before and after + # to keep the last, instead + list(REVERSE _std) + list(REMOVE_DUPLICATES _std) + list(REVERSE _std) + + # Split list items back out again: turn prefixes into the + # library type flags. + string(REGEX REPLACE "1CLL%D%" "debug;" _std "${_std}") + string(REGEX REPLACE "1CLL%O%" "optimized;" _std "${_std}") + + # Return _std + set(${_var} ${_std} PARENT_SCOPE) + endif() +endfunction() diff --git a/ports/vtk/dont-define-ssize_t.patch b/ports/vtk/dont-define-ssize_t.patch new file mode 100644 index 000000000..ba9b5e605 --- /dev/null +++ b/ports/vtk/dont-define-ssize_t.patch @@ -0,0 +1,13 @@ +diff --git a/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in b/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in +index 0a19c41..0d92371 100644 +--- a/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in ++++ b/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in +@@ -110,7 +110,7 @@ + #cmakedefine HAVE_LIBHDF5_HL + + /* Define to `int' if system doesn't define. */ +-#cmakedefine ssize_t @ssize_t@ ++/* #cmakedefine ssize_t @ssize_t@ */ + + /* Define to `int' if system doesn't define. */ + #cmakedefine ptrdiff_t @ptrdiff_t@ diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 0e6e551f2..65f2a428e 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -11,6 +11,20 @@ vcpkg_from_github( vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES + # Disable ssize_t because this can conflict with ssize_t that is defined on windows. + ${CMAKE_CURRENT_LIST_DIR}/dont-define-ssize_t.patch + + # We force CMake to use it's own version of the FindHDF5 module since newer versions + # shipped with CMake behave differently. E.g. the one shipped with CMake 3.9 always + # only finds the release libraries, but not the debug libraries. + # The file shipped with CMake allows us to set the libraries explicitly as it is done below. + # Maybe in the future we can disable the patch and use the new version shipped with CMake + # together with the hdf5-config.cmake that is written by HDF5 itself, but currently VTK + # disables taking the config into account explicitly. + ${CMAKE_CURRENT_LIST_DIR}/use-fixed-find-hdf5.patch + + # We disable a workaround in the VTK CMake scripts that can lead to the fact that a dependency + # will link to both, the debug and the release library. ${CMAKE_CURRENT_LIST_DIR}/disable-workaround-findhdf5.patch ) @@ -60,25 +74,82 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() -# Remove tools from the bin directory. -# We make sure no references to the deleted files are left in the CMake config files. -file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake VTK_TARGETS_RELEASE_MODULE) -string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" VTK_TARGETS_RELEASE_MODULE "${VTK_TARGETS_RELEASE_MODULE}") -string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" VTK_TARGETS_RELEASE_MODULE "${VTK_TARGETS_RELEASE_MODULE}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake "${VTK_TARGETS_RELEASE_MODULE}") +vcpkg_fixup_cmake_targets() -file(READ ${CURRENT_PACKAGES_DIR}/debug/share/vtk/VTKTargets-debug.cmake VTK_TARGETS_DEBUG_MODULE) -string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" VTK_TARGETS_DEBUG_MODULE "${VTK_TARGETS_DEBUG_MODULE}") -string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" VTK_TARGETS_DEBUG_MODULE "${VTK_TARGETS_DEBUG_MODULE}") -string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" VTK_TARGETS_DEBUG_MODULE "${VTK_TARGETS_DEBUG_MODULE}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake "${VTK_TARGETS_DEBUG_MODULE}") +# For VTK vcpkg_fixup_cmake_targets is not enough: +# Files for system third party dependencies are written to modules that +# are located in the paths `share/vtk/Modules` and `debug/share/vtk/Modules`. +# In the release folder, only the release libraries are referenced (e.g. "C:/vcpkg/installed/x64-windows/lib/zlib.lib"). +# But in the debug folder both libraries (e.g. "optimized;C:/vcpkg/installed/x64-windows/lib/zlib.lib;debug;C:/vcpkg/installed/x64-windows/debug/lib/zlibd.lib") +# or only the debug library (e.g. "C:/vcpkg/installed/x64-windows/debug/lib/hdf5_D.lib") is referenced. +# This is because VCPKG appends only the release library prefix (.../x64-windows/lib) +# when configuring release but both (.../x64-windows/lib and .../x64-windows/debug/lib) +# when configuring debug. +# Now if we delete the debug/share/Modules folder and just leave share/Modules, a library +# that links to VTK will always use the release third party dependencies, even if +# debug VTK is used. +# +# The following code merges the libraries from both release and debug: -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +include(${CMAKE_CURRENT_LIST_DIR}/CleanLibraryList.cmake) + +function(_vtk_combine_third_party_libraries MODULE_NAME) + set(MODULE_LIBRARIES_REGEX "set\\(${MODULE_NAME}_LIBRARIES \"([^\"]*)\"\\)") + + # Read release libraries + file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/Modules/${MODULE_NAME}.cmake" RELEASE_MODULE_CONTENT) + if("${RELEASE_MODULE_CONTENT}" MATCHES "${MODULE_LIBRARIES_REGEX}") + set(RELEASE_LIBRARY_LIST "${CMAKE_MATCH_1}") + clean_library_list(RELEASE_LIBRARY_LIST "optimized") + else() + message(FATAL_ERROR "Could not extract module libraries for ${MODULE_NAME}") + endif() + + # Read debug libraries + file(READ "${CURRENT_PACKAGES_DIR}/debug/share/vtk/Modules/${MODULE_NAME}.cmake" DEBUG_MODULE_CONTENT) + if("${DEBUG_MODULE_CONTENT}" MATCHES "${MODULE_LIBRARIES_REGEX}") + set(DEBUG_LIBRARY_LIST "${CMAKE_MATCH_1}") + clean_library_list(DEBUG_LIBRARY_LIST "debug") + else() + message(FATAL_ERROR "Could not extract module libraries for ${MODULE_NAME}") + endif() + + # Combine libraries + set(LIBRARY_LIST ${RELEASE_LIBRARY_LIST} ${DEBUG_LIBRARY_LIST}) + clean_library_list(LIBRARY_LIST "general") + + # Write combined libraries back + string(REGEX REPLACE "${MODULE_LIBRARIES_REGEX}" + "set(${MODULE_NAME}_LIBRARIES \"${LIBRARY_LIST}\")" + RELEASE_MODULE_CONTENT + "${RELEASE_MODULE_CONTENT}" + ) + file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/Modules/${MODULE_NAME}.cmake" "${RELEASE_MODULE_CONTENT}") +endfunction() + +# IMPORTANT: Please make sure to extend this list whenever a new library is marked `USE_SYSTEM` in the configure step above! +set(SYSTEM_THIRD_PARTY_MODULES + vtkexpat + vtkfreetype + vtkglew + vtkhdf5 + vtkjsoncpp + vtklibxml2 + vtkpng + vtktiff + vtkzlib +) + +foreach(MODULE IN LISTS SYSTEM_THIRD_PARTY_MODULES) + _vtk_combine_third_party_libraries("${MODULE}") +endforeach() + + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtkEncodeString-8.0.exe) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtkHashSource-8.0.exe) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-8.0.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-8.0.exe) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkEncodeString-8.0.exe) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkHashSource-8.0.exe) else() @@ -87,6 +158,9 @@ else() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) endif() +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) file(RENAME ${CURRENT_PACKAGES_DIR}/share/vtk/Copyright.txt ${CURRENT_PACKAGES_DIR}/share/vtk/copyright) diff --git a/ports/vtk/use-fixed-find-hdf5.patch b/ports/vtk/use-fixed-find-hdf5.patch new file mode 100644 index 000000000..762a9ab07 --- /dev/null +++ b/ports/vtk/use-fixed-find-hdf5.patch @@ -0,0 +1,20 @@ +diff --git a/CMake/FindHDF5.cmake b/CMake/FindHDF5.cmake +index 6d558e39b1..9511e9a1ad 100644 +--- a/CMake/FindHDF5.cmake ++++ b/CMake/FindHDF5.cmake +@@ -3,11 +3,11 @@ + # (BUG #0014363). + + # include the default FindHDF5.cmake. +-if(CMAKE_VERSION VERSION_LESS 3.6.1) ++#if(CMAKE_VERSION VERSION_LESS 3.6.1) + include(${CMAKE_CURRENT_LIST_DIR}/NewCMake/FindHDF5.cmake) +-else() +- include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) +-endif() ++#else() ++# include(${CMAKE_ROOT}/Modules/FindHDF5.cmake) ++#endif() + + if(HDF5_FOUND AND (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)) + include(vtkMPI) From 44b34505e4674088cbfae86c68fee9eb10441472 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 12:06:49 +0200 Subject: [PATCH 04/10] [vtk] Fix tools directory --- ports/vtk/portfile.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 65f2a428e..2814ccd27 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -145,9 +145,9 @@ foreach(MODULE IN LISTS SYSTEM_THIRD_PARTY_MODULES) endforeach() -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtkEncodeString-8.0.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtkHashSource-8.0.exe) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/vtk) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/vtkEncodeString-8.0.exe) +file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/vtkHashSource-8.0.exe) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkEncodeString-8.0.exe) From dd9f27100da0ca3338fbc934ce16848635338d7b Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 15:29:42 +0200 Subject: [PATCH 05/10] [vtk] do not use "debug;" or "optimized;" prefixes for library configurations, but wrap them in generator expressions instead --- ports/vtk/CleanLibraryList.cmake | 77 ---------------------- ports/vtk/SplitLibraryConfigurations.cmake | 31 +++++++++ ports/vtk/portfile.cmake | 17 +++-- 3 files changed, 42 insertions(+), 83 deletions(-) delete mode 100644 ports/vtk/CleanLibraryList.cmake create mode 100644 ports/vtk/SplitLibraryConfigurations.cmake diff --git a/ports/vtk/CleanLibraryList.cmake b/ports/vtk/CleanLibraryList.cmake deleted file mode 100644 index 899039e44..000000000 --- a/ports/vtk/CleanLibraryList.cmake +++ /dev/null @@ -1,77 +0,0 @@ -# - A smarter replacement for list(REMOVE_DUPLICATES) for library lists -# -# Note that, in the case of cyclic link dependencies, you _do_ actually need -# a library in a list multiple times. So, only use this function when you know -# that the dependency graph is acyclic. -# -# clean_library_list( <_default>) - where -# listvar is the name of a destination variable, and the the source, and -# it is followed by either "debug", "optimized" or "general" which will be -# applied to libraries without any prefix. -# -# Removes duplicates from the list, leaving only the last instance, while -# preserving the meaning of the "optimized", "debug", and "general" labeling. -# (Libraries listed as general are listed in the result instead as optimized and -# debug) -# -# Requires CMake 2.6 or newer (uses the 'function' command) -# -# Original Author: -# 2009-2010 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2009-2010. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -if(__clean_library_list) - return() -endif() -set(__clean_library_list YES) - -function(clean_library_list _var _default) - set(_work ${${_var}}) - if(_work) - # Turn each of optimized, debug, and general into flags - # prefixed on their respective library (combining list items) - string(REGEX REPLACE "optimized;" "1CLL%O%" _work "${_work}") - string(REGEX REPLACE "debug;" "1CLL%D%" _work "${_work}") - string(REGEX REPLACE "general;" "1CLL%G%" _work "${_work}") - - # Any library that doesn't have a prefix is _default, and a general - # library is both debug and optimized so stdize it - set(_std) - foreach(_lib ${_work}) - if(NOT "${_lib}" MATCHES "^1CLL%.%") - if("${_default}" STREQUAL "optimized") - list(APPEND _std "1CLL%O%${_lib}") - elseif("${_default}" STREQUAL "debug") - list(APPEND _std "1CLL%D%${_lib}") - else() - list(APPEND _std "1CLL%D%${_lib}" "1CLL%O%${_lib}") - endif() - elseif("${_lib}" MATCHES "^1CLL%G%") - string(REPLACE "1CLL%G%" "" _justlib "${_lib}") - list(APPEND _std "1CLL%D%${_justlib}" "1CLL%O%${_justlib}") - else() - list(APPEND _std "${_lib}") - endif() - endforeach() - - # REMOVE_DUPLICATES leaves the first - so we reverse before and after - # to keep the last, instead - list(REVERSE _std) - list(REMOVE_DUPLICATES _std) - list(REVERSE _std) - - # Split list items back out again: turn prefixes into the - # library type flags. - string(REGEX REPLACE "1CLL%D%" "debug;" _std "${_std}") - string(REGEX REPLACE "1CLL%O%" "optimized;" _std "${_std}") - - # Return _std - set(${_var} ${_std} PARENT_SCOPE) - endif() -endfunction() diff --git a/ports/vtk/SplitLibraryConfigurations.cmake b/ports/vtk/SplitLibraryConfigurations.cmake new file mode 100644 index 000000000..e7f4e6436 --- /dev/null +++ b/ports/vtk/SplitLibraryConfigurations.cmake @@ -0,0 +1,31 @@ + +cmake_minimum_required(VERSION 3.2.0) + +function(split_library_configurations LIBRARIES OPTIMIZED_OUT_VAR DEBUG_OUT_VAR GENERAL_OUT_VAR) + set(OPTIMIZED_LIBRARIES) + set(DEBUG_LIBRARIES) + set(GENERAL_LIBRARIES) + + set(CURRENT_TYPE) + foreach(LIBRARY ${LIBRARIES}) + message(STATUS "LIB ${LIBRARY}:") + if("${LIBRARY}" STREQUAL "optimized" OR "${LIBRARY}" STREQUAL "debug" OR "${LIBRARY}" STREQUAL "general") + set(CURRENT_TYPE "${LIBRARY}") + message(STATUS "SET CURRENT_TYPE: ${CURRENT_TYPE}") + else() + message(STATUS "ADD TO ${CURRENT_TYPE}") + if("${CURRENT_TYPE}" STREQUAL "optimized") + list(APPEND OPTIMIZED_LIBRARIES "${LIBRARY}") + elseif("${CURRENT_TYPE}" STREQUAL "debug") + list(APPEND DEBUG_LIBRARIES "${LIBRARY}") + else() + list(APPEND GENERAL_LIBRARIES "${LIBRARY}") + endif() + set(CURRENT_TYPE) + endif() + endforeach() + + set(${OPTIMIZED_OUT_VAR} "${OPTIMIZED_LIBRARIES}" PARENT_SCOPE) + set(${DEBUG_OUT_VAR} "${DEBUG_LIBRARIES}" PARENT_SCOPE) + set(${GENERAL_OUT_VAR} "${GENERAL_LIBRARIES}" PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 2814ccd27..bf6022f35 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -91,7 +91,7 @@ vcpkg_fixup_cmake_targets() # # The following code merges the libraries from both release and debug: -include(${CMAKE_CURRENT_LIST_DIR}/CleanLibraryList.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/SplitLibraryConfigurations.cmake) function(_vtk_combine_third_party_libraries MODULE_NAME) set(MODULE_LIBRARIES_REGEX "set\\(${MODULE_NAME}_LIBRARIES \"([^\"]*)\"\\)") @@ -100,7 +100,6 @@ function(_vtk_combine_third_party_libraries MODULE_NAME) file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/Modules/${MODULE_NAME}.cmake" RELEASE_MODULE_CONTENT) if("${RELEASE_MODULE_CONTENT}" MATCHES "${MODULE_LIBRARIES_REGEX}") set(RELEASE_LIBRARY_LIST "${CMAKE_MATCH_1}") - clean_library_list(RELEASE_LIBRARY_LIST "optimized") else() message(FATAL_ERROR "Could not extract module libraries for ${MODULE_NAME}") endif() @@ -109,14 +108,20 @@ function(_vtk_combine_third_party_libraries MODULE_NAME) file(READ "${CURRENT_PACKAGES_DIR}/debug/share/vtk/Modules/${MODULE_NAME}.cmake" DEBUG_MODULE_CONTENT) if("${DEBUG_MODULE_CONTENT}" MATCHES "${MODULE_LIBRARIES_REGEX}") set(DEBUG_LIBRARY_LIST "${CMAKE_MATCH_1}") - clean_library_list(DEBUG_LIBRARY_LIST "debug") else() message(FATAL_ERROR "Could not extract module libraries for ${MODULE_NAME}") endif() + + split_library_configurations("${RELEASE_LIBRARY_LIST}" OPTIMIZED_RELEASE_LIBRARIES DEBUG_RELEASE_LIBRARIES GENERAL_RELEASE_LIBRARIES) + split_library_configurations("${DEBUG_LIBRARY_LIST}" OPTIMIZED_DEBUG_LIBRARIES DEBUG_DEBUG_LIBRARIES GENERAL_DEBUG_LIBRARIES) - # Combine libraries - set(LIBRARY_LIST ${RELEASE_LIBRARY_LIST} ${DEBUG_LIBRARY_LIST}) - clean_library_list(LIBRARY_LIST "general") + # Combine libraries and wrap them in generator expressions + foreach(LIBRARY ${OPTIMIZED_RELEASE_LIBRARIES} ${GENERAL_RELEASE_LIBRARIES}) + list(APPEND LIBRARY_LIST "$<$>:${LIBRARY}>") + endforeach() + foreach(LIBRARY ${DEBUG_DEBUG_LIBRARIES} ${GENERAL_DEBUG_LIBRARIES}) + list(APPEND LIBRARY_LIST "$<$:${LIBRARY}>") + endforeach() # Write combined libraries back string(REGEX REPLACE "${MODULE_LIBRARIES_REGEX}" From 6d73c73b21c3be9a4c0b1ab4cca2622abb094362 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 15:30:37 +0200 Subject: [PATCH 06/10] [vtk] remove some debug messages --- ports/vtk/SplitLibraryConfigurations.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/ports/vtk/SplitLibraryConfigurations.cmake b/ports/vtk/SplitLibraryConfigurations.cmake index e7f4e6436..fc4d87ec8 100644 --- a/ports/vtk/SplitLibraryConfigurations.cmake +++ b/ports/vtk/SplitLibraryConfigurations.cmake @@ -8,12 +8,9 @@ function(split_library_configurations LIBRARIES OPTIMIZED_OUT_VAR DEBUG_OUT_VAR set(CURRENT_TYPE) foreach(LIBRARY ${LIBRARIES}) - message(STATUS "LIB ${LIBRARY}:") if("${LIBRARY}" STREQUAL "optimized" OR "${LIBRARY}" STREQUAL "debug" OR "${LIBRARY}" STREQUAL "general") set(CURRENT_TYPE "${LIBRARY}") - message(STATUS "SET CURRENT_TYPE: ${CURRENT_TYPE}") else() - message(STATUS "ADD TO ${CURRENT_TYPE}") if("${CURRENT_TYPE}" STREQUAL "optimized") list(APPEND OPTIMIZED_LIBRARIES "${LIBRARY}") elseif("${CURRENT_TYPE}" STREQUAL "debug") From dffe4793b8f8a11687a7e6eb9cfef8a866a39479 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 17:05:43 +0200 Subject: [PATCH 07/10] [vtk] Fix remaining references to release libraries from debug version of VTK --- ports/vtk/portfile.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index bf6022f35..ed5a5a6ce 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -149,7 +149,15 @@ foreach(MODULE IN LISTS SYSTEM_THIRD_PARTY_MODULES) _vtk_combine_third_party_libraries("${MODULE}") endforeach() +# Remove all explicit references to vcpkg system libraries in the general VTKTargets.cmake file +# since these references always point to the release libraries, even in the debug case. +# The dependencies should be handled by the explicit modules we fixed above, so removing +# them here shouldn't cause any problems. +file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" VTK_TARGETS_CONTENT) +string(REGEX REPLACE "${CURRENT_INSTALLED_DIR}/lib/[^\\.]*\\.lib" "" VTK_TARGETS_CONTENT "${VTK_TARGETS_CONTENT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" "${VTK_TARGETS_CONTENT}") +# Move executable to tools directory file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/vtk) file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/vtkEncodeString-8.0.exe) file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/vtkHashSource-8.0.exe) From 616cfb0eff834d5311f064db218ffb8e5e3a52ab Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 18:20:40 +0200 Subject: [PATCH 08/10] [vtk] Fixed that the VTK debug was build linked against the release GLEW library --- ports/vtk/portfile.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index ed5a5a6ce..61c8903d1 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -28,6 +28,11 @@ vcpkg_apply_patches( ${CMAKE_CURRENT_LIST_DIR}/disable-workaround-findhdf5.patch ) +# Remove the FindGLEW.cmake that is distributed with VTK, since it does not +# detect the debug libraries correctly. +# The default file distributed with CMake should be superior by all means. +file(REMOVE ${SOURCE_PATH}/CMake/FindGLEW.cmake) + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) list(APPEND ADDITIONAL_OPTIONS "-DVTK_EXTERNAL_HDF5_IS_SHARED=ON") endif() From 4a57f69e161b1dd75ada91a0910eeb0ba1141b09 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 21:58:44 +0200 Subject: [PATCH 09/10] [vtk] Use libjpeg, proj and lz4 from vcpkg --- ports/vtk/CONTROL | 2 +- ports/vtk/fix-find-libproj4.patch | 68 +++++++++++++++++++++++++++++++ ports/vtk/portfile.cmake | 12 +++++- 3 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 ports/vtk/fix-find-libproj4.patch diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL index b1a06c9ad..6a95b2f37 100644 --- a/ports/vtk/CONTROL +++ b/ports/vtk/CONTROL @@ -1,4 +1,4 @@ Source: vtk Version: 8.0.0 Description: Software system for 3D computer graphics, image processing, and visualization -Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi +Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi, libjpeg-turbo, proj, lz4 diff --git a/ports/vtk/fix-find-libproj4.patch b/ports/vtk/fix-find-libproj4.patch new file mode 100644 index 000000000..4074d87a9 --- /dev/null +++ b/ports/vtk/fix-find-libproj4.patch @@ -0,0 +1,68 @@ +--- a/CMake/FindLIBPROJ4.cmake Thu Aug 10 21:03:55 2017 ++++ b/CMake/FindLIBPROJ4.cmake Thu Aug 10 21:08:58 2017 +@@ -11,7 +11,7 @@ + file( TO_CMAKE_PATH "$ENV{LIBPROJ4_DIR}" _LIBPROJ4_DIR ) + endif () + +- find_library( LIBPROJ4_LIBRARIES ++ find_library( LIBPROJ4_LIBRARY_RELEASE + NAMES proj + PATHS + ${_LIBPROJ4_DIR}/lib64 +@@ -24,7 +24,21 @@ + ${CMAKE_INSTALL_PREFIX}/lib + /usr/local/lib + /usr/lib +- NO_DEFAULT_PATH ++ ) ++ ++ find_library( LIBPROJ4_LIBRARY_DEBUG ++ NAMES projd ++ PATHS ++ ${_LIBPROJ4_DIR}/lib64 ++ ${CMAKE_INSTALL_PREFIX}/lib64 ++ /usr/local/lib64 ++ /usr/lib64 ++ ${_LIBPROJ4_DIR} ++ ${_LIBPROJ4_DIR}/lib ++ ${CMAKE_INSTALL_PREFIX}/bin ++ ${CMAKE_INSTALL_PREFIX}/lib ++ /usr/local/lib ++ /usr/lib + ) + + find_path( LIBPROJ4_INCLUDE_DIR +@@ -37,19 +51,22 @@ + /usr/local/include + /usr/include + /usr/include/postgresql +- NO_DEFAULT_PATH + ) + +- if ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES ) +- if ( LIBPROJ4_REQUIRED ) +- message( FATAL_ERROR "LIBPROJ4 is required. Set LIBPROJ4_DIR" ) +- endif () +- else () +- set( LIBPROJ4_FOUND 1 ) +- mark_as_advanced( LIBPROJ4_FOUND ) +- endif () ++ include(SelectLibraryConfigurations) ++ select_library_configurations(LIBPROJ4) ++ ++ include(FindPackageHandleStandardArgs) ++ find_package_handle_standard_args(LIBPROJ4 ++ REQUIRED_VARS LIBPROJ4_LIBRARY LIBPROJ4_INCLUDE_DIR) ++ ++ if(LIBPROJ4_FOUND) ++ set(LIBPROJ4_INCLUDE_DIRS ${LIBPROJ4_INCLUDE_DIR}) + ++ if(NOT LIBPROJ4_LIBRARIES) ++ set(LIBPROJ4_LIBRARIES ${LIBPROJ4_LIBRARY}) ++ endif() ++ endif() + endif () + +-mark_as_advanced( FORCE LIBPROJ4_INCLUDE_DIR ) +-mark_as_advanced( FORCE LIBPROJ4_LIBRARIES ) ++mark_as_advanced(LIBPROJ4_INCLUDE_DIR) diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index 61c8903d1..d48715473 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -26,6 +26,8 @@ vcpkg_apply_patches( # We disable a workaround in the VTK CMake scripts that can lead to the fact that a dependency # will link to both, the debug and the release library. ${CMAKE_CURRENT_LIST_DIR}/disable-workaround-findhdf5.patch + + ${CMAKE_CURRENT_LIST_DIR}/fix-find-libproj4.patch ) # Remove the FindGLEW.cmake that is distributed with VTK, since it does not @@ -52,13 +54,16 @@ vcpkg_configure_cmake( -DVTK_USE_SYSTEM_EXPAT=ON -DVTK_USE_SYSTEM_FREETYPE=ON # -DVTK_USE_SYSTEM_GL2PS=ON + # -DVTK_USE_SYSTEM_LIBHARU=ON + -DVTK_USE_SYSTEM_JPEG=ON -DVTK_USE_SYSTEM_GLEW=ON -DVTK_USE_SYSTEM_HDF5=ON -DVTK_USE_SYSTEM_JSONCPP=ON - # -DVTK_USE_SYSTEM_LIBPROJ4=ON - # -DVTK_USE_SYSTEM_LIBRARIES=ON + -DVTK_USE_SYSTEM_LIBPROJ4=ON -DVTK_USE_SYSTEM_LIBXML2=ON + -DVTK_USE_SYSTEM_LZ4=ON # -DVTK_USE_SYSTEM_NETCDF=ON + # -DVTK_USE_SYSTEM_NETCDFCPP=ON # -DVTK_USE_SYSTEM_OGGTHEORA=ON -DVTK_USE_SYSTEM_PNG=ON -DVTK_USE_SYSTEM_TIFF=ON @@ -141,10 +146,13 @@ endfunction() set(SYSTEM_THIRD_PARTY_MODULES vtkexpat vtkfreetype + vtkjpeg vtkglew vtkhdf5 vtkjsoncpp + vtklibproj4 vtklibxml2 + vtklz4 vtkpng vtktiff vtkzlib From 7f5a659734e0a4a2ac01c0428e825acec2c6f54f Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 10 Aug 2017 22:05:12 +0200 Subject: [PATCH 10/10] [vtk] do not install headers into subdirectory "vtk-8.0" so that "vcpkg integrate install" works as excpected --- ports/vtk/portfile.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index d48715473..f5d1fdda3 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -43,6 +43,7 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS + -DVTK_INSTALL_INCLUDE_DIR=include -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DVTK_Group_MPI=ON