aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Ziegenhagel <albert.ziegenhagel@outlook.com>2017-08-28 10:48:30 +0200
committerAlbert Ziegenhagel <albert.ziegenhagel@outlook.com>2017-08-28 10:48:30 +0200
commitd7a313c5c356e1641f18cd14ad0ac0c3901bc0bf (patch)
tree9f04aac1060c53567c0e9964d210142161e15141
parent8a79566c645e4b2862d7b094d2e2c4a1fd889b7f (diff)
downloadvcpkg-d7a313c5c356e1641f18cd14ad0ac0c3901bc0bf.tar.gz
vcpkg-d7a313c5c356e1641f18cd14ad0ac0c3901bc0bf.zip
[vtk] improve portfile:
- Use system libharu - Simplyfy enabling/disabling optional modules of VTK - Add options to build VTK python modules or all VTK modules
-rw-r--r--ports/vtk/CONTROL4
-rw-r--r--ports/vtk/FindGDAL.cmake127
-rw-r--r--ports/vtk/fix-find-libharu.patch18
-rw-r--r--ports/vtk/fix-find-mysql.patch10
-rw-r--r--ports/vtk/fix-find-odbc.patch11
-rw-r--r--ports/vtk/portfile.cmake162
6 files changed, 310 insertions, 22 deletions
diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL
index 652c27700..13fb6fd7d 100644
--- a/ports/vtk/CONTROL
+++ b/ports/vtk/CONTROL
@@ -1,4 +1,4 @@
Source: vtk
-Version: 8.0.0-1
+Version: 8.0.0-2
Description: Software system for 3D computer graphics, image processing, and visualization
-Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi, libjpeg-turbo, proj, lz4, libtheora
+Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi, libjpeg-turbo, proj, lz4, libtheora, libharu
diff --git a/ports/vtk/FindGDAL.cmake b/ports/vtk/FindGDAL.cmake
new file mode 100644
index 000000000..e4f2f303b
--- /dev/null
+++ b/ports/vtk/FindGDAL.cmake
@@ -0,0 +1,127 @@
+# 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/fix-find-libharu.patch b/ports/vtk/fix-find-libharu.patch
new file mode 100644
index 000000000..683f7bae6
--- /dev/null
+++ b/ports/vtk/fix-find-libharu.patch
@@ -0,0 +1,18 @@
+--- a/CMake/FindLibHaru.cmake Mon Jun 26 15:29:04 2017
++++ b/CMake/FindLibHaru.cmake Wed Aug 16 09:30:12 2017
+@@ -19,9 +19,13 @@
+
+ find_path(LIBHARU_INCLUDE_DIR hpdf.h)
+
+-find_library(LIBHARU_LIBRARY NAMES hpdf)
++find_library(LIBHARU_LIBRARY_RELEASE NAMES hpdf libhpdf)
++find_library(LIBHARU_LIBRARY_DEBUG NAMES hpdfd libhpdfd)
+
+-# handle the QUIETLY and REQUIRED arguments and set FONTCONFIG_FOUND to TRUE if
++include(SelectLibraryConfigurations)
++select_library_configurations(LIBHARU)
++
++# handle the QUIETLY and REQUIRED arguments and set LIBHARU_FOUND to TRUE if
+ # all listed variables are TRUE
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(LibHaru DEFAULT_MSG
diff --git a/ports/vtk/fix-find-mysql.patch b/ports/vtk/fix-find-mysql.patch
new file mode 100644
index 000000000..d2f984cd5
--- /dev/null
+++ b/ports/vtk/fix-find-mysql.patch
@@ -0,0 +1,10 @@
+--- a/CMake/FindMySQL.cmake Mon Jun 26 15:29:04 2017
++++ b/CMake/FindMySQL.cmake Wed Aug 16 11:21:58 2017
+@@ -28,6 +28,7 @@
+ "C:/MySQL/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.0;Location]/include"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\MySQL AB\\MySQL Server 5.0;Location]/include"
++ PATH_SUFFIXES mysql
+ DOC "Specify the directory containing mysql.h."
+ )
+
diff --git a/ports/vtk/fix-find-odbc.patch b/ports/vtk/fix-find-odbc.patch
new file mode 100644
index 000000000..0690ed0a9
--- /dev/null
+++ b/ports/vtk/fix-find-odbc.patch
@@ -0,0 +1,11 @@
+--- a/CMake/FindODBC.cmake Mon Jun 26 15:29:04 2017
++++ b/CMake/FindODBC.cmake Wed Aug 16 12:58:11 2017
+@@ -30,7 +30,7 @@
+ )
+
+ FIND_LIBRARY( ODBC_LIBRARY
+- NAMES odbc iodbc unixodbc
++ NAMES odbc iodbc unixodbc odbc32
+ PATHS
+ /usr/lib
+ /usr/lib/odbc
diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake
index ff9d457f1..c5ea4c387 100644
--- a/ports/vtk/portfile.cmake
+++ b/ports/vtk/portfile.cmake
@@ -1,13 +1,26 @@
include(vcpkg_common_functions)
+set(VTK_SHORT_VERSION "8.0")
+set(VTK_LONG_VERSION "${VTK_SHORT_VERSION}.0")
+
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO "Kitware/VTK"
- REF "v8.0.0"
+ REF "v${VTK_LONG_VERSION}"
SHA512 1a328f24df0b1c40c623ae80c9d49f8b27570144b10af02aeed41b90b50b8d4e0dd83d1341961f6818cde36e2cd793c578ebc95a46950cebfc518f486f249791
HEAD_REF "master"
)
+# =============================================================================
+# Options: These should be set by feature-packages when they become available
+set(VTK_WITH_QT ON ) # IMPORTANT: if ON make sure `qt5` is listed as dependency in the CONTROL file
+set(VTK_WITH_MPI ON ) # IMPORTANT: if ON make sure `mpi` is listed as dependency in the CONTROL file
+set(VTK_WITH_PYTHON OFF) # IMPORTANT: if ON make sure `python3` is listed as dependency in the CONTROL file
+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
+
+# =============================================================================
+# Apply patches to the source code
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
@@ -28,33 +41,78 @@ vcpkg_apply_patches(
${CMAKE_CURRENT_LIST_DIR}/disable-workaround-findhdf5.patch
${CMAKE_CURRENT_LIST_DIR}/fix-find-libproj4.patch
+ ${CMAKE_CURRENT_LIST_DIR}/fix-find-libharu.patch
+ ${CMAKE_CURRENT_LIST_DIR}/fix-find-mysql.patch
+ ${CMAKE_CURRENT_LIST_DIR}/fix-find-odbc.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.
+# 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)
+
+# =============================================================================
+# Collect CMake options for optional components
+if(VTK_WITH_QT)
+ list(APPEND ADDITIONAL_OPTIONS
+ -DVTK_Group_Qt=ON
+ -DVTK_QT_VERSION=5
+ -DVTK_BUILD_QT_DESIGNER_PLUGIN=OFF
+ )
+endif()
+
+if(VTK_WITH_MPI)
+ list(APPEND ADDITIONAL_OPTIONS
+ -DVTK_Group_MPI=ON
+ )
+endif()
+
+if(VTK_WITH_PYTHON)
+ list(APPEND ADDITIONAL_OPTIONS
+ -DVTK_WRAP_PYTHON=ON
+ -DVTK_PYTHON_VERSION=3
+ )
+endif()
+
+if(VTK_WITH_ALL_MODULES)
+ 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
+ )
+endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
list(APPEND ADDITIONAL_OPTIONS "-DVTK_EXTERNAL_HDF5_IS_SHARED=ON")
endif()
+# =============================================================================
+# Configure & Install
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
+ -DVTK_Group_Imaging=ON
+ -DVTK_Group_Views=ON
-DBUILD_TESTING=OFF
-DBUILD_EXAMPLES=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_LIBHARU=ON
+ -DVTK_USE_SYSTEM_LIBHARU=ON
-DVTK_USE_SYSTEM_JPEG=ON
-DVTK_USE_SYSTEM_GLEW=ON
-DVTK_USE_SYSTEM_HDF5=ON
@@ -85,9 +143,29 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
+# =============================================================================
+# Fixup target files
vcpkg_fixup_cmake_targets()
-# For VTK vcpkg_fixup_cmake_targets is not enough:
+# 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)
+ 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}")
+
+ 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()
+
+# 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").
@@ -158,8 +236,22 @@ set(SYSTEM_THIRD_PARTY_MODULES
vtkpng
vtktiff
vtkzlib
+ # vtkgl2ps
+ vtklibharu
)
+if(VTK_WITH_PYTHON OR VTK_WITH_ALL_MODULES)
+ list(APPEND SYSTEM_THIRD_PARTY_MODULES
+ vtkPython
+ )
+endif()
+
+if(VTK_WITH_ALL_MODULES)
+ list(APPEND SYSTEM_THIRD_PARTY_MODULES
+ AutobahnPython
+ )
+endif()
+
foreach(MODULE IN LISTS SYSTEM_THIRD_PARTY_MODULES)
_vtk_combine_third_party_libraries("${MODULE}")
endforeach()
@@ -172,16 +264,45 @@ file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" VTK_TARGETS_CONTE
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
+# =============================================================================
+# Move executable to tools directory and clean-up other directories
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
+function(_vtk_move_tool TOOL_NAME)
+ if(EXISTS ${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}.exe)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/${TOOL_NAME}.exe)
+ endif()
+
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME}.exe)
+endfunction()
+
+set(VTK_TOOLS
+ vtkEncodeString-${VTK_SHORT_VERSION}
+ vtkHashSource-${VTK_SHORT_VERSION}
+ vtkWrapTclInit-${VTK_SHORT_VERSION}
+ vtkWrapTcl-${VTK_SHORT_VERSION}
+ vtkWrapPythonInit-${VTK_SHORT_VERSION}
+ vtkWrapPython-${VTK_SHORT_VERSION}
+ vtkWrapJava-${VTK_SHORT_VERSION}
+ vtkWrapHierarchy-${VTK_SHORT_VERSION}
+ vtkParseJava-${VTK_SHORT_VERSION}
+ vtkParseOGLExt-${VTK_SHORT_VERSION}
+ vtkpython
+ pvtkpython
+)
+
+foreach(TOOL_NAME IN LISTS VTK_TOOLS)
+ _vtk_move_tool("${TOOL_NAME}")
+endforeach()
+
+# =============================================================================
+# 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)
endif()
@@ -189,6 +310,7 @@ 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)