Skip to content

Commit

Permalink
COMP: Fix HDF5 library update
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blowekamp committed Nov 8, 2024
1 parent a4e5853 commit e5217e3
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 39 deletions.
6 changes: 0 additions & 6 deletions Modules/ThirdParty/HDF5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
24 changes: 22 additions & 2 deletions Modules/ThirdParty/HDF5/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions Modules/ThirdParty/HDF5/src/itkhdf5/CMakeInstallation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions Modules/ThirdParty/HDF5/src/itkhdf5/CMakePlugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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})
Expand Down
4 changes: 0 additions & 4 deletions Modules/ThirdParty/HDF5/src/itkhdf5/UserMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
2 changes: 0 additions & 2 deletions Modules/ThirdParty/HDF5/src/itkhdf5/c++/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#[[ ITK --start
cmake_minimum_required (VERSION 3.12)
# ITK --stop]]
project (HDF5_CPP_SRC CXX)

#-----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
# If you do not have access to either file, you may request a copy from
# [email protected].
#
#[[ ITK --start
cmake_minimum_required (VERSION 3.12)
# ITK --stop ]]
########################################################
# For any comments please contact [email protected]
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
# If you do not have access to either file, you may request a copy from
# [email protected].
#
#[[ 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
# If you do not have access to either file, you may request a copy from
# [email protected].
#
#[[ ITK --start
cmake_minimum_required (VERSION 3.12)
# ITK --stop ]]
########################################################
# This dashboard is maintained by The HDF Group
# For any comments please contact [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Modules/ThirdParty/HDF5/src/itkhdf5/hl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#[[ ITK --start
cmake_minimum_required (VERSION 3.12)
# ITK --stop ]]
project (HDF5_HL_SRC C)

#-----------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}" )

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e5217e3

Please sign in to comment.