[vtk] Fix builds, including static against HDF5.

This commit is contained in:
Robert Schumacher 2017-11-08 15:33:29 -08:00
parent bb47f71bf3
commit 087dc9410c
3 changed files with 30 additions and 11 deletions

View File

@ -1,5 +1,5 @@
Source: vtk Source: vtk
Version: 8.0.1-2 Version: 8.0.1-3
Description: Software system for 3D computer graphics, image processing, and visualization Description: Software system for 3D computer graphics, image processing, and visualization
Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora

27
ports/vtk/FindHDF5.cmake Normal file
View File

@ -0,0 +1,27 @@
find_package(HDF5 NO_MODULE REQUIRED)
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
add_library(vtk::hdf5::hdf5 INTERFACE IMPORTED GLOBAL)
if(TARGET hdf5-static)
set_target_properties(vtk::hdf5::hdf5 PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5-static")
elseif(TARGET hdf5-shared)
set_target_properties(vtk::hdf5::hdf5 PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5-shared")
else()
message(FATAL_ERROR "could not find target hdf5-*")
endif()
add_library(vtk::hdf5::hdf5_hl INTERFACE IMPORTED GLOBAL)
if(TARGET hdf5_hl-static)
set_target_properties(vtk::hdf5::hdf5_hl PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5_hl-static")
elseif(TARGET hdf5_hl-shared)
set_target_properties(vtk::hdf5::hdf5_hl PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5_hl-shared")
else()
message(FATAL_ERROR "could not find target hdf5_hl-*")
endif()
set(HDF5_LIBRARIES vtk::hdf5::hdf5 vtk::hdf5::hdf5_hl)
find_package_handle_standard_args(HDF5
REQUIRED_VARS HDF5_INCLUDE_DIRS HDF5_LIBRARIES
)

View File

@ -31,6 +31,7 @@ if ("python" IN_LIST FEATURES)
else() else()
set(VTK_WITH_PYTHON OFF) # IMPORTANT: if ON make sure `python3` 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
endif() endif()
if("openvr" IN_LIST FEATURES) if("openvr" IN_LIST FEATURES)
set(VTK_WITH_OPENVR ON) # IMPORTANT: if ON make sure `OpenVR` is listed as dependency in the CONTROL file set(VTK_WITH_OPENVR ON) # IMPORTANT: if ON make sure `OpenVR` is listed as dependency in the CONTROL file
else() else()
@ -80,6 +81,7 @@ vcpkg_apply_patches(
file(REMOVE ${SOURCE_PATH}/CMake/FindGLEW.cmake) file(REMOVE ${SOURCE_PATH}/CMake/FindGLEW.cmake)
file(REMOVE ${SOURCE_PATH}/CMake/FindPythonLibs.cmake) file(REMOVE ${SOURCE_PATH}/CMake/FindPythonLibs.cmake)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindGDAL.cmake DESTINATION ${SOURCE_PATH}/CMake) file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindGDAL.cmake DESTINATION ${SOURCE_PATH}/CMake)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindHDF5.cmake DESTINATION ${SOURCE_PATH}/CMake/NewCMake)
# ============================================================================= # =============================================================================
# Collect CMake options for optional components # Collect CMake options for optional components
@ -133,10 +135,6 @@ if(VTK_WITH_ALL_MODULES)
) )
endif() endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
list(APPEND ADDITIONAL_OPTIONS "-DVTK_EXTERNAL_HDF5_IS_SHARED=ON")
endif()
# ============================================================================= # =============================================================================
# Configure & Install # Configure & Install
vcpkg_configure_cmake( vcpkg_configure_cmake(
@ -169,12 +167,6 @@ vcpkg_configure_cmake(
-DVTK_INSTALL_PACKAGE_DIR=share/vtk -DVTK_INSTALL_PACKAGE_DIR=share/vtk
-DVTK_FORBID_DOWNLOADS=ON -DVTK_FORBID_DOWNLOADS=ON
${ADDITIONAL_OPTIONS} ${ADDITIONAL_OPTIONS}
OPTIONS_RELEASE
-DHDF5_C_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/hdf5.lib
-DHDF5_C_HL_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/hdf5_hl.lib
OPTIONS_DEBUG
-DHDF5_C_LIBRARY=${CURRENT_INSTALLED_DIR}/debug/lib/hdf5_D.lib
-DHDF5_C_HL_LIBRARY=${CURRENT_INSTALLED_DIR}/debug/lib/hdf5_hl_D.lib
) )
vcpkg_install_cmake() vcpkg_install_cmake()