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
|
|
|
|
# the COPYING 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.
|
|
|
|
#
|
2020-04-23 00:48:45 +08:00
|
|
|
option (USE_LIBAEC "Use AEC library as SZip Filter" OFF)
|
2021-07-14 23:42:14 +08:00
|
|
|
option (USE_LIBAEC_STATIC "Use static AEC library " OFF)
|
2013-08-20 05:49:44 +08:00
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
include (ExternalProject)
|
2020-12-17 01:59:51 +08:00
|
|
|
include (FetchContent)
|
2020-09-26 05:43:57 +08:00
|
|
|
|
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")
|
2022-02-18 00:05:08 +08:00
|
|
|
option (ZLIB_USE_EXTERNAL "Use External Library Building for HDF5_ZLIB" 1)
|
2014-03-12 05:14:57 +08:00
|
|
|
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1)
|
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})
|
2016-08-09 03:52:13 +08:00
|
|
|
set (SZIP_URL ${SZIP_GIT_URL} CACHE STRING "Path to szip git repository")
|
2016-10-05 05:46:13 +08:00
|
|
|
set (SZIP_BRANCH ${SZIP_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 ()
|
2014-03-12 05:14:57 +08:00
|
|
|
set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
|
2019-02-06 05:25:30 +08:00
|
|
|
if (NOT EXISTS "${ZLIB_URL}")
|
2019-02-06 05:44:38 +08:00
|
|
|
set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE)
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter ZLIB file ${ZLIB_URL} not found")
|
2019-02-06 05:25:30 +08:00
|
|
|
endif ()
|
2014-03-12 05:14:57 +08:00
|
|
|
set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME})
|
2020-04-23 00:48:45 +08:00
|
|
|
if (USE_LIBAEC)
|
|
|
|
set (SZIP_URL ${TGZPATH}/${SZAEC_TGZ_NAME})
|
|
|
|
endif ()
|
2019-02-06 05:25:30 +08:00
|
|
|
if (NOT EXISTS "${SZIP_URL}")
|
2019-02-06 05:44:38 +08:00
|
|
|
set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter SZIP file ${SZIP_URL} not found")
|
2019-02-06 05:25:30 +08:00
|
|
|
endif ()
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2014-03-12 05:14:57 +08:00
|
|
|
set (ZLIB_USE_EXTERNAL 0)
|
|
|
|
set (SZIP_USE_EXTERNAL 0)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2013-08-20 05:49:44 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Option for ZLib support
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-03-12 05:14:57 +08:00
|
|
|
option (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF)
|
|
|
|
if (HDF5_ENABLE_Z_LIB_SUPPORT)
|
|
|
|
if (NOT H5_ZLIB_HEADER)
|
|
|
|
if (NOT ZLIB_USE_EXTERNAL)
|
2015-08-05 23:56:58 +08:00
|
|
|
find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (NOT ZLIB_FOUND)
|
2015-02-13 05:52:48 +08:00
|
|
|
find_package (ZLIB) # Legacy find
|
2015-03-26 06:08:46 +08:00
|
|
|
if (ZLIB_FOUND)
|
2017-11-16 07:14:35 +08:00
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2014-03-12 05:14:57 +08:00
|
|
|
if (ZLIB_FOUND)
|
|
|
|
set (H5_HAVE_FILTER_DEFLATE 1)
|
|
|
|
set (H5_HAVE_ZLIB_H 1)
|
|
|
|
set (H5_HAVE_LIBZ 1)
|
|
|
|
set (H5_ZLIB_HEADER "zlib.h")
|
|
|
|
set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
|
2015-03-26 06:08:46 +08:00
|
|
|
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2017-09-14 03:57:55 +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})
|
2014-03-12 05:14:57 +08:00
|
|
|
set (H5_HAVE_FILTER_DEFLATE 1)
|
|
|
|
set (H5_HAVE_ZLIB_H 1)
|
|
|
|
set (H5_HAVE_LIBZ 1)
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter HDF5_ZLIB is built")
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2014-03-12 05:14:57 +08:00
|
|
|
message (FATAL_ERROR " ZLib is Required for ZLib support in HDF5")
|
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
|
2014-03-12 05:14:57 +08:00
|
|
|
set (H5_HAVE_FILTER_DEFLATE 1)
|
|
|
|
set (H5_HAVE_ZLIB_H 1)
|
|
|
|
set (H5_HAVE_LIBZ 1)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2014-03-12 05:14:57 +08:00
|
|
|
if (H5_HAVE_FILTER_DEFLATE)
|
|
|
|
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2017-11-16 07:14:35 +08:00
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY})
|
2013-08-20 05:49:44 +08:00
|
|
|
INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter HDF5_ZLIB is ON")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2013-08-20 05:49:44 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Option for SzLib support
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-03-12 05:14:57 +08:00
|
|
|
option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF)
|
|
|
|
if (HDF5_ENABLE_SZIP_SUPPORT)
|
|
|
|
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
|
|
|
|
if (NOT SZIP_USE_EXTERNAL)
|
2021-07-14 23:42:14 +08:00
|
|
|
set(SZIP_FOUND FALSE)
|
|
|
|
if (USE_LIBAEC)
|
|
|
|
set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC})
|
|
|
|
find_package (libaec 1.0.5 CONFIG)
|
2015-03-26 06:08:46 +08:00
|
|
|
if (SZIP_FOUND)
|
2017-11-16 07:14:35 +08:00
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2021-07-14 23:42:14 +08:00
|
|
|
|
|
|
|
if (NOT SZIP_FOUND)
|
|
|
|
find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
|
|
|
|
if (NOT SZIP_FOUND)
|
|
|
|
find_package (SZIP) # Legacy find
|
|
|
|
if (SZIP_FOUND)
|
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2014-03-12 05:14:57 +08:00
|
|
|
if (SZIP_FOUND)
|
|
|
|
set (H5_HAVE_FILTER_SZIP 1)
|
|
|
|
set (H5_HAVE_SZLIB_H 1)
|
|
|
|
set (H5_HAVE_LIBSZ 1)
|
|
|
|
set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
|
2015-08-05 23:56:58 +08:00
|
|
|
set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR})
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2017-09-14 03:57:55 +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})
|
2014-03-12 05:14:57 +08:00
|
|
|
set (H5_HAVE_FILTER_SZIP 1)
|
|
|
|
set (H5_HAVE_SZLIB_H 1)
|
|
|
|
set (H5_HAVE_LIBSZ 1)
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter SZIP is built")
|
2020-04-23 00:48:45 +08:00
|
|
|
if (USE_LIBAEC)
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "... with library AEC")
|
2022-02-18 00:05:08 +08:00
|
|
|
set (SZIP_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME})
|
2020-05-08 21:58:22 +08:00
|
|
|
else ()
|
2022-02-18 00:05:08 +08:00
|
|
|
set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME})
|
2020-04-23 00:48:45 +08:00
|
|
|
endif ()
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2014-03-12 05:14:57 +08:00
|
|
|
message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2017-11-16 07:14:35 +08:00
|
|
|
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY})
|
2014-05-13 02:14:46 +08:00
|
|
|
INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
|
2022-09-03 08:31:29 +08:00
|
|
|
message (VERBOSE "Filter SZIP is ON")
|
2014-03-12 05:14:57 +08:00
|
|
|
if (H5_HAVE_FILTER_SZIP)
|
|
|
|
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2014-03-12 05:14:57 +08:00
|
|
|
if (HDF5_ENABLE_SZIP_ENCODING)
|
|
|
|
set (H5_HAVE_SZIP_ENCODER 1)
|
|
|
|
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} ENCODE")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
|
|
|
endif ()
|