[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 Source: hdf5
Version: 1.10.5-8 Version: 1.10.5-9
Homepage: https://www.hdfgroup.org/downloads/hdf5/ Homepage: https://www.hdfgroup.org/downloads/hdf5/
Description: HDF5 is a data model, library, and file format for storing and managing data Description: HDF5 is a data model, library, and file format for storing and managing data
Build-Depends: zlib, szip 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 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 3bd9e1dc..d95897d3 100644 index 3bd9e1d..7f6699c 100644
--- a/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in --- a/hdf5-1.10.5/config/cmake/hdf5-config.cmake.in
+++ b/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@) @@ -108,11 +108,15 @@ set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
# project which has already built hdf5 as a subproject # project which has already built hdf5 as a subproject
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (NOT TARGET "@HDF5_PACKAGE@") if (NOT TARGET "@HDF5_PACKAGE@")
- if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib") - 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) - 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}_ENABLE_Z_LIB_SUPPORT AND NOT TARGET "zlib")
+ if(${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) + find_package(ZLIB REQUIRED)
+ #include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) endif ()
+ else() - if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+ #find_package(@ZLIB_PACKAGE_NAME@ REQUIRED) - include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ endif() + if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND NOT TARGET "szip")
endif () + if(${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
- 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)
- include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) + else()
+ if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND NOT TARGET "szip") + find_package(@SZIP_PACKAGE_NAME@ REQUIRED)
+ if(${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) + endif()
+ include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) endif ()
+ else() include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
+ find_package(@SZIP_PACKAGE_NAME@ REQUIRED) endif ()
+ 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") vcpkg_fail_port_install(ON_TARGET "UWP")
message(FATAL_ERROR "${PORT} does not currently support UWP")
endif()
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE 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" 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" FILENAME "CMake-hdf5-1.10.5.tar.gz"
@ -15,18 +12,16 @@ vcpkg_extract_source_archive_ex(
REF hdf5 REF hdf5
PATCHES PATCHES
hdf5_config.patch hdf5_config.patch
fix-generate.patch
) )
if ("parallel" IN_LIST FEATURES) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
set(ENABLE_PARALLEL ON) parallel HDF5_ENABLE_PARALLEL
else() cpp HDF5_BUILD_CPP_LIB
set(ENABLE_PARALLEL OFF) )
endif()
if ("cpp" IN_LIST FEATURES) if ("parallel" IN_LIST FEATURES AND "cpp" IN_LIST FEATURES)
set(ENABLE_CPP ON) message(FATAL_ERROR "Feature Parallel and C++ options are mutually exclusive.")
else()
set(ENABLE_CPP OFF)
endif() endif()
file(REMOVE ${SOURCE_PATH}/config/cmake_ext_mod/FindSZIP.cmake)#Outdated; does not find debug szip 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 SOURCE_PATH ${SOURCE_PATH}/hdf5-1.10.5
DISABLE_PARALLEL_CONFIGURE DISABLE_PARALLEL_CONFIGURE
PREFER_NINJA PREFER_NINJA
OPTIONS OPTIONS ${FEATURE_OPTIONS}
-DBUILD_TESTING=OFF -DBUILD_TESTING=OFF
-DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_EXAMPLES=OFF
-DHDF5_BUILD_TOOLS=OFF -DHDF5_BUILD_TOOLS=OFF
-DHDF5_BUILD_CPP_LIB=${ENABLE_CPP}
-DHDF5_ENABLE_PARALLEL=${ENABLE_PARALLEL}
-DHDF5_ENABLE_Z_LIB_SUPPORT=ON -DHDF5_ENABLE_Z_LIB_SUPPORT=ON
-DHDF5_ENABLE_SZIP_SUPPORT=ON -DHDF5_ENABLE_SZIP_SUPPORT=ON
-DHDF5_ENABLE_SZIP_ENCODING=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/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright) 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/hdf5/vcpkg-cmake-wrapper.cmake @ONLY) configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)