Skip to content

Commit

Permalink
Fix the rpath with option - plugins fail without
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF committed Feb 6, 2025
1 parent 354994a commit 618fe55
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"ZLIB_USE_LOCALCONTENT": "OFF",
"LIBAEC_USE_LOCALCONTENT": "OFF",
"HDF5_USE_ZLIB_STATIC": "ON",
"HDF5_USE_LIBAEC_STATIC": "ON"
"HDF5_USE_LIBAEC_STATIC": "ON",
"HDF5_ENABLE_SZIP_SUPPORT": "ON",
"HDF5_ENABLE_ZLIB_SUPPORT": "ON"
}
},
{
Expand Down Expand Up @@ -120,6 +122,7 @@
"HDF5_BUILD_GENERATORS": "ON",
"HDF5_ENABLE_ALL_WARNINGS": "ON",
"HDF5_MINGW_STATIC_GCC_LIBS": "ON",
"HDF5_SET_DEFAULT_RPATH": "ON",
"HDF_TEST_EXPRESS": "2"
}
},
Expand Down
23 changes: 23 additions & 0 deletions config/cmake/HDF5Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage)
endif ()
endif ()
HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype})

#-- Apple Specific install_name for libraries
if (APPLE)
option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
if (HDF5_BUILD_WITH_INSTALL_NAME)
set_target_properties (${libtarget} PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME}
)
endif ()
if (HDF5_BUILD_FRAMEWORKS)
if (${libtype} MATCHES "SHARED")
# adapt target to build frameworks instead of dylibs
set_target_properties(${libtarget} PROPERTIES
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
FRAMEWORK TRUE
FRAMEWORK_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}
MACOSX_FRAMEWORK_IDENTIFIER org.hdfgroup.${libtarget}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${HDF5_PACKAGE_VERSION_MAJOR}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${HDF5_PACKAGE_VERSION_MAJOR})
endif ()
endif ()
endif ()
endmacro ()

# Initialize the list of VFDs to be used for testing and create a test folder for each VFD
Expand Down
15 changes: 15 additions & 0 deletions config/cmake/HDFMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,21 @@ macro (HDF_DIR_PATHS package_prefix)
endif ()
message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}")

# Define the needed INSTALL_RPATH for HDF Standard binary packages
option (HDF5_SET_DEFAULT_RPATH "Set the default RPATH for the common installation" OFF)
if (HDF5_SET_DEFAULT_RPATH)
if (APPLE)
set (CMAKE_INSTALL_RPATH
"@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}"
"@executable_path/"
"@loader_path/../${${package_prefix}_INSTALL_LIB_DIR}"
"@loader_path/"
)
else ()
set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}:\$ORIGIN/")
endif ()
endif ()

if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
endif ()
Expand Down
2 changes: 2 additions & 0 deletions config/cmake/cacheinit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++"
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 (HDF5_SET_DEFAULT_RPATH ON "Set the default RPATH for the common installation" FORCE)

########################
# compression options
########################
Expand Down
2 changes: 2 additions & 0 deletions release_docs/INSTALL_CMake.txt
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ These five steps are described in detail below.
set (HDF5_BUILD_JAVA ON CACHE BOOL "Build JAVA support" FORCE)
set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE)
set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
set (HDF5_SET_DEFAULT_RPATH ON "Set the default RPATH for the common installation" FORCE)
########################
# compression options
########################
Expand Down Expand Up @@ -755,6 +756,7 @@ BUILD_STATIC_EXECS "Build Static Executables" OFF
BUILD_TESTING "Build HDF5 Unit Testing" ON
if (WINDOWS)
HDF5_DISABLE_PDB_FILES "Do not install PDB files" OFF
HDF5_SET_DEFAULT_RPATH "Set the default RPATH for the common installation" OFF

---------------- HDF5 Build Options ----------------------------------------
HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF
Expand Down
14 changes: 14 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,20 @@ Bug Fixes since HDF5-2.0.0 release

Configuration
-------------
- The RPATH settings were restored under an HDF5 option

The RPATH settings were removed by a pull-request #5271, but the settings are needed
under certain conditions. The settings have been restored under the HDF5_ENABLE_RPATH option.
The option is OFF by default. Typical builds using either the cacheinit.cmake file or presets
will enable the RPATH settings.

- When using a system installed zlib library, the shared library is expected to
be found in the system library path.

Setting the HDF5_MODULE_MODE_ZLIB option to OFF, the system installed zlib,
or an alternate installed zlib library, is expected to have a correct
zlib-config.cmake file.

- Use pre-installed libaec compression library

The CMake logic for finding the libaec compression library has been
Expand Down

0 comments on commit 618fe55

Please sign in to comment.