From 07a52ecb2ffa1d8d32f06db23470833899db3deb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 9 Jul 2020 13:03:58 -0500 Subject: HDFFV-11116 Add option for install location of Fortran MOD files --- CMakeLists.txt | 11 +++++++++++ config/cmake/cacheinit.cmake | 3 +++ fortran/src/CMakeLists.txt | 20 ++++++++++++++++++++ hl/fortran/src/CMakeLists.txt | 21 ++++++++++++++++++++- release_docs/INSTALL_CMake.txt | 8 ++++++++ release_docs/RELEASE.txt | 31 ++++++++++++++++++++++++++++--- 6 files changed, 90 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b559446..ac291fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -995,6 +995,17 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for endif () endif () + #option (HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "NO") + set (HDF5_INSTALL_MOD_FORTRAN "SHARED" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)") + set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC) + if (NOT HDF5_INSTALL_MOD_FORTRAN MATCHES "NO") + if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) + set (HDF5_INSTALL_MOD_FORTRAN "STATIC") + elseif (BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) + set (HDF5_INSTALL_MOD_FORTRAN "SHARED") + endif () + endif () + add_subdirectory (fortran) if (HDF5_BUILD_HL_LIB) if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 4846997..64e8dcc 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -23,6 +23,9 @@ set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN 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) + set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE) set (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index bf2fd84..b1add54 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -412,6 +412,16 @@ if (NOT ONLY_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "STATIC") + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () if (BUILD_SHARED_LIBS) @@ -445,6 +455,16 @@ if (BUILD_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "SHARED") + install ( + FILES + ${modsh_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () #----------------------------------------------------------------------------- diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 71b9380..d682d5f 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -234,7 +234,6 @@ if (NOT ONLY_SHARED_LIBS) ${MOD_BUILD_DIR}/h5lt_const.mod ${MOD_BUILD_DIR}/h5im.mod ) - install ( FILES ${mod_files} @@ -243,6 +242,16 @@ if (NOT ONLY_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "STATIC") + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () if (BUILD_SHARED_LIBS) set (modsh_files @@ -261,6 +270,16 @@ if (BUILD_SHARED_LIBS) COMPONENT fortheaders ) + if (HDF5_INSTALL_MOD_FORTRAN MATCHES "SHARED") + install ( + FILES + ${modsh_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif () endif () #----------------------------------------------------------------------------- diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 5442f6c..89cd9f8 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -624,6 +624,7 @@ The config/cmake/cacheinit.cmake file can override the following values. ---------------- General Build Options --------------------- BUILD_SHARED_LIBS "Build Shared Libraries" ON +BUILD_STATIC_LIBS "Build Static Libraries" ON BUILD_STATIC_EXECS "Build Static Executables" OFF BUILD_TESTING "Build HDF5 Unit Testing" ON @@ -636,6 +637,7 @@ HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON HDF5_BUILD_TOOLS "Build HDF5 Tools" ON ---------------- HDF5 Advanced Options --------------------- +ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "" HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF @@ -676,6 +678,12 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF if (HDF5_TEST_VFD) HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON +if (HDF5_BUILD_FORTRAN) + HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "XX" + if (BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED + if (BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED + if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is STATIC + if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED ---------------- External Library Options --------------------- HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO" diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 665a156..56e5569 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,31 @@ New Features Configuration: ------------- + - CMake option to link the generated Fortran MOD files into the include + directory. + + The Fortran generation of MOD files by a Fortran compile can produce + different binary files between SHARED and STATIC compiles with different + compilers and/or different platforms. Note that it has been found that + different versions of Fortran compilers will produce incompatible MOD + files. Currently, CMake will locate these MOD files in subfolders of + the include directory and add that path to the Fortran library target + in the CMake config file, which can be used by the CMake find library + process. For other build systems using the binary from a CMake install, + a new CMake configuration can be used to copy the pre-chosen version + of the Fortran MOD files into the install include directory. + + The default will depend on the configuration of + BUILD_STATIC_LIBS and BUILD_SHARED_LIBS: + YES YES Default to SHARED + YES NO Default to STATIC + NO YES Default to SHARED + NO NO Default to SHARED + The defaults can be overriden by setting the config option + HDF5_INSTALL_MOD_FORTRAN to one of NO, SHARED, or STATIC + + (ADB - 2020/07/9, HDFFV-11116) + - CMake option to use AEC (open source SZip) library instead of SZip The open source AEC library is a replacement library for SZip. In @@ -1015,9 +1040,9 @@ Bug Fixes since HDF5-1.10.3 release ------- - Stopped java/test/junit.sh.in installing libs for testing under ${prefix} - Lib files needed are now copied to a subdirectory in the java/test - directory, and on Macs the loader path for libhdf5.xxxs.so is changed - in the temporary copy of libhdf5_java.dylib. + Lib files needed are now copied to a subdirectory in the java/test + directory, and on Macs the loader path for libhdf5.xxxs.so is changed + in the temporary copy of libhdf5_java.dylib. (LRK, 2020/7/2, HDFFV-11063) -- cgit v0.12