From 80a6df219df2c0da54bd116c6ad177e3bfb651f1 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 17 Jul 2023 10:35:54 -0500 Subject: [PATCH 1/2] Fix CMake builds when Subfiling VFD isn't enabled --- src/CMakeLists.txt | 8 ++-- src/H5FDsubfiling/CMakeLists.txt | 65 ++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f12b07988c4..a0a67df054c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -280,10 +280,10 @@ set (H5FD_HDRS ${HDF5_SRC_DIR}/H5FDwindows.h ) -# Append Subfiling VFD and Mercury sources to H5FD interface if Subfiling VFD is built -if (HDF5_ENABLE_SUBFILING_VFD) - add_subdirectory (${H5FD_SUBFILING_DIR}) -endif() +# Append Subfiling VFD and Mercury sources to H5FD +# interface if Subfiling VFD is built. Append Subfiling +# VFD public headers to H5FD_HDRS regardless. +add_subdirectory (${H5FD_SUBFILING_DIR}) IDE_GENERATED_PROPERTIES ("H5FD" "${H5FD_HDRS}" "${H5FD_SOURCES}" ) diff --git a/src/H5FDsubfiling/CMakeLists.txt b/src/H5FDsubfiling/CMakeLists.txt index 89cd0c267c4..dd7f564f402 100644 --- a/src/H5FDsubfiling/CMakeLists.txt +++ b/src/H5FDsubfiling/CMakeLists.txt @@ -2,49 +2,56 @@ cmake_minimum_required (VERSION 3.18) project (HDF5_H5FD_SUBFILING C) # Sanity checking -if (NOT H5FD_SOURCES) - message (FATAL_ERROR "internal configure error - H5FD_SOURCES not set") -endif () if (NOT H5FD_HDRS) message (FATAL_ERROR "internal configure error - H5FD_HDRS not set") endif () if (NOT H5FD_SUBFILING_DIR) message (FATAL_ERROR "internal configure error - H5FD_SUBFILING_DIR not set") endif () -if (NOT H5FD_SUBFILING_MERCURY_DIR) - message (FATAL_ERROR "internal configure error - H5FD_SUBFILING_MERCURY_DIR not set") -endif () -# Add mercury util sources to Subfiling VFD sources -set (MERCURY_UTIL_SOURCES - ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread.c - ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread_condition.c - ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread_pool.c - ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread_mutex.c -) +if (HDF5_ENABLE_SUBFILING_VFD) + # Sanity checking + if (NOT H5FD_SOURCES) + message (FATAL_ERROR "internal configure error - H5FD_SOURCES not set") + endif () + if (NOT H5FD_SUBFILING_MERCURY_DIR) + message (FATAL_ERROR "internal configure error - H5FD_SUBFILING_MERCURY_DIR not set") + endif () -set (HDF5_H5FD_SUBFILING_SOURCES - ${H5FD_SUBFILING_DIR}/H5FDioc.c - ${H5FD_SUBFILING_DIR}/H5FDioc_int.c - ${H5FD_SUBFILING_DIR}/H5FDioc_threads.c - ${H5FD_SUBFILING_DIR}/H5FDsubfiling.c - ${H5FD_SUBFILING_DIR}/H5FDsubfile_int.c - ${H5FD_SUBFILING_DIR}/H5subfiling_common.c - ${MERCURY_UTIL_SOURCES} -) + # Add mercury util sources to Subfiling VFD sources + set (MERCURY_UTIL_SOURCES + ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread.c + ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread_condition.c + ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread_pool.c + ${H5FD_SUBFILING_MERCURY_DIR}/mercury_thread_mutex.c + ) + + set (HDF5_H5FD_SUBFILING_SOURCES + ${H5FD_SUBFILING_DIR}/H5FDioc.c + ${H5FD_SUBFILING_DIR}/H5FDioc_int.c + ${H5FD_SUBFILING_DIR}/H5FDioc_threads.c + ${H5FD_SUBFILING_DIR}/H5FDsubfiling.c + ${H5FD_SUBFILING_DIR}/H5FDsubfile_int.c + ${H5FD_SUBFILING_DIR}/H5subfiling_common.c + ${MERCURY_UTIL_SOURCES} + ) + # Add Subfiling VFD sources to HDF5 library's H5FD sources + set (H5FD_SOURCES + ${H5FD_SOURCES} + ${HDF5_H5FD_SUBFILING_SOURCES} + PARENT_SCOPE + ) +endif () + +# Add Subfiling VFD public headers to HDF5 library's +# public H5FD headers, even if the Subfiling VFD isn't +# enabled and built set (HDF5_H5FD_SUBFILING_HEADERS ${H5FD_SUBFILING_DIR}/H5FDsubfiling.h ${H5FD_SUBFILING_DIR}/H5FDioc.h ) -# Add Subfiling VFD sources to HDF5 library's H5FD sources -set (H5FD_SOURCES - ${H5FD_SOURCES} - ${HDF5_H5FD_SUBFILING_SOURCES} - PARENT_SCOPE -) - # Add Subfiling VFD public headers to HDF5 library's public H5FD headers set (H5FD_HDRS ${H5FD_HDRS} From 9c51e1ec78c3e2f12e9d2250540904d7f59c31aa Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 17 Jul 2023 11:25:53 -0500 Subject: [PATCH 2/2] Add Subfiling VFD entry to hdf5-config.cmake.in --- config/cmake/hdf5-config.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index ae6a45a8bdb..55fa86e285b 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -45,6 +45,7 @@ set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) set (${HDF5_PACKAGE_NAME}_ENABLE_ROS3_VFD @HDF5_ENABLE_ROS3_VFD@) +set (${HDF5_PACKAGE_NAME}_ENABLE_SUBFILING_VFD @HDF5_ENABLE_SUBFILING_VFD@) set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @H5_ENABLE_SHARED_LIB@) set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS @H5_ENABLE_STATIC_LIB@) set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@)