Add port for VTK

This commit is contained in:
Albert Ziegenhagel 2017-01-12 11:03:02 +01:00
parent b966acc5c2
commit 8adfa34b08
5 changed files with 129 additions and 0 deletions

4
ports/vtk/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: vtk
Version: 7.1.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

View File

@ -0,0 +1,10 @@
--- 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.

79
ports/vtk/portfile.cmake Normal file
View File

@ -0,0 +1,79 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/VTK-7.1.0)
vcpkg_download_distfile(ARCHIVE
URLS "http://www.vtk.org/files/release/7.1/VTK-7.1.0.tar.gz"
FILENAME "VTK-7.1.0.tar.gz"
SHA512 83f0c9291cd2bc517a4bc449ad28a1d77e7ece169e846c7beab0b1140b9ef4b7bad30e3fa6e5a59826a707df78e2e336e07fa8bd30cf7498096ee80feef16534
)
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
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
# HACK: The FindHDF5.cmake script does not seam to detect the HDF5_DEFINITIONS correctly
# if HDF5 has been built without the tools, so we set the BUILT_AS_DYNAMIC_LIB=1 flag
# here explicitly because we now it has been build as dynamic in the current case.
list(APPEND ADDITIONAL_OPTIONS "-DHDF5_DEFINITIONS=-DH5_BUILT_AS_DYNAMIC_LIB=1")
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DBUILD_TESTING=OFF
-DVTK_Group_MPI=ON
-DVTK_Group_Qt=ON
-DVTK_QT_VERSION=5
-DVTK_BUILD_QT_DESIGNER_PLUGIN=OFF
# -DVTK_WRAP_PYTHON=ON
# -DVTK_PYTHON_VERSION=3
-DVTK_USE_SYSTEM_EXPAT=ON
-DVTK_USE_SYSTEM_FREETYPE=ON
# -DVTK_USE_SYSTEM_GL2PS=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_LIBXML2=ON
# -DVTK_USE_SYSTEM_NETCDF=ON
# -DVTK_USE_SYSTEM_OGGTHEORA=ON
-DVTK_USE_SYSTEM_PNG=ON
-DVTK_USE_SYSTEM_TIFF=ON
-DVTK_USE_SYSTEM_ZLIB=ON
-DVTK_INSTALL_DATA_DIR=share/vtk/data
-DVTK_INSTALL_DOC_DIR=share/vtk/doc
-DVTK_INSTALL_PACKAGE_DIR=share/vtk
${ADDITIONAL_OPTIONS}
)
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}")
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}")
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)
# 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)

View File

@ -0,0 +1,26 @@
--- 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

@ -0,0 +1,10 @@
--- 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