Merge pull request #1601 from albertziegenhagel/vtk-8.0

Update VTK to version 8.0.
This commit is contained in:
Alexander Karatarakis 2017-08-10 13:52:21 -07:00 committed by GitHub
commit d719443c67
9 changed files with 236 additions and 87 deletions

View File

@ -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
Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi, libjpeg-turbo, proj, lz4

View File

@ -0,0 +1,28 @@
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})
if("${LIBRARY}" STREQUAL "optimized" OR "${LIBRARY}" STREQUAL "debug" OR "${LIBRARY}" STREQUAL "general")
set(CURRENT_TYPE "${LIBRARY}")
else()
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()

View File

@ -1,13 +1,11 @@
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})
--- 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 uneccessary
- #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)

View File

@ -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)

View File

@ -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.

View File

@ -1,35 +1,49 @@
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_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO "Kitware/VTK"
REF "v8.0.0"
SHA512 1a328f24df0b1c40c623ae80c9d49f8b27570144b10af02aeed41b90b50b8d4e0dd83d1341961f6818cde36e2cd793c578ebc95a46950cebfc518f486f249791
HEAD_REF "master"
)
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
# Disable ssize_t because this can conflict with ssize_t that is defined on windows.
${CMAKE_CURRENT_LIST_DIR}/dont-define-ssize_t.patch
${CMAKE_CURRENT_LIST_DIR}/fix-findhdf5-shared.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
${CMAKE_CURRENT_LIST_DIR}/fix-find-libproj4.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)
# 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(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DVTK_INSTALL_INCLUDE_DIR=include
-DBUILD_TESTING=OFF
-DBUILD_EXAMPLES=OFF
-DVTK_Group_MPI=ON
@ -41,13 +55,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
@ -68,24 +85,108 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
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:
include(${CMAKE_CURRENT_LIST_DIR}/SplitLibraryConfigurations.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}")
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}")
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 and wrap them in generator expressions
foreach(LIBRARY ${OPTIMIZED_RELEASE_LIBRARIES} ${GENERAL_RELEASE_LIBRARIES})
list(APPEND LIBRARY_LIST "$<$<NOT:$<CONFIG:Debug>>:${LIBRARY}>")
endforeach()
foreach(LIBRARY ${DEBUG_DEBUG_LIBRARIES} ${GENERAL_DEBUG_LIBRARIES})
list(APPEND LIBRARY_LIST "$<$<CONFIG:Debug>:${LIBRARY}>")
endforeach()
# 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
vtkjpeg
vtkglew
vtkhdf5
vtkjsoncpp
vtklibproj4
vtklibxml2
vtklz4
vtkpng
vtktiff
vtkzlib
)
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)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
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()
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)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk)

View File

@ -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

View File

@ -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