Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct CMake option defaults - deprecate szip for libaec #2778

Merged
merged 3 commits into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 8 additions & 26 deletions CMakeFilters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# If you do not have access to either file, you may request a copy from
# [email protected].
#
option (USE_LIBAEC "Use AEC library as SZip Filter" OFF)
option (USE_LIBAEC_STATIC "Use static AEC library " OFF)
option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0)
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0)
Expand All @@ -29,8 +28,6 @@ endif ()

option (BUILD_SZIP_WITH_FETCHCONTENT "Use FetchContent to use original source files" OFF)
if (BUILD_SZIP_WITH_FETCHCONTENT)
# Only libaec library is usable
set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE)
set (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1)
if (NOT LIBAEC_USE_LOCALCONTENT)
set (SZIP_URL ${LIBAEC_TGZ_ORIGPATH}/${LIBAEC_TGZ_ORIGNAME})
Expand Down Expand Up @@ -66,10 +63,7 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT
message (VERBOSE "Filter ZLIB file ${ZLIB_URL} not found")
endif ()
if (NOT BUILD_SZIP_WITH_FETCHCONTENT)
set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME})
if (USE_LIBAEC)
set (SZIP_URL ${TGZPATH}/${SZAEC_TGZ_NAME})
endif ()
set (SZIP_URL ${TGZPATH}/${SZAEC_TGZ_NAME})
endif ()
if (NOT EXISTS "${SZIP_URL}")
set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
Expand Down Expand Up @@ -142,15 +136,13 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
if (NOT SZIP_USE_EXTERNAL)
set(SZIP_FOUND FALSE)
if (USE_LIBAEC)
set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC})
find_package (libaec 1.0.5 CONFIG)
if (SZIP_FOUND)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
endif ()
set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC})
find_package (libaec 1.0.5 CONFIG)
if (SZIP_FOUND)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
endif ()
if (NOT SZIP_FOUND)
find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
if (NOT SZIP_FOUND)
find_package (SZIP) # Legacy find
endif ()
Expand All @@ -171,25 +163,15 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
set (H5_HAVE_SZLIB_H 1)
set (H5_HAVE_LIBSZ 1)
message (VERBOSE "SZIP is built from fetch content")
if (USE_LIBAEC)
message (VERBOSE "... with library AEC")
set (SZIP_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME})
else ()
set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME})
endif ()
message (VERBOSE "... with library AEC")
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY})
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING})
set (H5_HAVE_FILTER_SZIP 1)
set (H5_HAVE_SZLIB_H 1)
set (H5_HAVE_LIBSZ 1)
message (VERBOSE "Filter SZIP is built")
if (USE_LIBAEC)
message (VERBOSE "... with library AEC")
set (SZIP_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME})
else ()
set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME})
endif ()
message (VERBOSE "... with library AEC")
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY})
else ()
message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5")
Expand Down
6 changes: 3 additions & 3 deletions CMakeInstallation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ install (
option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF)
if (HDF5_PACK_EXAMPLES)
configure_file (
${HDF_RESOURCES_DIR}/HDF5_Examples.cmake.in
${HDF_RESOURCES_DIR}/examples/HDF5_Examples.cmake.in
${HDF5_BINARY_DIR}/HDF5_Examples.cmake @ONLY
)
install (
Expand All @@ -169,13 +169,13 @@ if (HDF5_PACK_EXAMPLES)
)
install (
FILES
${HDF_RESOURCES_DIR}/CTestScript.cmake
${HDF_RESOURCES_DIR}/examples/CTestScript.cmake
DESTINATION ${HDF5_INSTALL_DATA_DIR}
COMPONENT hdfdocuments
)
install (
FILES
${HDF_RESOURCES_DIR}/HDF5_Examples_options.cmake
${HDF_RESOURCES_DIR}/examples/HDF5_Examples_options.cmake
DESTINATION ${HDF5_INSTALL_DATA_DIR}
COMPONENT hdfdocuments
)
Expand Down
42 changes: 12 additions & 30 deletions config/cmake/HDFLibMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ macro (ORIGINAL_SZIP_LIBRARY compress_type encoding)
add_subdirectory(${szip_SOURCE_DIR} ${szip_BINARY_DIR})
endif()

set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE)
add_library (${HDF_PACKAGE_NAMESPACE}szaec-static ALIAS szaec-static)
add_library (${HDF_PACKAGE_NAMESPACE}aec-static ALIAS aec-static)
set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static")
Expand Down Expand Up @@ -127,47 +126,30 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
endif ()
externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR)
#
##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
##include (${BINARY_DIR}/${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
# Create imported target szip-static
if (USE_LIBAEC)
add_library(${HDF_PACKAGE_NAMESPACE}szaec-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szaec-static "szaec" STATIC "")
add_dependencies (${HDF_PACKAGE_NAMESPACE}szaec-static SZIP)
add_library(${HDF_PACKAGE_NAMESPACE}aec-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}aec-static "aec" STATIC "")
add_dependencies (${HDF_PACKAGE_NAMESPACE}aec-static SZIP)
set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static")
else ()
add_library(${HDF_PACKAGE_NAMESPACE}szip-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-static "szip" STATIC "")
add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-static SZIP)
set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szip-static")
endif ()
add_library(${HDF_PACKAGE_NAMESPACE}szaec-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szaec-static "szaec" STATIC "")
add_dependencies (${HDF_PACKAGE_NAMESPACE}szaec-static SZIP)
add_library(${HDF_PACKAGE_NAMESPACE}aec-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}aec-static "aec" STATIC "")
add_dependencies (${HDF_PACKAGE_NAMESPACE}aec-static SZIP)
set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static")
set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY})

set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}")
if (USE_LIBAEC)
set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/include")
else ()
set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src")
endif ()
set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/include")
set (SZIP_FOUND 1)
set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR})
endmacro ()

#-------------------------------------------------------------------------------
macro (PACKAGE_SZIP_LIBRARY compress_type)
set (SZIP_HDR "SZconfig")
if (USE_LIBAEC)
set (SZIP_HDR "aec_config")
else ()
set (SZIP_HDR "libaec_Export")
endif ()
add_custom_target (SZIP-GenHeader-Copy ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/${SZIP_HDR}.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/${SZIP_HDR}.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/aec_config.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/aec_config.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_HDR}.h)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/aec_config.h)
if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ")
add_dependencies (SZIP-GenHeader-Copy SZIP)
endif ()
Expand Down
8 changes: 3 additions & 5 deletions config/cmake/cacheinit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build C++ support" FORCE)

set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)

set (HDF5_BUILD_JAVA ON CACHE BOOL "Build JAVA support" FORCE)

set (HDF5_INSTALL_MOD_FORTRAN "NO" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" FORCE)
set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC)

Expand All @@ -44,21 +46,17 @@ set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE)

set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE)

set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ)


set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use HDF5_ZLib from compressed file" FORCE)
set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.2.13" CACHE STRING "Use ZLIB from original location" FORCE)
set (ZLIB_TGZ_ORIGNAME "zlib-1.2.13.tar.gz" CACHE STRING "Use ZLIB from original compressed file" FORCE)
set (ZLIB_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for ZLIB FetchContent" FORCE)

set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE)
set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE)
set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
set (SZAEC_TGZ_NAME "LIBAEC.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE)
set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE)
set (LIBAEC_TGZ_ORIGPATH "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6/libaec-1.0.6.tar.gz" CACHE STRING "Use LIBAEC from original location" FORCE)
set (LIBAEC_TGZ_ORIGNAME "libaec-v1.0.6.tar.gz" CACHE STRING "Use LIBAEC from original compressed file" FORCE)
set (LIBAEC_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,30 @@ if (NOT SITE_OS_NAME)
message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n")

set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}")
if (SITE_BUILDNAME_SUFFIX)
set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}")
endif ()
set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}")
else ()
## machine name provided
## --------------------------
if (CMAKE_HOST_UNIX)
set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}")
set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}")
else ()
set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}")
endif ()
if (SITE_BUILDNAME_SUFFIX)
set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}")
set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}")
endif ()
set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
endif ()
if (SITE_BUILDNAME_SUFFIX)
set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}")
endif ()
set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")

# Launchers work only with Makefile and Ninja generators.
if(NOT "${CTEST_CMAKE_GENERATOR}" MATCHES "Make|Ninja" OR LOCAL_SKIP_TEST)
set(CTEST_USE_LAUNCHERS 0)
set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 0)
set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=OFF")
else()
set(CTEST_USE_LAUNCHERS 1)
set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1)
set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON")
endif()

#-----------------------------------------------------------------------------
# MacOS machines need special options
Expand Down
2 changes: 1 addition & 1 deletion config/cmake/hdf5-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ if (NOT TARGET "@HDF5_PACKAGE@")
include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@@[email protected])
endif ()
if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@@[email protected])
include (@PACKAGE_SHARE_INSTALL_DIR@/@LIBAEC_PACKAGE_NAME@@[email protected])
endif ()
include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@[email protected])
endif ()
Expand Down
20 changes: 9 additions & 11 deletions config/cmake/mccacheinit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,20 @@

set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE)

set (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE)

set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)

set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace" FORCE)

set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE)

set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE)

set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)

set (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE)

set (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE)

set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE)

set (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)

set (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
Expand All @@ -45,19 +43,19 @@ set (HDF5_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker

set (HDF5_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE)

set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE)

set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE)

set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ)

set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)

set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE)
set (SZAEC_TGZ_NAME "LIBAEC.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE)
set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE)

set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Debug" FORCE)

set (CTEST_CONFIGURATION_TYPE "Debug" CACHE STRING "Build Debug" FORCE)

set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE)
set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE)
Loading