diff --git a/ports/hdf5/CONTROL b/ports/hdf5/CONTROL index 46049af870..b2364c3783 100644 --- a/ports/hdf5/CONTROL +++ b/ports/hdf5/CONTROL @@ -1,4 +1,4 @@ Source: hdf5 -Version: 1.8.18 +Version: 1.10.0-patch1 Description: HDF5 is a data model, library, and file format for storing and managing data Build-Depends: zlib, szip, msmpi \ No newline at end of file diff --git a/ports/hdf5/disable-static-libs.patch b/ports/hdf5/disable-static-libs.patch new file mode 100644 index 0000000000..4b7b440ec7 --- /dev/null +++ b/ports/hdf5/disable-static-libs.patch @@ -0,0 +1,90 @@ +diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt +index 872e42d..146d0a9 100644 +--- a/hl/src/CMakeLists.txt ++++ b/hl/src/CMakeLists.txt +@@ -29,16 +29,20 @@ set (HL_HEADERS + ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h + ) + +-add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SRCS} ${HL_HEADERS}) +-TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") +-target_link_libraries (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) +-H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC) +-set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES +- FOLDER libraries/hl +- INTERFACE_INCLUDE_DIRECTORIES "$/include>" +-) +-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") +-set (install_targets ${HDF5_HL_LIB_TARGET}) ++set (install_targets) ++ ++if (NOT DISABLE_STATIC_LIBS) ++ add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SRCS} ${HL_HEADERS}) ++ TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") ++ target_link_libraries (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) ++ H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC) ++ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES ++ FOLDER libraries/hl ++ INTERFACE_INCLUDE_DIRECTORIES "$/include>" ++ ) ++ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") ++ set (install_targets ${install_targets} ${HDF5_HL_LIB_TARGET}) ++endif (NOT DISABLE_STATIC_LIBS) + + if (BUILD_SHARED_LIBS) + add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index d93612b..a63cc3a 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -851,30 +851,33 @@ add_custom_command ( + #----------------------------------------------------------------------------- + set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) + +-add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) +-TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") +-target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) +-if (NOT WIN32) ++set (install_targets) ++if (NOT DISABLE_STATIC_LIBS) ++ add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) ++ TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") ++ target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) ++ if (NOT WIN32) + target_link_libraries (${HDF5_LIB_TARGET} dl) +-endif (NOT WIN32) +-if (H5_HAVE_PARALLEL AND MPI_C_FOUND) ++ endif (NOT WIN32) ++ if (H5_HAVE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) +-endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) +-set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) +-H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) +-set_target_properties (${HDF5_LIB_TARGET} PROPERTIES +- FOLDER libraries +- INTERFACE_INCLUDE_DIRECTORIES "$/include>" +-) ++ endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) ++ set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) ++ H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) ++ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES ++ FOLDER libraries ++ INTERFACE_INCLUDE_DIRECTORIES "$/include>" ++ ) + +-option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) +-if (HDF5_ENABLE_DEBUG_APIS) ++ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) ++ if (HDF5_ENABLE_DEBUG_APIS) + set_target_properties (${HDF5_LIB_TARGET} PROPERTIES + COMPILE_DEFINITIONS + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" + ) +-endif (HDF5_ENABLE_DEBUG_APIS) +-set (install_targets ${HDF5_LIB_TARGET}) ++ endif (HDF5_ENABLE_DEBUG_APIS) ++ set (install_targets ${install_targets} ${HDF5_LIB_TARGET}) ++endif (NOT DISABLE_STATIC_LIBS) + + if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") diff --git a/ports/hdf5/portfile.cmake b/ports/hdf5/portfile.cmake index f545434181..6eb8a6b28e 100644 --- a/ports/hdf5/portfile.cmake +++ b/ports/hdf5/portfile.cmake @@ -7,20 +7,40 @@ # include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/hdf5-1.8.18) +# set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/hdf5-1.8.18) +# vcpkg_download_distfile(ARCHIVE +# URLS "https://support.hdfgroup.org/ftp/HDF5/current18/src/hdf5-1.8.18.tar.bz2" +# FILENAME "hdf5-1.8.18.tar.bz2" +# SHA512 01f6d14bdd3be2ced9c63cc9e1820cd7ea11db649ff9f3a3055c18c4b0fffe777fd23baad536e3bce31c4d76fe17db64a3972762e1bb4d232927c1ca140e72b2 +# ) +# vcpkg_extract_source_archive(${ARCHIVE}) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CMake-hdf5-1.10.0-patch1/hdf5-1.10.0-patch1) vcpkg_download_distfile(ARCHIVE - URLS "https://support.hdfgroup.org/ftp/HDF5/current18/src/hdf5-1.8.18.tar.bz2" - FILENAME "hdf5-1.8.18.tar.bz2" - SHA512 01f6d14bdd3be2ced9c63cc9e1820cd7ea11db649ff9f3a3055c18c4b0fffe777fd23baad536e3bce31c4d76fe17db64a3972762e1bb4d232927c1ca140e72b2 + URLS "http://hdf4.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0-patch1/src/CMake-hdf5-1.10.0-patch1.zip" + FILENAME "CMake-hdf5-1.10.0-patch1.zip" + SHA512 ec2edb43438661323be5998ecf64c4dd537ddc7451e31f89390260d16883e60a1ccc1bf745bcb809af22f2bf7157d50331a33910b8ebf5c59cd50693dfb2ef8f ) vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/use-szip-config.patch + ${CMAKE_CURRENT_LIST_DIR}/disable-static-libs.patch +) + +set(DISABLE_STATIC_LIBS OFF) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(DISABLE_STATIC_LIBS ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=1 -DBUILD_TESTING=OFF + -DDISABLE_STATIC_LIBS=${DISABLE_STATIC_LIBS} -DHDF5_BUILD_EXAMPLES=OFF -DHDF5_BUILD_TOOLS=OFF -DHDF5_BUILD_CPP_LIB=OFF @@ -30,9 +50,6 @@ vcpkg_configure_cmake( -DHDF5_ENABLE_SZIP_ENCODING=ON -DHDF5_INSTALL_DATA_DIR=share/hdf5/data -DHDF5_INSTALL_CMAKE_DIR=share/hdf5 - "-DSZIP_LIBRARY_DEBUG=${CURRENT_INSTALLED_DIR}\\debug\\lib\\szip_D.lib" - "-DSZIP_LIBRARY_RELEASE=${CURRENT_INSTALLED_DIR}\\lib\\szip.lib" - "-DSZIP_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}\\include" ) vcpkg_install_cmake() diff --git a/ports/hdf5/use-szip-config.patch b/ports/hdf5/use-szip-config.patch new file mode 100644 index 0000000000..d7cd6748b6 --- /dev/null +++ b/ports/hdf5/use-szip-config.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake +index c2b81dc..a86d2d5 100644 +--- a/CMakeFilters.cmake ++++ b/CMakeFilters.cmake +@@ -81,6 +81,16 @@ if (HDF5_ENABLE_SZIP_SUPPORT) + if (NOT SZIP_USE_EXTERNAL) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) ++ find_package (SZIP CONFIG) ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set(SZIP_LIBRARIES szip-shared) ++ else (TARGET szip-shared) ++ set(SZIP_LIBRARIES szip-static) ++ endif (TARGET szip-shared) ++ endif (SZIP_FOUND) ++ endif (NOT SZIP_FOUND) ++ if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find + if (SZIP_FOUND) + set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})