From 40c2e2ad59e30ad95e083f964fa445ce33999e21 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 1 Nov 2025 10:52:09 +0100 Subject: [PATCH] CMake: Use statically built HDF5 again (given HDF5 is not usually part of OS stack) --- CMakeLists.txt | 15 ++++++++++++++- docs/CHANGELOG.md | 2 +- writer/CMakeLists.txt | 5 +---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dcb0d626..d4e7fda20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,13 @@ SET(PISTACHE_USE_CONTENT_ENCODING_DEFLATE ON) SET(PISTACHE_BUILD_TESTS OFF) SET(PISTACHE_USE_SSL ON) +SET(HDF5_ENABLE_SZIP_SUPPORT OFF) +SET(HDF5_ENABLE_SZIP_ENCODING OFF) +SET(HDF5_BUILD_EXAMPLES OFF) +SET(HDF5_BUILD_CPP_LIB OFF) +SET(HDF5_ENABLE_Z_LIB_SUPPORT ON) +SET(HDF5_EXTERNALLY_CONFIGURED 1) + FetchContent_Declare( pistache_http GIT_REPOSITORY https://github.com/fleon-psi/pistache @@ -95,6 +102,12 @@ FetchContent_Declare( EXCLUDE_FROM_ALL ) +FetchContent_Declare(hdf5 + GIT_REPOSITORY https://github.com/HDFGroup/hdf5/ + GIT_TAG hdf5_1.14.6 + GIT_SHALLOW 1 + EXCLUDE_FROM_ALL) + SET(SLS_DETECTOR_GIT_TAG "8.0.2") IF(SLS9) SET(SLS_DETECTOR_GIT_TAG "9.2.0") @@ -113,7 +126,7 @@ FetchContent_Declare( EXCLUDE_FROM_ALL ) -FetchContent_MakeAvailable(pistache_http zstd sls_detector_package catch2) +FetchContent_MakeAvailable(pistache_http zstd sls_detector_package catch2 hdf5) ADD_SUBDIRECTORY(jungfrau) ADD_SUBDIRECTORY(compression) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f1275f8a0..4e0a8c3b6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,7 +7,7 @@ This is an UNSTABLE release. * jfjoch_writer: Fix UTC timestamp being generated wrong (mix between milli- and microseconds) * jfjoch_viewer: Show data collection time in dataset tooltip * jfjoch_viewer: Allow to choose the calibrant (presets for LaB6 and silver behenate) -* Use external HDF5, libjpeg, and libtiff: simpler build stack, these are built and linked statically in automated Docker builds +* Use external libjpeg-turbo and libtiff: simpler build stack, these are built and linked statically in automated Docker builds * Remove OpenBLAS dependency ## 1.0.0-rc.95 diff --git a/writer/CMakeLists.txt b/writer/CMakeLists.txt index 469cc6e5e..6a75deed5 100644 --- a/writer/CMakeLists.txt +++ b/writer/CMakeLists.txt @@ -1,8 +1,5 @@ -SET(HDF5_USE_STATIC_LIBRARIES TRUE) -FIND_PACKAGE(HDF5 1.10 REQUIRED) - ADD_LIBRARY(JFJochHDF5Wrappers STATIC HDF5Objects.cpp HDF5Objects.h ../compression/bitshuffle/bshuf_h5filter.c) -TARGET_LINK_LIBRARIES(JFJochHDF5Wrappers Compression HDF5::HDF5 ${CMAKE_DL_LIBS}) +TARGET_LINK_LIBRARIES(JFJochHDF5Wrappers Compression hdf5-static) ADD_LIBRARY(JFJochWriter STATIC HDF5DataFile.h HDF5DataFile.cpp