Skip to content

Commit

Permalink
hdf5 version extract from old and new URL format
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Oct 10, 2024
1 parent f760599 commit 7824059
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cmake/hdf5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ set(HDF5_INCLUDE_DIRS ${CMAKE_INSTALL_FULL_INCLUDEDIR})
file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json)

# --- Zlib
if(build_zlib)
set(zlib_dep DEPENDS ZLIB)
if(TARGET ZLIB::ZLIB)
add_custom_target(ZLIB)
else()
include(${CMAKE_CURRENT_LIST_DIR}/zlib.cmake)
endif()
else()
set(zlib_dep)
endif()

# --- HDF5
# https://forum.hdfgroup.org/t/issues-when-using-hdf5-as-a-git-submodule-and-using-cmake-with-add-subdirectory/7189/2
Expand Down Expand Up @@ -76,6 +81,10 @@ endif()

if(hdf5_url MATCHES "hdf5_([0-9]+\.[0-9]+\.[0-9]+)\.")
set(HDF5_VERSION "${CMAKE_MATCH_1}")
elseif(hdf5_url MATCHES "hdf5-([0-9]+\_[0-9]+\_[0-9]+)")
string(REPLACE "_" "." HDF5_VERSION "${CMAKE_MATCH_1}")
else()
message(FATAL_ERROR "Could not determine HDF5 version from URL: ${hdf5_url}")
endif()

message(STATUS "Building HDF5 version ${HDF5_VERSION}")
Expand All @@ -84,7 +93,7 @@ ExternalProject_Add(HDF5
URL ${hdf5_url}
CMAKE_ARGS ${hdf5_cmake_args}
BUILD_BYPRODUCTS ${HDF5_LIBRARIES}
DEPENDS ZLIB
${zlib_dep}
CONFIGURE_HANDLED_BY_BUILD ON
USES_TERMINAL_DOWNLOAD true
USES_TERMINAL_UPDATE true
Expand Down
2 changes: 1 addition & 1 deletion cmake/libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"url" : "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.2.tar.gz"
},
"hdf5": {
"url": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.5.tar.gz"
"url": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_10_11.tar.gz"
}
}
1 change: 1 addition & 0 deletions scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LANGUAGES C Fortran

option(hdf5_parallel "build HDF5 parallel MPI")
option(zlib_legacy "use legacy zlib 1.x")
option(build_zlib "build zlib")

# --- system checks
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
Expand Down

0 comments on commit 7824059

Please sign in to comment.