Skip to content

Commit

Permalink
HDF5 2019-12-24 (5b9cf732)
Browse files Browse the repository at this point in the history
Code extracted from:

    https://github.com/HDFGroup/hdf5.git

at commit 5b9cf732caab9daa6ed1e00f2df4f5a792340196 (hdf5-1_10_6).

Change-Id: I3dd0268829f3d811f44e9e39b65b93ef96a2702f
  • Loading branch information
HDF5 Maintainers authored and hjmjohnson committed Dec 11, 2020
1 parent ba87e63 commit de4ebc5
Show file tree
Hide file tree
Showing 263 changed files with 26,097 additions and 15,276 deletions.
8 changes: 8 additions & 0 deletions CMakeFilters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT
set (TGZPATH ${HDF5_SOURCE_DIR})
endif ()
set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
if (NOT EXISTS "${ZLIB_URL}")
set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE)
message (STATUS "Filter ZLIB file ${ZLIB_URL} not found")
endif ()
set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME})
if (NOT EXISTS "${SZIP_URL}")
set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
message (STATUS "Filter SZIP file ${SZIP_URL} not found")
endif ()
else ()
set (ZLIB_USE_EXTERNAL 0)
set (SZIP_USE_EXTERNAL 0)
Expand Down
26 changes: 16 additions & 10 deletions CMakeInstallation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
EXPORT ${HDF5_EXPORTED_TARGETS}
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
NAMESPACE ${HDF5_PACKAGE}::
NAMESPACE ${HDF_PACKAGE_NAMESPACE}
COMPONENT configinstall
)
endif ()
Expand All @@ -45,7 +45,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
export (
TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} ${HDF5_UTILS_TO_EXPORT}
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
NAMESPACE ${HDF5_PACKAGE}::
NAMESPACE ${HDF_PACKAGE_NAMESPACE}
)
endif ()
endif ()
Expand Down Expand Up @@ -104,6 +104,12 @@ endif ()
# Configure the hdf5-config-version .cmake file for the install directory
#-----------------------------------------------------------------------------
if (NOT HDF5_EXTERNALLY_CONFIGURED)
# 3.11 or greater
#write_basic_package_version_file (
# ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake
# VERSION ${HDF5_PACKAGE_VERSION}
# COMPATIBILITY SameMinorVersion
#)
configure_file (
${HDF_RESOURCES_DIR}/hdf5-config-version.cmake.in
${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY
Expand All @@ -125,7 +131,7 @@ else ()
endif ()
configure_file (
${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in
${HDF5_BINARY_DIR}/libhdf5.settings @ONLY
${HDF5_BINARY_DIR}/libhdf5.settings ESCAPE_QUOTES @ONLY
)
install (
FILES ${HDF5_BINARY_DIR}/libhdf5.settings
Expand All @@ -134,7 +140,7 @@ install (
)

#-----------------------------------------------------------------------------
# Configure the HDF518_Examples.cmake file and the examples
# Configure the HDF5_Examples.cmake file and the examples
#-----------------------------------------------------------------------------
option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF)
if (HDF5_PACK_EXAMPLES)
Expand Down Expand Up @@ -186,7 +192,7 @@ HDF_README_PROPERTIES(HDF5_BUILD_FORTRAN)
#-----------------------------------------------------------------------------
# Configure the COPYING.txt file for the windows binary package
#-----------------------------------------------------------------------------
if (WIN32)
if (WIN32 OR MINGW)
configure_file (${HDF5_SOURCE_DIR}/COPYING ${HDF5_BINARY_DIR}/COPYING.txt @ONLY)
endif ()

Expand All @@ -206,7 +212,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
${HDF5_SOURCE_DIR}/release_docs/COPYING
${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt
)
if (WIN32)
if (WIN32 OR MINGW)
set (release_files
${release_files}
${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_VS.txt
Expand All @@ -220,7 +226,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_8.txt
${HDF5_SOURCE_DIR}/release_docs/INSTALL
)
if (WIN32)
if (WIN32 OR MINGW)
set (release_files
${release_files}
${HDF5_SOURCE_DIR}/release_docs/INSTALL_Windows.txt
Expand Down Expand Up @@ -288,7 +294,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES)
set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp")

set (CPACK_GENERATOR "TGZ")
if (WIN32)
if (WIN32 OR MINGW)
set (CPACK_GENERATOR "ZIP")

if (NSIS_EXECUTABLE)
Expand Down Expand Up @@ -453,7 +459,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut
if (HDF5_PACKAGE_EXTLIBS)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
if (WIN32)
if (WIN32 OR MINGW)
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;ALL;/")
else ()
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/")
Expand All @@ -462,7 +468,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut
endif ()
endif ()
if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
if (WIN32)
if (WIN32 OR MINGW)
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/")
else ()
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/")
Expand Down
119 changes: 88 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
cmake_minimum_required (VERSION 3.10)
project (HDF5 C)

if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()

#-----------------------------------------------------------------------------
# Instructions for use : Normal Build
#
Expand All @@ -10,7 +14,7 @@ project (HDF5 C)
# set CMAKE_INSTALL_PREFIX to the required install path.
# Make install can be used to install all components for system-wide use.
#
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
MESSAGE(FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n"
"CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
" == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}\n"
Expand All @@ -28,6 +32,12 @@ if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
)
endif ()

# CMake version 3.14 added option --ignore-eol to compare files
# cmake -E compare_files --ignore-eol file1 file2
#if(CMAKE_VERSION VERSION_LESS "3.14.0" AND WIN32)
# MESSAGE(FATAL_ERROR "Windows builds requires a minimum of CMake 3.14")
#endif()

#-----------------------------------------------------------------------------
# Instructions for use : Sub-Project Build
#
Expand Down Expand Up @@ -314,7 +324,7 @@ set (HDF5_PACKAGE_NAME "HDF5")
set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}")
set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}")
set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}")
if (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "")
if (H5_VERS_SUBRELEASE)
set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}")
else ()
set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}")
Expand Down Expand Up @@ -416,18 +426,23 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
# Mac OS X Options
#-----------------------------------------------------------------------------
if (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries")
set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
endif ()

#-----------------------------------------------------------------------------
# Option to Build Shared and Static libs, default is both
#-----------------------------------------------------------------------------
option (ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF)
set (H5_ENABLE_STATIC_LIB YES)
if (ONLY_SHARED_LIBS)
set (H5_ENABLE_STATIC_LIB NO)
set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries")
endif ()
option (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
set (H5_ENABLE_SHARED_LIB NO)
if (BUILD_SHARED_LIBS)
set (H5_ENABLE_SHARED_LIB YES)
endif ()
set (H5_ENABLE_STATIC_LIB YES)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -481,6 +496,15 @@ if (HDF5_MEMORY_ALLOC_SANITY_CHECK)
set (H5_MEMORY_ALLOC_SANITY_CHECK 1)
endif ()

#-----------------------------------------------------------------------------
# Option to enable/disable using pread/pwrite for VFDs
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON)
mark_as_advanced (HDF5_ENABLE_PREADWRITE)
if (HDF5_ENABLE_PREADWRITE AND H5_HAVE_PREAD AND H5_HAVE_PWRITE)
set (H5_HAVE_PREADWRITE 1)
endif ()

#-----------------------------------------------------------------------------
# Option to use deprecated public API symbols
#-----------------------------------------------------------------------------
Expand All @@ -498,7 +522,7 @@ endif ()
# and we need to call the executable from inside the CMake configuration
#-----------------------------------------------------------------------------
set (EXE_EXT "")
if (WIN32)
if (WIN32 OR MINGW)
set (EXE_EXT ".exe")
add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
Expand Down Expand Up @@ -553,6 +577,27 @@ endif ()
include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake)
set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH})

#-----------------------------------------------------------------------------
# Option to Enable HDFS
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_HDFS "Enable HDFS" OFF)
if (HDF5_ENABLE_HDFS)
find_package(JNI REQUIRED)
if (JNI_FOUND)
set (H5_HAVE_LIBJVM 1)
endif ()
find_package(HDFS REQUIRED)
if (HDFS_FOUND)
set (H5_HAVE_LIBHDFS 1)
set (H5_HAVE_HDFS_H 1)
if (NOT MSVC)
list (APPEND LINK_LIBS -pthread)
endif ()
else ()
message (FATAL_ERROR "Set to use libhdfs library, but could not find or use libhdfs. Please verify that the path to HADOOP_HOME is valid, and/or reconfigure without HDF5_ENABLE_HDFS")
endif ()
endif ()

#-----------------------------------------------------------------------------
# Option to Enable MPI Parallel
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -601,35 +646,34 @@ if (H5_HAVE_PARALLEL)
endif ()
endif ()

set (DEFAULT_API_VERSION "v110")
#option (DEFAULT_API_VERSION "Enable v1.10 API (v16, v18, v110)" "v110")
set (DEFAULT_API_VERSION "v110" CACHE STRING "Enable v1.10 API (v16, v18, v110)")
set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110)
#-----------------------------------------------------------------------------
# Option to use 1.6.x API
#-----------------------------------------------------------------------------
option (HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF)
set (H5_USE_16_API_DEFAULT 0)
if (HDF5_USE_16_API_DEFAULT)
if (DEFAULT_API_VERSION MATCHES "v16")
set (H5_USE_16_API_DEFAULT 1)
set (DEFAULT_API_VERSION "v16")
endif ()

#-----------------------------------------------------------------------------
# Option to use 1.8.x API
#-----------------------------------------------------------------------------
option (HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF)
set (H5_USE_18_API_DEFAULT 0)
if (HDF5_USE_18_API_DEFAULT)
if (DEFAULT_API_VERSION MATCHES "v18")
set (H5_USE_18_API_DEFAULT 1)
set (DEFAULT_API_VERSION "v18")
endif ()

#-----------------------------------------------------------------------------
# Option to use 1.10.x API
#-----------------------------------------------------------------------------
option (HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" ON)
if (NOT DEFAULT_API_VERSION)
set (DEFAULT_API_VERSION "v110")
endif ()
set (H5_USE_110_API_DEFAULT 0)
if (HDF5_USE_110_API_DEFAULT)
if (DEFAULT_API_VERSION MATCHES "v110")
set (H5_USE_110_API_DEFAULT 1)
set (DEFAULT_API_VERSION "v110")
endif ()

#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -658,14 +702,17 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED)
endif ()
endif ()
endif ()

#-----------------------------------------------------------------------------
# Option to use threadsafe
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF)
if (HDF5_ENABLE_THREADSAFE)
# check for unsupported options
message (STATUS " **** thread-safety option not supported with static library **** ")
message (STATUS " **** thread-safety option will not be used building static library **** ")
if (WIN32 OR MINGW)
message (STATUS " **** thread-safety option not supported with static library **** ")
message (STATUS " **** thread-safety option will not be used building static library **** ")
endif ()
if (HDF5_ENABLE_PARALLEL)
if (NOT ALLOW_UNSUPPORTED)
message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ")
Expand Down Expand Up @@ -703,9 +750,9 @@ if (HDF5_ENABLE_THREADSAFE)
endif ()
endif ()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
if (NOT Threads_FOUND)
message (STATUS " **** thread-safe package not found - threads still might work **** ")
find_package(Threads REQUIRED)
if (Threads_FOUND)
set (H5_HAVE_THREADSAFE 1)
endif ()
endif ()

Expand All @@ -716,13 +763,17 @@ add_subdirectory (src)

if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
add_dependencies (${HDF5_LIB_TARGET} ZLIB)
if (NOT ONLY_SHARED_LIBS)
add_dependencies (${HDF5_LIB_TARGET} ZLIB)
endif ()
if (BUILD_SHARED_LIBS)
add_dependencies (${HDF5_LIBSH_TARGET} ZLIB)
endif ()
endif ()
if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
add_dependencies (${HDF5_LIB_TARGET} SZIP)
if (NOT ONLY_SHARED_LIBS)
add_dependencies (${HDF5_LIB_TARGET} SZIP)
endif ()
if (BUILD_SHARED_LIBS)
add_dependencies (${HDF5_LIBSH_TARGET} SZIP)
endif ()
Expand All @@ -735,10 +786,15 @@ endif ()
option (BUILD_TESTING "Build HDF5 Unit Testing" ON)
if (BUILD_TESTING)
set (DART_TESTING_TIMEOUT 1200
CACHE INTEGER
CACHE STRING
"Timeout in seconds for each test (default 1200=20minutes)"
)

# Generate a list of timeouts based on DART_TESTING_TIMEOUT
math (EXPR CTEST_SHORT_TIMEOUT "${DART_TESTING_TIMEOUT} / 2")
math (EXPR CTEST_LONG_TIMEOUT "${DART_TESTING_TIMEOUT} * 2")
math (EXPR CTEST_VERY_LONG_TIMEOUT "${DART_TESTING_TIMEOUT} * 3")

option (HDF5_TEST_VFD "Execute tests with different VFDs" OFF)
mark_as_advanced (HDF5_TEST_VFD)
if (HDF5_TEST_VFD)
Expand Down Expand Up @@ -809,25 +865,20 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _")
if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF)
if (HDF5_BUILD_FORTRAN)

option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON)

include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake)

message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}")
# Building with PGI requires CMake 3.3 or greater because previous versions
# of CMake add the wrong compiler flag for the PGI Fortran compiler.
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "PGI" AND "${CMAKE_VERSION}" VERSION_LESS "3.3")
if (CMAKE_Fortran_COMPILER_ID MATCHES "PGI" AND CMAKE_VERSION VERSION_LESS "3.3")
message (FATAL_ERROR " **** PGI FORTRAN REQUIRES CMAKE VERSION 3.3 OR GREATER **** ")
endif ()

include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake)
set (LINK_Fortran_LIBS ${LINK_LIBS})

if (HDF5_ENABLE_F2003)
if (NOT FORTRAN_HAVE_ISO_C_BINDING)
set (HDF5_ENABLE_F2003 OFF)
endif ()
if (NOT H5_FORTRAN_HAVE_ISO_C_BINDING)
message (FATAL_ERROR " **** Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, disable HDF5_BUILD_FORTRAN **** ")
endif ()

# Parallel IO usage requires MPI to be Linked and Included
Expand Down Expand Up @@ -903,4 +954,10 @@ endif ()
#-----------------------------------------------------------------------------
configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY)

#-----------------------------------------------------------------------------
# Options for use by cross compiling and toolchains
#-----------------------------------------------------------------------------
option (HDF5_USE_PREGEN "Use pre-generated Files" OFF)
option (HDF5_BATCH_H5DETECT "Use a batch command for running h5detect" OFF)

include (CMakeInstallation.cmake)
Loading

0 comments on commit de4ebc5

Please sign in to comment.