From e5217e314b9eea4e1442cdd4994be26a4456a4fb Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Nov 2024 15:47:14 -0500 Subject: [PATCH] COMP: Fix HDF5 library update Remove code modifications in library infavor of setting internal cache variables at top level CMakeLists.txt file. Update to set HDF5 new BUILD_STATIC_LIBS variable.. Update to set COMP_LIBS for ITK's ZLIB. Remove local modified cmake policiy changes integrated into upstream. --- Modules/ThirdParty/HDF5/CMakeLists.txt | 6 ----- Modules/ThirdParty/HDF5/src/CMakeLists.txt | 24 +++++++++++++++++-- .../HDF5/src/itkhdf5/CMakeInstallation.cmake | 6 ----- .../HDF5/src/itkhdf5/CMakePlugins.cmake | 10 +------- .../HDF5/src/itkhdf5/UserMacros.cmake | 4 ---- .../HDF5/src/itkhdf5/c++/src/CMakeLists.txt | 2 -- .../config/cmake/examples/CTestScript.cmake | 2 -- .../cmake/examples/HDF5_Examples.cmake.in | 2 -- .../config/cmake/scripts/CTestScript.cmake | 2 -- .../config/cmake/scripts/HDF5config.cmake | 2 -- .../HDF5/src/itkhdf5/hl/src/CMakeLists.txt | 2 -- .../HDF5/src/itkhdf5/src/CMakeLists.txt | 12 ++++++++++ 12 files changed, 35 insertions(+), 39 deletions(-) diff --git a/Modules/ThirdParty/HDF5/CMakeLists.txt b/Modules/ThirdParty/HDF5/CMakeLists.txt index dcaa2fa646c..91d65a4c60c 100644 --- a/Modules/ThirdParty/HDF5/CMakeLists.txt +++ b/Modules/ThirdParty/HDF5/CMakeLists.txt @@ -7,12 +7,6 @@ set(ITKHDF5_THIRD_PARTY 1) # modified before reaching this point) set(BUILD_SHARED_LIBS ${ITK_BUILD_SHARED_LIBS}) -if (BUILD_SHARED_LIBS) - add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB=1) - set(ONLY_SHARED_LIBS ON CACHE INTERNAL "Only build shared") -else() - set(ONLY_SHARED_LIBS OFF CACHE INTERNAL "Only build static") -endif() if(CMAKE_LINKER MATCHES "link.exe$") # Suppress undefined public symbols warning set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221") diff --git a/Modules/ThirdParty/HDF5/src/CMakeLists.txt b/Modules/ThirdParty/HDF5/src/CMakeLists.txt index d8096039af8..f789972332c 100644 --- a/Modules/ThirdParty/HDF5/src/CMakeLists.txt +++ b/Modules/ThirdParty/HDF5/src/CMakeLists.txt @@ -5,7 +5,6 @@ set(HDF5_EXTERNALLY_CONFIGURED ON) # can not be skipped for installation. Use the install COMPONENTS # features instead. set(HDF5_INSTALL_NO_DEVELOPMENT FALSE) -set(HDF5_EXTERNAL_LIB_PREFIX "itk") set(HDF5_EXPORTED_TARGETS ${ITKHDF5-targets}) set(HDF5_INSTALL_LIB_DIR ${ITKHDF5_INSTALL_LIBRARY_DIR}) set(HDF5_INSTALL_BIN_DIR ${ITKHDF5_INSTALL_RUNTIME_DIR}) @@ -24,7 +23,7 @@ set(HDF5_ENABLE_HSIZET ON CACHE INTERNAL "Enable datasets larger than memory") set(HDF5_ENABLE_LARGE_FILE ON CACHE INTERNAL "Enable support for large (64-bit) files on Linux.") set(HDF5_ENABLE_PARALLEL OFF CACHE INTERNAL "Enable parallel build (requires MPI)") set(HDF5_ENABLE_SZIP_SUPPORT OFF CACHE INTERNAL "Use SZip Filter") -set(HDF5_ENABLE_THREADSAFE ON CACHE INTERNAL "Enable Threadsafety") +set(HDF5_ENABLE_THREADSAFE OFF CACHE INTERNAL "Enable Threadsafety") set(HDF5_ENABLE_TRACE OFF CACHE INTERNAL "Enable API tracing capability") set(HDF5_ENABLE_USING_MEMCHECKER OFF CACHE INTERNAL "Indicate that a memory checker is used") set(HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE INTERNAL "Enable HDF5 Zlib Filters") @@ -64,6 +63,23 @@ set(HDF_TEST_EXPRESS OFF CACHE INTERNAL "Control testing framework (0-3)") set(BUILD_STATIC_EXECS OFF CACHE INTERNAL "Build Static Executables") set(BUILD_USER_DEFINED_LIBS OFF CACHE INTERNAL "Build user defined libs") +set (HDF5_DIMENSION_SCALES_NEW_REF OFF CACHE INTERNAL "Use new-style references with dimension scale APIs" ) +set (HDF5_EXTERNAL_LIB_PREFIX "itk" CACHE INTERNAL "Use prefix for custom library naming.") +set (HDF5_LIB_INFIX "" CACHE INTERNAL "Use infix for custom library naming.") +set (HDF5_USE_GNU_DIRS OFF CACHE INTERNAL "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings") +set (HDF5_TEST_SERIAL OFF CACHE INTERNAL "Execute non-parallel tests" ) + +set( HDF5_BUILD_DOC OFF CACHE INTERNAL "Build documentation") +set( HDF5_ENABLE_MAP_API OFF CACHE INTERNAL "Build the map API") +set( HDF5_ENABLE_WARNINGS_AS_ERRORS OFF CACHE INTERNAL "Interpret some warnings as errors") +#set( HDF5_MINGW_STATIC_GCC_LIBS OFF CACHE INTERNAL "") +set( HDF5_MSVC_NAMING_CONVENTION OFF CACHE INTERNAL "Use MSVC Naming conventions for Shared Libraries") +set (HDF5_ENABLE_PLUGIN_SUPPORT OFF CACHE INTERNAL "Enable PLUGIN Filters") + +if (NOT BUILD_SHARED_LIBS) + set (BUILD_STATIC_LIBS ON CACHE INTERNAL "Build Static Libraries") +endif() + # Setup all necessary overrides for zlib so that HDF5 uses our # internally compiled zlib rather than any other version if(HDF5_ENABLE_Z_LIB_SUPPORT) @@ -73,8 +89,12 @@ if(HDF5_ENABLE_Z_LIB_SUPPORT) if(BUILD_SHARED_LIBS) set(ZLIB_SHARED_LIBRARY ${ITKZLIB_LIBRARIES}) endif() + set(ZLIB_FOUND true) set(ZLIB_STATIC_LIBRARY ${ITKZLIB_LIBRARIES}) + set(HDF5_LIB_DEPENDENCIES ${ITKZLIB_LIBRARIES}) set(H5_ZLIB_HEADER "itk_zlib.h") + + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) endif() add_subdirectory(itkhdf5) diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/CMakeInstallation.cmake b/Modules/ThirdParty/HDF5/src/itkhdf5/CMakeInstallation.cmake index 8a51da9cc45..f30b9bc3864 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/CMakeInstallation.cmake +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/CMakeInstallation.cmake @@ -141,11 +141,7 @@ install ( #----------------------------------------------------------------------------- # Configure the HDF5_Examples.cmake file and the examples #----------------------------------------------------------------------------- -if (FALSE) # XXX(kitware): Hardcode settings. option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) -else () -set(HDF5_PACK_EXAMPLES OFF) -endif () if (HDF5_PACK_EXAMPLES) configure_file ( ${HDF_RESOURCES_DIR}/examples/HDF5_Examples.cmake.in @@ -231,9 +227,7 @@ endif () #----------------------------------------------------------------------------- # Configure the README.md file for the binary package #----------------------------------------------------------------------------- -if (FALSE) # XXX(kitware): skip unnecessary installation rules. HDF_README_PROPERTIES(HDF5_BUILD_FORTRAN) -endif () #----------------------------------------------------------------------------- # Configure the COPYING.txt file for the windows binary package diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/CMakePlugins.cmake b/Modules/ThirdParty/HDF5/src/itkhdf5/CMakePlugins.cmake index 24f8bf153ac..c6ff4f6356e 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/CMakePlugins.cmake +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/CMakePlugins.cmake @@ -11,13 +11,9 @@ # include (ExternalProject) -if (FALSE) # XXX(kitware): Hardcode settings. -#option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO") +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) -else () -set(HDF5_ALLOW_EXTERNAL_SUPPORT "NO") -endif () if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") option (PLUGIN_USE_EXTERNAL "Use External Library Building for filter PLUGIN" 1) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") @@ -40,11 +36,7 @@ endif () #----------------------------------------------------------------------------- # Option for PLUGIN support #----------------------------------------------------------------------------- -if (FALSE) # XXX(kitware): Hardcode settings. option (HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF) -else () -set(HDF5_ENABLE_PLUGIN_SUPPORT OFF) -endif () if (HDF5_ENABLE_PLUGIN_SUPPORT) if (NOT PLUGIN_USE_EXTERNAL) find_package (PLUGIN NAMES ${PLUGIN_PACKAGE_NAME}${HDF_PACKAGE_EXT}) diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/UserMacros.cmake b/Modules/ThirdParty/HDF5/src/itkhdf5/UserMacros.cmake index 0291dbf56f3..c9162236a8a 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/UserMacros.cmake +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/UserMacros.cmake @@ -23,11 +23,7 @@ macro (MACRO_USER_DEFINED_LIBS) endmacro () #------------------------------------------------------------------------------- -if (FALSE) # XXX(kitware): hardcode settings option (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF) -else () -set(BUILD_USER_DEFINED_LIBS OFF) -endif () if (BUILD_USER_DEFINED_LIBS) MACRO_USER_DEFINED_LIBS () endif () diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/c++/src/CMakeLists.txt b/Modules/ThirdParty/HDF5/src/itkhdf5/c++/src/CMakeLists.txt index a38ffabcd8a..f8ac7296097 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/c++/src/CMakeLists.txt +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/c++/src/CMakeLists.txt @@ -1,6 +1,4 @@ -#[[ ITK --start cmake_minimum_required (VERSION 3.12) -# ITK --stop]] project (HDF5_CPP_SRC CXX) #----------------------------------------------------------------------------- diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/CTestScript.cmake b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/CTestScript.cmake index 9e5810da54b..76bce5680d5 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/CTestScript.cmake +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/CTestScript.cmake @@ -9,9 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -#[[ ITK --start cmake_minimum_required (VERSION 3.12) -# ITK --stop ]] ######################################################## # For any comments please contact cdashhelp@hdfgroup.org # diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/HDF5_Examples.cmake.in b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/HDF5_Examples.cmake.in index 724a4ec8097..3689059a0e4 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/HDF5_Examples.cmake.in +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/examples/HDF5_Examples.cmake.in @@ -9,9 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -#[[ ITK --start cmake_minimum_required (VERSION 3.12) -# ITK --stop ]] ############################################################################################################### # This script will build and run the examples from a folder # Execute from a command line: diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/CTestScript.cmake b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/CTestScript.cmake index 13308207e91..4bd31acbf71 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/CTestScript.cmake +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/CTestScript.cmake @@ -9,9 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -#[[ ITK --start cmake_minimum_required (VERSION 3.12) -# ITK --stop ]] ######################################################## # This dashboard is maintained by The HDF Group # For any comments please contact cdashhelp@hdfgroup.org diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/HDF5config.cmake b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/HDF5config.cmake index 53e7441d032..e14e4c066d0 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/HDF5config.cmake +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/scripts/HDF5config.cmake @@ -15,9 +15,7 @@ ### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS202264 -C Release -VV -O hdf5.log ### ############################################################################################# -#[[ ITK --start cmake_minimum_required (VERSION 3.12) -# ITK --stop ]] ############################################################################ # Usage: # ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/hl/src/CMakeLists.txt b/Modules/ThirdParty/HDF5/src/itkhdf5/hl/src/CMakeLists.txt index 72a203448d7..fafa0ef071a 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/hl/src/CMakeLists.txt +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/hl/src/CMakeLists.txt @@ -1,6 +1,4 @@ -#[[ ITK --start cmake_minimum_required (VERSION 3.12) -# ITK --stop ]] project (HDF5_HL_SRC C) #----------------------------------------------------------------------------- diff --git a/Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt b/Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt index db356e63ae7..bd37986f76f 100644 --- a/Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt +++ b/Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt @@ -1,5 +1,11 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_SRC C) +# ITK --start +set(MANGLE_PREFIX itk) +configure_file(${HDF5_SRC_DIR}/itk_hdf5_mangle.h.in + ${HDF5_SRC_BINARY_DIR}/itk_hdf5_mangle.h + @ONLY) +# ITK --stop #----------------------------------------------------------------------------- # List Source Files @@ -20,6 +26,9 @@ set (H5_HDRS ${HDF5_SRC_DIR}/H5public.h #${HDF5_SRC_DIR}/H5version.h #${HDF5_SRC_DIR}/H5overflow.h +# ITK --start + ${HDF5_SRC_BINARY_DIR}/itk_hdf5_mangle.h +# ITK --stop ) IDE_GENERATED_PROPERTIES ("H5" "${H5_HDRS}" "${H5_SOURCES}" ) @@ -807,6 +816,9 @@ set (H5_PUBLIC_HEADERS ${H5T_HDRS} ${H5VL_HDRS} ${H5Z_HDRS} +# ITK --start + ${HDF5_SRC_BINARY_DIR}/itk_hdf5_mangle.h +# ITK --stop ) set (H5_PRIVATE_HEADERS