Skip to content

Commit c63df9b

Browse files
Update HDF5 to v2.0.0 and Boost versions to 1.90 in CI
Upgrades HDF5 and Boost versions in CI workflows. Refactors HDF5 file access property list creation in HdfProxy.cpp to more cleanly ensure backward compatibility with HDF5 1.8. Fixes a typo in AbstractHdfProxy.h documentation. Adjusts CMake logic to better detect parallel HDF5 v2.0 builds.
1 parent 910a507 commit c63df9b

4 files changed

Lines changed: 50 additions & 35 deletions

File tree

.github/workflows/github-actions.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,28 @@ jobs:
2929
cmake --build . --config Release --target INSTALL
3030
- name: HDF5 install
3131
run: |
32-
Invoke-WebRequest https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/downloads/hdf5-1.14.6.zip -OutFile ${{ runner.temp }}\hdf5-1.14.6.zip
32+
Invoke-WebRequest https://support.hdfgroup.org/releases/hdf5/v2_0/v2_0_0/downloads/hdf5-2.0.0.zip -OutFile ${{ runner.temp }}\hdf5-2.0.0.zip
3333
cd ${{ runner.temp }}
34-
Expand-Archive ${{ runner.temp }}\hdf5-1.14.6.zip -DestinationPath ${{ runner.temp }}
34+
Expand-Archive ${{ runner.temp }}\hdf5-2.0.0.zip -DestinationPath ${{ runner.temp }}
3535
mkdir hdf5-build
3636
cd hdf5-build
37-
cmake -G"Visual Studio 17 2022" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_INCLUDE_DIR:PATH=${{ runner.temp }}/zlib-install/include -DZLIB_LIBRARY:PATH=${{ runner.temp }}/zlib-install/lib/zlibstatic.lib -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_GENERATORS:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/hdf5-install ${{ runner.temp }}/hdf5-1.14.6
37+
cmake -G"Visual Studio 17 2022" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=ON -DZLIB_ROOT:PATH=${{ runner.temp }}/zlib-install -DZLIB_INCLUDE_DIR:PATH=${{ runner.temp }}/zlib-install/include -DZLIB_LIBRARY:PATH=${{ runner.temp }}/zlib-install/lib/zlibstatic.lib -DBUILD_SHARED_LIBS:BOOL=OFF -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_GENERATORS:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/hdf5-install ${{ runner.temp }}/hdf5-2.0.0
3838
cmake --build . --config Release -j2
3939
cmake --build . --config Release --target INSTALL
4040
- name: Boost install
4141
run: |
42-
(New-Object System.Net.WebClient).DownloadFile("https://archives.boost.io/release/1.88.0/binaries/boost_1_88_0-msvc-14.3-64.exe", "${{ runner.temp }}\boost.exe")
42+
(New-Object System.Net.WebClient).DownloadFile("https://archives.boost.io/release/1.90.0/binaries/boost_1_90_0-msvc-14.3-64.exe", "${{ runner.temp }}\boost.exe")
4343
Start-Process -Wait -FilePath "${{ runner.temp }}\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=${{ runner.temp }}\boost-install"
4444
- name: Swig install
4545
run: |
46-
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.3.1.zip", "${{ runner.temp }}\swigwin-4.3.1.zip")
47-
7z x ${{ runner.temp }}\swigwin-4.3.1.zip -o${{ runner.temp }}
46+
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.4.1.zip", "${{ runner.temp }}\swigwin-4.4.1.zip")
47+
7z x ${{ runner.temp }}\swigwin-4.4.1.zip -o${{ runner.temp }}
4848
- name: CMake build and install
4949
run: |
5050
cd ${{ github.workspace }}/..
5151
mkdir build
5252
cd build
53-
cmake -G"Visual Studio 17 2022" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DHDF5_ROOT=${{ runner.temp }}/hdf5-install -DHDF5_USE_STATIC_LIBRARIES=TRUE -DMINIZIP_ROOT=${{ runner.temp }}/minizip-install -DZLIB_ROOT=${{ runner.temp }}/zlib-install -DZLIB_USE_STATIC_LIBS=TRUE -DBoost_INCLUDE_DIR=${{ runner.temp }}/boost-install -DWITH_EXAMPLE=TRUE -DWITH_RESQML2_2=TRUE -DWITH_DOTNET_WRAPPING=TRUE -DSWIG_EXECUTABLE=${{ runner.temp }}/swigwin-4.3.1/swig.exe -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/fesapi-install ${{ github.workspace }}
53+
cmake -G"Visual Studio 17 2022" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DHDF5_ROOT=${{ runner.temp }}/hdf5-install -DHDF5_USE_STATIC_LIBRARIES=TRUE -DMINIZIP_ROOT=${{ runner.temp }}/minizip-install -DZLIB_ROOT=${{ runner.temp }}/zlib-install -DZLIB_USE_STATIC_LIBS=TRUE -DBoost_INCLUDE_DIR=${{ runner.temp }}/boost-install -DWITH_EXAMPLE=TRUE -DWITH_RESQML2_2=TRUE -DWITH_DOTNET_WRAPPING=TRUE -DSWIG_EXECUTABLE=${{ runner.temp }}/swigwin-4.4.1/swig.exe -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/fesapi-install ${{ github.workspace }}
5454
cmake --build . --config Release -j2
5555
cmake --build . --config Release --target INSTALL
5656
- name: Add msbuild to PATH
@@ -97,12 +97,12 @@ jobs:
9797
- name: HDF5 build and install
9898
run: |
9999
cd ${{ runner.temp }}
100-
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.2/src/hdf5-1.12.2.tar.gz
101-
tar -xzf hdf5-1.12.2.tar.gz
102-
cd hdf5-1.12.2
100+
wget --no-verbose https://support.hdfgroup.org/releases/hdf5/v2_0/v2_0_0/downloads/hdf5-2.0.0.tar.gz
101+
tar -xzf hdf5-2.0.0.tar.gz
102+
cd hdf5-2.0.0
103103
mkdir build
104104
cd build
105-
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DCMAKE_INSTALL_PREFIX:STRING=${{ runner.temp }}/install-hdf5-1.12.2 ..
105+
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_GENERATORS:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX:STRING=${{ runner.temp }}/install-hdf5 ..
106106
cmake --build . --config Release
107107
make -j4
108108
make install
@@ -111,7 +111,7 @@ jobs:
111111
cd ..
112112
mkdir build
113113
cd build
114-
cmake -DHDF5_ROOT=${{ runner.temp }}/install-hdf5-1.12.2 -DHDF5_USE_STATIC_LIBRARIES=TRUE -DCMAKE_BUILD_TYPE=Release -DWITH_JAVA_WRAPPING=TRUE ${{ github.workspace }} -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/fesapi-install
114+
cmake -DHDF5_ROOT=${{ runner.temp }}/install-hdf5 -DHDF5_USE_STATIC_LIBRARIES=TRUE -DCMAKE_BUILD_TYPE=Release -DWITH_JAVA_WRAPPING=TRUE ${{ github.workspace }} -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/fesapi-install
115115
cmake --build . -j2
116116
cmake --install .
117117
- name: Run java example
@@ -213,26 +213,26 @@ jobs:
213213
# Dont use brew for dependencies https://github.com/pypa/cibuildwheel/issues/1251#issuecomment-1234553537
214214
CIBW_BEFORE_ALL: >
215215
cd ${{ github.workspace }}/.. &&
216-
wget https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz &&
217-
tar xf boost_1_87_0.tar.gz &&
216+
wget --no-verbose https://archives.boost.io/release/1.90.0/source/boost_1_90_0.tar.gz &&
217+
tar xf boost_1_90_0.tar.gz &&
218218
git clone https://github.com/F2I-Consulting/Minizip.git ${{ github.workspace }}/../minizip &&
219219
mkdir ${{ github.workspace }}/../minizip-build &&
220220
cd ${{ github.workspace }}/../minizip-build &&
221221
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/../minizip-install ${{ github.workspace }}/../minizip &&
222222
cmake --build . -j2 --config Release &&
223223
cmake --install . &&
224224
cd ${{ github.workspace }}/.. &&
225-
wget https://github.com/HDFGroup/hdf5/releases/download/hdf5_1.14.5/hdf5-1.14.5.tar.gz &&
226-
tar xf hdf5-1.14.5.tar.gz &&
225+
wget --no-verbose https://support.hdfgroup.org/releases/hdf5/v2_0/v2_0_0/downloads/hdf5-2.0.0.tar.gz &&
226+
tar xf hdf5-2.0.0.tar.gz &&
227227
mkdir hdf5-build &&
228228
cd hdf5-build &&
229-
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/../hdf5-install ${{ github.workspace }}/../hdf5-1.14.5 &&
229+
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_GENERATORS:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_UTILS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/../hdf5-install ${{ github.workspace }}/../hdf5-2.0.0 &&
230230
cmake --build . -j2 --config Release &&
231231
cmake --install . &&
232232
brew install swig &&
233233
mkdir ${{ github.workspace }}/../build &&
234234
cd ${{ github.workspace }}/../build &&
235-
cmake -DCMAKE_BUILD_TYPE=Release -DBOOST_ROOT=${{ github.workspace }}/../boost_1_87_0 -DMINIZIP_ROOT=${{ github.workspace }}/../minizip-install -DHDF5_ROOT=${{ github.workspace }}/../hdf5-install -DHDF5_USE_STATIC_LIBRARIES=TRUE -DWITH_PYTHON_WRAPPING=TRUE -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/../fesapi-install ${{ github.workspace }} &&
235+
cmake -DCMAKE_BUILD_TYPE=Release -DBOOST_ROOT=${{ github.workspace }}/../boost_1_90_0 -DMINIZIP_ROOT=${{ github.workspace }}/../minizip-install -DHDF5_ROOT=${{ github.workspace }}/../hdf5-install -DHDF5_USE_STATIC_LIBRARIES=TRUE -DWITH_PYTHON_WRAPPING=TRUE -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/../fesapi-install ${{ github.workspace }} &&
236236
cmake --build . -j2 --config Release &&
237237
cmake --install .
238238
# See https://cibuildwheel.pypa.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
@@ -306,7 +306,7 @@ jobs:
306306
env:
307307
HDF5_DOWNLOAD_URL: https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_1.tar.gz
308308
run: |
309-
wget ${{ env.HDF5_DOWNLOAD_URL }} -O hdf5_src.tgz
309+
wget --no-verbose ${{ env.HDF5_DOWNLOAD_URL }} -O hdf5_src.tgz
310310
tar -xvzf hdf5_src.tgz
311311
mkdir -p hdf5_build
312312
cd hdf5_build

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ ELSE()
6363
MESSAGE(FATAL_ERROR "Wrong HDF5_VERSION=${HDF5_VERSION}")
6464
ENDIF()
6565
IF(HDF5_PREFER_PARALLEL)
66-
if(NOT HDF5_IS_PARALLEL)
66+
if (NOT (HDF5_IS_PARALLEL OR HDF5_PROVIDES_PARALLEL))
6767
message(WARNING
6868
"Parallel HDF5 is preferred but only serial version found!"
6969
)
7070
ENDIF()
7171
ELSE()
72-
IF(HDF5_IS_PARALLEL)
72+
IF(HDF5_IS_PARALLEL OR HDF5_PROVIDES_PARALLEL)
7373
message(WARNING
7474
"Serial HDF5 is preferred but only parallel version found!"
7575
)

src/eml2/AbstractHdfProxy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace EML2_NS
2727
* It is possible to derive this class in a custom class in order for the FESAPI user
2828
* to get change the FESAPI reads from and writes to HDF5 file.
2929
* However, please note that the RESQML standard mandates so far a HDF5 1.8 backward compatibility.
30-
* In ordre to achieve this backward compatibility please use
30+
* In order to achieve this backward compatibility please use
3131
* hid_t access_props = H5Pcreate (H5P_FILE_ACCESS);
3232
* H5Pset_libver_bounds (access_props, H5F_LIBVER_V18, H5F_LIBVER_V18);
3333
* when you create an HDF5 file before to write into it.

src/eml2/HdfProxy.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,30 @@ void HdfProxy::writeUuidAttribute()
161161
}
162162
}
163163

164+
namespace {
165+
/**
166+
* Create a file access property list restricting HDF5 item creation to the HDF5 1.8.x family of library versions.
167+
*/
168+
hid_t createFileAccessProperyList() {
169+
hid_t access_props;
170+
if ((access_props = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
171+
throw runtime_error("Cannot create a new property list as an instance of a property list class.");
172+
}
173+
174+
#if H5_VERSION_GE(1, 10, 0)
175+
if (H5Pset_libver_bounds(access_props, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0) {
176+
#elif H5_VERSION_GE(1, 8, 0)
177+
if (H5Pset_libver_bounds(access_props, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
178+
#else
179+
#error Only HDF5 1.8.x and later supported.
180+
#endif
181+
throw runtime_error("Cannot set the HDF5 library version to 1.8");
182+
}
183+
184+
return access_props;
185+
}
186+
}
187+
164188
void HdfProxy::open()
165189
{
166190
if (hdfFile > -1) {
@@ -199,14 +223,9 @@ void HdfProxy::open()
199223
}
200224
}
201225
else if (openingMode == COMMON_NS::DataObjectRepository::openingMode::READ_WRITE) {
202-
hid_t access_props = H5Pcreate (H5P_FILE_ACCESS);
203-
#if H5_VERSION_GE(1,10,0)
204-
H5Pset_libver_bounds (access_props, H5F_LIBVER_V18, H5F_LIBVER_V18);
205-
#endif
206-
207-
hdfFile = H5Fcreate(fullName.c_str(), H5F_ACC_EXCL, H5P_DEFAULT, access_props);
226+
const hid_t access_props = createFileAccessProperyList();
208227

209-
if (hdfFile < 0) {
228+
if ((hdfFile = H5Fcreate(fullName.c_str(), H5F_ACC_EXCL, H5P_DEFAULT, access_props)) < 0) {
210229
openingMode = COMMON_NS::DataObjectRepository::openingMode::READ_WRITE_DO_NOT_CREATE;
211230
open();
212231
openingMode = COMMON_NS::DataObjectRepository::openingMode::READ_WRITE;
@@ -216,13 +235,9 @@ void HdfProxy::open()
216235
}
217236
}
218237
else if (openingMode == COMMON_NS::DataObjectRepository::openingMode::OVERWRITE) {
219-
hid_t access_props = H5Pcreate (H5P_FILE_ACCESS);
220-
#if H5_VERSION_GE(1,10,0)
221-
H5Pset_libver_bounds (access_props, H5F_LIBVER_V18, H5F_LIBVER_V18);
222-
#endif
238+
const hid_t access_props = createFileAccessProperyList();
223239

224-
hdfFile = H5Fcreate(fullName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, access_props);
225-
if (hdfFile < 0) {
240+
if ((hdfFile = H5Fcreate(fullName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, access_props)) < 0) {
226241
throw invalid_argument("Can not create HDF5 file : " + fullName);
227242
}
228243

0 commit comments

Comments
 (0)