[hdf5] Fix static builds when building dynamic builds (#9043)

* [hdf5]Fix static builds when building dynamic builds.

* [hdf5]Remove duplicate code, fix zlib library name.

* [hdf5]Adapt links to different link types of szip.

* [hdf5] Fix hdf5-config.cmake.in
This commit is contained in:
Jack·Boos·Yu 2020-01-07 06:13:34 +08:00 committed by dan-shaw
parent 0c481e12f1
commit f23734d2b6
4 changed files with 1785 additions and 47 deletions

View File

@ -1,5 +1,5 @@
Source: hdf5
Version: 1.10.5-8
Version: 1.10.5-9
Homepage: https://www.hdfgroup.org/downloads/hdf5/
Description: HDF5 is a data model, library, and file format for storing and managing data
Build-Depends: zlib, szip

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,24 @@
diff --git a/hdf5-config.cmake.in_old b/hdf5-config.cmake.in
index 3bd9e1dc..d95897d3 100644
--- a/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in
+++ b/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in
@@ -108,11 +108,19 @@ set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
# project which has already built hdf5 as a subproject
#-----------------------------------------------------------------------------
if (NOT TARGET "@HDF5_PACKAGE@")
- if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
- include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND NOT TARGET "zlib")
+ if(${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
+ #include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ else()
+ #find_package(@ZLIB_PACKAGE_NAME@ REQUIRED)
+ endif()
endif ()
- if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip")
- include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND NOT TARGET "szip")
+ if(${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
+ include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ else()
+ find_package(@SZIP_PACKAGE_NAME@ REQUIRED)
+ endif()
endif ()
include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
endif ()
diff --git a/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in b/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in
index 3bd9e1d..7f6699c 100644
--- a/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in
+++ b/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in
@@ -108,11 +108,15 @@ set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
# project which has already built hdf5 as a subproject
#-----------------------------------------------------------------------------
if (NOT TARGET "@HDF5_PACKAGE@")
- if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
- include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND NOT TARGET "zlib")
+ find_package(ZLIB REQUIRED)
endif ()
- if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip")
- include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND NOT TARGET "szip")
+ if(${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
+ include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ else()
+ find_package(@SZIP_PACKAGE_NAME@ REQUIRED)
+ endif()
endif ()
include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
endif ()

View File

@ -1,8 +1,5 @@
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "${PORT} does not currently support UWP")
endif()
vcpkg_fail_port_install(ON_TARGET "UWP")
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URLS "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/CMake-hdf5-1.10.5.tar.gz"
FILENAME "CMake-hdf5-1.10.5.tar.gz"
@ -15,18 +12,16 @@ vcpkg_extract_source_archive_ex(
REF hdf5
PATCHES
hdf5_config.patch
fix-generate.patch
)
if ("parallel" IN_LIST FEATURES)
set(ENABLE_PARALLEL ON)
else()
set(ENABLE_PARALLEL OFF)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
parallel HDF5_ENABLE_PARALLEL
cpp HDF5_BUILD_CPP_LIB
)
if ("cpp" IN_LIST FEATURES)
set(ENABLE_CPP ON)
else()
set(ENABLE_CPP OFF)
if ("parallel" IN_LIST FEATURES AND "cpp" IN_LIST FEATURES)
message(FATAL_ERROR "Feature Parallel and C++ options are mutually exclusive.")
endif()
file(REMOVE ${SOURCE_PATH}/config/cmake_ext_mod/FindSZIP.cmake)#Outdated; does not find debug szip
@ -35,12 +30,10 @@ vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/hdf5-1.10.5
DISABLE_PARALLEL_CONFIGURE
PREFER_NINJA
OPTIONS
OPTIONS ${FEATURE_OPTIONS}
-DBUILD_TESTING=OFF
-DHDF5_BUILD_EXAMPLES=OFF
-DHDF5_BUILD_TOOLS=OFF
-DHDF5_BUILD_CPP_LIB=${ENABLE_CPP}
-DHDF5_ENABLE_PARALLEL=${ENABLE_PARALLEL}
-DHDF5_ENABLE_Z_LIB_SUPPORT=ON
-DHDF5_ENABLE_SZIP_SUPPORT=ON
-DHDF5_ENABLE_SZIP_ENCODING=ON
@ -61,5 +54,5 @@ endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright)
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/hdf5/vcpkg-cmake-wrapper.cmake @ONLY)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)