2017-04-18 03:32:16 +08:00
|
|
|
#
|
|
|
|
# Copyright by The HDF Group.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
2024-10-19 12:13:04 +08:00
|
|
|
# the LICENSE file, which can be found at the root of the source code
|
2021-02-17 22:52:36 +08:00
|
|
|
# distribution tree, or in https://www.hdfgroup.org/licenses.
|
2017-04-18 03:32:16 +08:00
|
|
|
# If you do not have access to either file, you may request a copy from
|
|
|
|
# help@hdfgroup.org.
|
|
|
|
#
|
2024-06-05 00:44:13 +08:00
|
|
|
option (HDF5_USE_ZLIB_NG "Use zlib-ng library as zlib library" OFF)
|
2024-07-17 03:21:43 +08:00
|
|
|
option (HDF5_USE_ZLIB_STATIC "Find static zlib library" OFF)
|
|
|
|
option (HDF5_USE_LIBAEC_STATIC "Find static AEC library" OFF)
|
2024-06-05 00:44:13 +08:00
|
|
|
option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF)
|
|
|
|
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF)
|
2013-08-20 05:49:44 +08:00
|
|
|
|
2023-10-05 04:51:01 +08:00
|
|
|
if (NOT ZLIB_USE_LOCALCONTENT)
|
2024-06-05 00:44:13 +08:00
|
|
|
if (HDF5_USE_ZLIB_NG)
|
|
|
|
set (ZLIB_URL ${ZLIBNG_TGZ_ORIGPATH}/${ZLIBNG_TGZ_NAME})
|
|
|
|
else ()
|
|
|
|
set (ZLIB_URL ${ZLIB_TGZ_ORIGPATH}/${ZLIB_TGZ_NAME})
|
|
|
|
endif ()
|
2023-10-05 04:51:01 +08:00
|
|
|
else ()
|
2024-06-05 00:44:13 +08:00
|
|
|
if (HDF5_USE_ZLIB_NG)
|
|
|
|
set (ZLIB_URL ${TGZPATH}/${ZLIBNG_TGZ_NAME})
|
|
|
|
else ()
|
|
|
|
set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
|
|
|
|
endif ()
|
2023-10-05 04:51:01 +08:00
|
|
|
endif ()
|
2024-03-12 23:35:30 +08:00
|
|
|
message (VERBOSE "Filter ZLIB file is ${ZLIB_URL}")
|
2023-02-27 07:06:14 +08:00
|
|
|
|
2023-10-05 04:51:01 +08:00
|
|
|
if (NOT LIBAEC_USE_LOCALCONTENT)
|
2023-10-10 22:30:19 +08:00
|
|
|
set (SZIP_URL ${LIBAEC_TGZ_ORIGPATH}/${LIBAEC_TGZ_NAME})
|
2023-10-05 04:51:01 +08:00
|
|
|
else ()
|
2023-10-10 22:30:19 +08:00
|
|
|
set (SZIP_URL ${TGZPATH}/${LIBAEC_TGZ_NAME})
|
2023-10-05 04:51:01 +08:00
|
|
|
endif ()
|
2024-03-12 23:35:30 +08:00
|
|
|
message (VERBOSE "Filter SZIP file is ${SZIP_URL}")
|
2020-09-26 05:43:57 +08:00
|
|
|
|
2023-02-27 07:06:14 +08:00
|
|
|
include (ExternalProject)
|
2017-09-14 03:57:55 +08:00
|
|
|
#option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO")
|
|
|
|
set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)")
|
|
|
|
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ)
|
|
|
|
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
2024-05-23 04:11:37 +08:00
|
|
|
set (ZLIB_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for ZLIB else search" FORCE)
|
|
|
|
set (SZIP_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for SZIP else search" FORCE)
|
2016-08-09 03:52:13 +08:00
|
|
|
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT")
|
|
|
|
set (ZLIB_URL ${ZLIB_GIT_URL} CACHE STRING "Path to zlib git repository")
|
2016-10-05 05:46:13 +08:00
|
|
|
set (ZLIB_BRANCH ${ZLIB_GIT_BRANCH})
|
2023-12-13 12:10:27 +08:00
|
|
|
set (SZIP_URL ${LIBAEC_GIT_URL} CACHE STRING "Path to szip git repository")
|
|
|
|
set (SZIP_BRANCH ${LIBAEC_GIT_BRANCH})
|
2014-03-12 05:14:57 +08:00
|
|
|
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
|
|
|
if (NOT TGZPATH)
|
|
|
|
set (TGZPATH ${HDF5_SOURCE_DIR})
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2023-05-19 05:05:20 +08:00
|
|
|
if (ZLIB_USE_LOCALCONTENT)
|
|
|
|
if (NOT EXISTS "${ZLIB_URL}")
|
|
|
|
set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE)
|
|
|
|
message (VERBOSE "Filter ZLIB file ${ZLIB_URL} not found")
|
|
|
|
endif ()
|
2019-02-06 05:25:30 +08:00
|
|
|
endif ()
|
2023-05-19 05:05:20 +08:00
|
|
|
if (LIBAEC_USE_LOCALCONTENT)
|
|
|
|
if (NOT EXISTS "${SZIP_URL}")
|
|
|
|
set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
|
|
|
|
message (VERBOSE "Filter SZIP file ${SZIP_URL} not found")
|
|
|
|
endif ()
|
2019-02-06 05:25:30 +08:00
|
|
|
endif ()
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2023-10-18 09:32:31 +08:00
|
|
|
set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE)
|
2024-05-23 04:11:37 +08:00
|
|
|
set (ZLIB_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for ZLIB else search")
|
2023-10-18 09:32:31 +08:00
|
|
|
set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
|
2024-05-23 04:11:37 +08:00
|
|
|
set (SZIP_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for SZIP else search")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2013-08-20 05:49:44 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Option for ZLib support
|
|
|
|
#-----------------------------------------------------------------------------
|
2024-05-21 03:58:10 +08:00
|
|
|
set(H5_ZLIB_FOUND FALSE)
|
2023-05-19 05:05:20 +08:00
|
|
|
option (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (HDF5_ENABLE_Z_LIB_SUPPORT)
|
|
|
|
if (NOT H5_ZLIB_HEADER)
|
|
|
|
if (NOT ZLIB_USE_EXTERNAL)
|
2024-06-05 00:44:13 +08:00
|
|
|
if (HDF5_USE_ZLIB_NG)
|
|
|
|
set (PACKAGE_NAME ${ZLIBNG_PACKAGE_NAME}${HDF_PACKAGE_EXT})
|
|
|
|
else ()
|
|
|
|
set (PACKAGE_NAME ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
|
|
|
|
endif ()
|
2024-05-21 03:58:10 +08:00
|
|
|
set(ZLIB_FOUND FALSE)
|
2024-07-17 03:21:43 +08:00
|
|
|
if (HDF5_USE_ZLIB_STATIC)
|
|
|
|
set(ZLIB_SEACH_TYPE static)
|
|
|
|
else ()
|
|
|
|
set(ZLIB_SEACH_TYPE shared)
|
|
|
|
endif ()
|
|
|
|
find_package (ZLIB NAMES ${PACKAGE_NAME} COMPONENTS ${ZLIB_SEACH_TYPE})
|
2024-05-21 03:58:10 +08:00
|
|
|
if (NOT ZLIB_FOUND)
|
2024-07-17 03:21:43 +08:00
|
|
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
|
|
|
set(ZLIB_USE_STATIC_LIBS ${HDF5_USE_ZLIB_STATIC})
|
|
|
|
endif()
|
2015-02-13 05:52:48 +08:00
|
|
|
find_package (ZLIB) # Legacy find
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2024-05-21 03:58:10 +08:00
|
|
|
set(H5_ZLIB_FOUND ${ZLIB_FOUND})
|
2024-05-11 02:01:28 +08:00
|
|
|
if (H5_ZLIB_FOUND)
|
2024-10-24 05:20:15 +08:00
|
|
|
if (HDF5_USE_ZLIB_NG)
|
|
|
|
set (H5_ZLIB_HEADER "zlib-ng.h")
|
|
|
|
else ()
|
|
|
|
set (H5_ZLIB_HEADER "zlib.h")
|
|
|
|
endif ()
|
2024-05-23 04:11:37 +08:00
|
|
|
set (H5_ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
|
|
|
|
set (H5_ZLIB_INCLUDE_DIRS ${H5_ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
2024-07-17 03:21:43 +08:00
|
|
|
# The FindZLIB.cmake module does not set an OUTPUT_NAME
|
|
|
|
# on the target. The target returned is: ZLIB::ZLIB
|
|
|
|
get_filename_component (libname ${ZLIB_LIBRARIES} NAME_WLE)
|
|
|
|
string (REGEX REPLACE "^lib" "" libname ${libname})
|
2024-10-18 00:20:47 +08:00
|
|
|
set_target_properties (ZLIB::ZLIB PROPERTIES OUTPUT_NAME ${libname})
|
2024-07-17 03:21:43 +08:00
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ZLIB::ZLIB)
|
2023-02-27 07:06:14 +08:00
|
|
|
endif ()
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2023-10-05 04:51:01 +08:00
|
|
|
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
2015-08-05 23:56:58 +08:00
|
|
|
EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT})
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter HDF5_ZLIB is built")
|
2024-05-11 02:01:28 +08:00
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${H5_ZLIB_STATIC_LIBRARY})
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
else ()
|
2013-08-20 05:49:44 +08:00
|
|
|
# This project is being called from within another and ZLib is already configured
|
2024-05-21 03:58:10 +08:00
|
|
|
set(H5_ZLIB_FOUND TRUE)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2024-05-11 02:01:28 +08:00
|
|
|
if (H5_ZLIB_FOUND)
|
2023-06-06 00:20:50 +08:00
|
|
|
set (H5_HAVE_FILTER_DEFLATE 1)
|
|
|
|
set (H5_HAVE_ZLIB_H 1)
|
2024-10-24 05:20:15 +08:00
|
|
|
if (HDF5_USE_ZLIB_NG)
|
|
|
|
set (H5_HAVE_ZLIBNG_H 1)
|
|
|
|
endif ()
|
2023-06-06 00:20:50 +08:00
|
|
|
set (H5_HAVE_LIBZ 1)
|
2023-05-19 05:05:20 +08:00
|
|
|
if (H5_HAVE_FILTER_DEFLATE)
|
|
|
|
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE")
|
|
|
|
endif ()
|
2024-05-11 02:01:28 +08:00
|
|
|
set (HDF5_COMP_INCLUDE_DIRECTORIES "${HDF5_COMP_INCLUDE_DIRECTORIES};${H5_ZLIB_INCLUDE_DIRS}")
|
2023-05-19 05:05:20 +08:00
|
|
|
message (VERBOSE "Filter HDF5_ZLIB is ON")
|
|
|
|
else ()
|
2023-10-18 09:32:31 +08:00
|
|
|
set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE)
|
2023-05-19 05:05:20 +08:00
|
|
|
message (WARNING " ZLib support in HDF5 was enabled but not found")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2024-10-24 05:20:15 +08:00
|
|
|
message(STATUS "H5_ZLIB_HEADER=${H5_ZLIB_HEADER}")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2013-08-20 05:49:44 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Option for SzLib support
|
|
|
|
#-----------------------------------------------------------------------------
|
2024-05-21 03:58:10 +08:00
|
|
|
set(H5_SZIP_FOUND FALSE)
|
2023-08-24 03:32:09 +08:00
|
|
|
option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" ON)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (HDF5_ENABLE_SZIP_SUPPORT)
|
2023-05-19 05:05:20 +08:00
|
|
|
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (NOT SZIP_USE_EXTERNAL)
|
2024-07-17 03:21:43 +08:00
|
|
|
if (HDF5_USE_LIBAEC_STATIC)
|
|
|
|
set(LIBAEC_SEACH_TYPE static)
|
|
|
|
else ()
|
|
|
|
set(LIBAEC_SEACH_TYPE shared)
|
|
|
|
endif ()
|
2024-05-21 03:58:10 +08:00
|
|
|
set(libaec_USE_STATIC_LIBS ${HDF5_USE_LIBAEC_STATIC})
|
|
|
|
set(SZIP_FOUND FALSE)
|
2024-07-17 03:21:43 +08:00
|
|
|
find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS ${LIBAEC_SEACH_TYPE})
|
2024-06-15 00:03:00 +08:00
|
|
|
if (NOT SZIP_FOUND)
|
|
|
|
find_package (SZIP) # Legacy find
|
2023-06-06 00:20:50 +08:00
|
|
|
endif ()
|
2024-05-21 03:58:10 +08:00
|
|
|
set(H5_SZIP_FOUND ${SZIP_FOUND})
|
2024-05-11 02:01:28 +08:00
|
|
|
if (H5_SZIP_FOUND)
|
2024-05-23 04:11:37 +08:00
|
|
|
set (H5_SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
|
|
|
|
set (H5_SZIP_INCLUDE_DIRS ${H5_SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR})
|
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
|
2021-07-14 23:42:14 +08:00
|
|
|
endif ()
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2023-10-05 04:51:01 +08:00
|
|
|
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
2015-08-05 23:56:58 +08:00
|
|
|
EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING})
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter SZIP is built")
|
2023-04-24 04:11:17 +08:00
|
|
|
message (VERBOSE "... with library AEC")
|
2024-05-11 02:01:28 +08:00
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${H5_SZIP_STATIC_LIBRARY})
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2024-05-11 02:01:28 +08:00
|
|
|
if (H5_SZIP_FOUND)
|
2023-06-06 00:20:50 +08:00
|
|
|
set (H5_HAVE_FILTER_SZIP 1)
|
|
|
|
set (H5_HAVE_SZLIB_H 1)
|
|
|
|
set (H5_HAVE_LIBSZ 1)
|
2024-05-11 02:01:28 +08:00
|
|
|
set (HDF5_COMP_INCLUDE_DIRECTORIES "${HDF5_COMP_INCLUDE_DIRECTORIES};${H5_SZIP_INCLUDE_DIRS}")
|
2023-05-19 05:05:20 +08:00
|
|
|
message (VERBOSE "Filter SZIP is ON")
|
|
|
|
if (H5_HAVE_FILTER_SZIP)
|
|
|
|
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE")
|
|
|
|
endif ()
|
|
|
|
if (HDF5_ENABLE_SZIP_ENCODING)
|
|
|
|
set (H5_HAVE_SZIP_ENCODER 1)
|
|
|
|
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} ENCODE")
|
|
|
|
endif ()
|
|
|
|
else ()
|
2023-10-18 09:32:31 +08:00
|
|
|
set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
|
2023-05-19 05:05:20 +08:00
|
|
|
message (WARNING "SZIP support in HDF5 was enabled but not found")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|