From 69bc4b4d3247c2d423e900eed922968c22abd710 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 5 Dec 2023 19:42:20 +0100 Subject: [PATCH] Update libhdf5 requirement to 1.10 and do associated cleanups --- cmake/helpers/CheckDependentLibraries.cmake | 7 +++--- frmts/hdf5/hdf5vfl.h | 27 +++++---------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/cmake/helpers/CheckDependentLibraries.cmake b/cmake/helpers/CheckDependentLibraries.cmake index 3201d5886158..750687ebd2ac 100644 --- a/cmake/helpers/CheckDependentLibraries.cmake +++ b/cmake/helpers/CheckDependentLibraries.cmake @@ -113,7 +113,8 @@ macro (gdal_check_package name purpose) find_package2(${name} QUIET OUT_DEPENDENCY _find_dependency) else() set(_find_package_args) - if (_GCP_VERSION AND NOT ("${name}" STREQUAL "TileDB")) + # For some reason passing the HDF5 version requirement cause a linking error of the libkea driver on Conda Windows builds... + if (_GCP_VERSION AND NOT ("${name}" STREQUAL "TileDB") AND NOT ("${name}" STREQUAL "HDF5")) list(APPEND _find_package_args ${_GCP_VERSION}) endif () if (_GCP_CONFIG) @@ -581,9 +582,9 @@ gdal_check_package(KEA "Enable KEA driver" CAN_DISABLE) if(HAVE_KEA) # CXX is only needed for KEA driver - gdal_check_package(HDF5 "Enable HDF5" COMPONENTS "C" "CXX" CAN_DISABLE) + gdal_check_package(HDF5 "Enable HDF5" COMPONENTS "C" "CXX" CAN_DISABLE VERSION 1.10) else() - gdal_check_package(HDF5 "Enable HDF5" COMPONENTS "C" CAN_DISABLE) + gdal_check_package(HDF5 "Enable HDF5" COMPONENTS "C" CAN_DISABLE VERSION 1.10) endif() gdal_check_package(WebP "WebP compression" CAN_DISABLE) diff --git a/frmts/hdf5/hdf5vfl.h b/frmts/hdf5/hdf5vfl.h index 8ff4a468e6a4..d43b21b8c132 100644 --- a/frmts/hdf5/hdf5vfl.h +++ b/frmts/hdf5/hdf5vfl.h @@ -38,10 +38,6 @@ #include #include -#ifdef H5FD_FEAT_SUPPORTS_SWMR_IO -#define HDF5_1_10_OR_LATER -#endif - #ifdef H5FD_FEAT_MEMMANAGE #define HDF5_1_13_OR_LATER #endif @@ -63,12 +59,7 @@ static herr_t HDF5_vsil_close(H5FD_t *_file); static herr_t HDF5_vsil_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t HDF5_vsil_get_eoa(const H5FD_t *_file, H5FD_mem_t type); static herr_t HDF5_vsil_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t HDF5_vsil_get_eof(const H5FD_t *_file -#ifdef HDF5_1_10_OR_LATER - , - H5FD_mem_t type -#endif -); +static haddr_t HDF5_vsil_get_eof(const H5FD_t *_file, H5FD_mem_t type); static herr_t HDF5_vsil_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t HDF5_vsil_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, @@ -90,12 +81,10 @@ static const H5FD_class_t HDF5_vsil_g = { * https://portal.hdfgroup.org/pages/viewpage.action?pageId=74188097 */ (H5FD_class_value_t)(513), #endif - "vsil", /* name */ - MAXADDR, /* maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ -#ifdef HDF5_1_10_OR_LATER - nullptr, /* terminate */ -#endif + "vsil", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + nullptr, /* terminate */ nullptr, /* sb_size */ nullptr, /* sb_encode */ nullptr, /* sb_decode */ @@ -207,11 +196,7 @@ static herr_t HDF5_vsil_set_eoa(H5FD_t *_file, H5FD_mem_t /*type*/, return 0; } -static haddr_t HDF5_vsil_get_eof(const H5FD_t *_file -#ifdef HDF5_1_10_OR_LATER - , - H5FD_mem_t /* type */ -#endif +static haddr_t HDF5_vsil_get_eof(const H5FD_t *_file, H5FD_mem_t /* type */ ) { const HDF5_vsil_t *fh = reinterpret_cast(_file);