From 4155e595e2ab16d81de79ed19d7de4fab5eb3302 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:47:47 -0500 Subject: Hdf5 1 10 merge of CMake changes (#605) * HDFFV-10865 - merge from dev, HDFArray perf fix. * Remove duplicate setting * Whitespace changes after clang format * Undo version 11 clang format changes * Merge CMake changes from develop * test testing script merge from develop * Update supported platforms * PR#3 merge from develop * Merge gcc 10 diagnostics option from develop * Merge #318 OSX changes from develop * Merge small changes from develop * Minor non-space formatting changes * #386 copyright corrections for java folder * Merges from develop #358 patches from vtk #361 fix header guard spelling * Merge updates #358 patches from vtk #361 fix header guard spelling * format fix * Fix missing underscore and make H5public.h closer to dev * Merges from develop #340 clang -Wformat-security warnings #360 Fixed uninitialized warnings header guard underscore cleanup JNI cleanup * format alignment * Add missing test ref file * Merge #380 from develop * Finish java merges from develop * Fix java issues with tests and javadoc * Correct use of attribute access plist * Remove debug code * Remove unused variable * Change file access to read only for java tests * Split clang format operations. * More javadoc comments * Remove pre-split setting * format source * Change windows TS to use older VS. * Mostly all javadoc fixes, one argument rename. * synch file * Merge of long double fix and compiler flags * HDFFV-11229 merge changes from develop * HDFFV-11229 correct test script * HDFFV-11229 update autotools test script for two ref files * HDFFV-11229 merge dev changes for long double display in tools * Committing clang-format changes * minor whitespace * remove unneeded macro * Committing clang-format changes * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument Update pkgconfig scripts for parallel builds. Fix install COPYING file reference. Remove unused round defines. Change CMake default setting of BUILD_CPP to off. * Fortran target depends * Remove incorrect source attribute * Revert define removal Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- CMakeInstallation.cmake | 3 +- CMakeLists.txt | 2 +- c++/src/CMakeLists.txt | 6 +- config/cmake/cacheinit.cmake | 2 + fortran/src/CMakeLists.txt | 78 ++++++++++++++--------- fortran/test/CMakeLists.txt | 14 ++--- hl/c++/src/CMakeLists.txt | 6 +- hl/fortran/src/CMakeLists.txt | 18 +++--- hl/src/CMakeLists.txt | 6 +- release_docs/RELEASE.txt | 21 +++++++ src/CMakeLists.txt | 142 ++++++++++++++++++++++++------------------ test/ShellTests.cmake | 4 ++ 12 files changed, 192 insertions(+), 110 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index b82b13d..65be971 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -201,7 +201,6 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) if (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs") set (release_files ${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_CMake.txt - ${HDF5_SOURCE_DIR}/release_docs/COPYING ${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt ) if (WIN32) @@ -259,9 +258,9 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") set (CPACK_PACKAGE_VERSION_PATCH "") + set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") if (EXISTS "${HDF5_SOURCE_DIR}/release_docs") set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") - set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") endif () set (CPACK_PACKAGE_RELOCATABLE TRUE) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1174f3..132c275 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1078,7 +1078,7 @@ endif () # Option to build HDF5 C++ Library #----------------------------------------------------------------------------- if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") - option (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" ON) + option (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF) if (HDF5_BUILD_CPP_LIB) # check for unsupported options if (HDF5_ENABLE_PARALLEL) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 8608c67..4b1a2d6 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -209,7 +209,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index fc85277..e423deb 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -21,6 +21,8 @@ set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE) +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_INSTALL_MOD_FORTRAN "NO" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" FORCE) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 459ac5a..17d0286c 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -73,38 +73,35 @@ add_executable (H5match_types ) target_include_directories (H5match_types PRIVATE "${HDF5_SRC_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 +add_custom_command (TARGET H5match_types POST_BUILD + BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} DEPENDS H5match_types ) if (NOT ONLY_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + add_custom_command (TARGET H5match_types POST_BUILD + BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + DEPENDS H5_buildiface H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) endif () if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 + add_custom_command (TARGET H5match_types POST_BUILD + BYPRODUCTS H5f90i_gen.h H5fortran_types.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared - DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h + DEPENDS H5_buildiface H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h PROPERTIES GENERATED TRUE) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 PROPERTIES GENERATED TRUE) @@ -134,16 +131,29 @@ set (f90CStub_C_SOURCES set_source_files_properties (${f90CStub_C_SOURCES} PROPERTIES LANGUAGE C) set (f90CStub_C_HDRS + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h + ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h +) + +set (f90CStub_CGEN_HDRS # generated files ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ) -set (f90CStub_C_SHHDRS +add_custom_target (H5gen_i ALL + DEPENDS H5match_types ${f90CStub_CGEN_HDRS} +) + +set (f90CStub_CGEN_SHHDRS # generated files ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ) +add_custom_target (H5gen_iSH ALL + DEPENDS H5match_types ${f90CStub_CGEN_SHHDRS} +) if (NOT ONLY_SHARED_LIBS) - add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) + add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_HDRS}) target_include_directories (${HDF5_F90_C_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" @@ -157,11 +167,12 @@ if (NOT ONLY_SHARED_LIBS) FOLDER libraries/fortran LINKER_LANGUAGE C ) + add_dependencies (${HDF5_F90_C_LIB_TARGET} H5gen_i) set (install_targets ${HDF5_F90_C_LIB_TARGET}) endif () if (BUILD_SHARED_LIBS) - add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) + add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_SHHDRS}) target_include_directories (${HDF5_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" @@ -176,6 +187,7 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/fortran LINKER_LANGUAGE C ) + add_dependencies (${HDF5_F90_C_LIBSH_TARGET} H5gen_iSH) set (install_targets ${install_targets} ${HDF5_F90_C_LIBSH_TARGET}) endif () @@ -210,39 +222,39 @@ set (f90_F_GEN_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 ) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5_gen.F90 +add_custom_command (TARGET H5_buildiface POST_BUILD + BYPRODUCTS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} - DEPENDS ${f90_F_GEN_SOURCES} + DEPENDS H5_buildiface ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 file" ) if (NOT ONLY_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + add_custom_command (TARGET H5_buildiface POST_BUILD + BYPRODUCTS H5_gen.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/static/H5_gen.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 + DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMENT "Generating the H5_gen.F90 file" ) add_custom_target (H5gen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) endif () if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 + add_custom_command (TARGET H5_buildiface POST_BUILD + BYPRODUCTS H5_gen.F90 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90" + ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 COMMENT "Generating the H5_gen.F90 shared file" ) add_custom_target (H5genSH ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 + DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 PROPERTIES GENERATED TRUE) endif () @@ -547,7 +559,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5fc diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index df83c9c..0dea405 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -91,27 +91,27 @@ if (HDF5_ENABLE_FORMATTERS) endif () if (NOT BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + add_custom_command (TARGET H5_test_buildiface POST_BUILD + BYPRODUCTS tf_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static DEPENDS H5_test_buildiface - COMMENT "Generating the tf_gen.F90 file" + COMMENT "Generating the tf_gen.F90 static file" ) add_custom_target (H5testgen ALL - DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + DEPENDS H5_test_buildiface ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 ) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) else () - add_custom_command ( - OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 + add_custom_command (TARGET H5_test_buildiface POST_BUILD + BYPRODUCTS tf_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 shared file" ) add_custom_target (H5testgenSH ALL - DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 + DEPENDS H5_test_buildiface ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 ) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) endif () diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 1eac9fe..e488656 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -120,7 +120,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_CXX_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_CXX_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 0b7795b..4f0b451 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -114,15 +114,15 @@ set (HDF5_HL_F90_F_BASE_SOURCES ) if (NOT ONLY_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + add_custom_command (TARGET H5HL_buildiface POST_BUILD + BYPRODUCTS $H5LTff_gen.F90 H5TBff_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" ) add_custom_target (H5HLgen ALL - DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + DEPENDS H5HL_buildiface ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 ) set_source_files_properties ( ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 @@ -131,15 +131,15 @@ if (NOT ONLY_SHARED_LIBS) ) endif () if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 + add_custom_command (TARGET H5HL_buildiface POST_BUILD + BYPRODUCTS H5LTff_gen.F90 H5TBff_gen.F90 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/shared DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files" ) add_custom_target (H5HLgenSH ALL - DEPENDS ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 + DEPENDS H5HL_buildiface ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 ) set_source_files_properties ( ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 @@ -353,7 +353,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 785bdcf..427424e 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -152,7 +152,11 @@ install ( ) if (NOT WIN32 AND NOT MINGW) - set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 002fc23..1259cd2 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,27 @@ New Features Configuration: ------------- + - CMake no longer builds the C++ library by default + + HDF5_BUILD_CPP_LIB now defaults to OFF, which is in line with the + Autotools build defaults. + + (DER - 2021/04/20) + + - Removal of pre-VS2015 work-arounds + + HDF5 now requires Visual Studio 2015 or greater, so old work-around + code and definitions have been removed, including: + + * + * snprintf and vsnprintf + * llround, llroundf, lround, lroundf, round, roundf + * strtoll and strtoull + * va_copy + * struct timespec + + (DER - 2021/03/22) + - Add CMake variable HDF5_LIB_INFIX This infix is added to all library names after 'hdf5'. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7b70e67..b04fcb1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -977,6 +977,7 @@ if (LOCAL_BATCH_TEST) endif () endif () +set (lib_prog_deps) if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") @@ -984,8 +985,11 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> - PRIVATE $<$:"-O0"> ) + target_compile_options(H5detect + PRIVATE "$<$:-O0>" + ) + set (lib_prog_deps ${lib_prog_deps} H5detect) if (HDF5_BATCH_H5DETECT) configure_file ( @@ -993,77 +997,68 @@ if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY ) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND ${HDF5_BATCH_CMD} - ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} - COMMAND ${CMAKE_COMMAND} - ARGS -E echo "Executed batch command to create H5Tinit.c" + OUTPUT gen_SRCS.stamp1 + COMMAND ${HDF5_BATCH_CMD} + ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} + BYPRODUCTS H5Tinit.c gen_SRCS.stamp1 + COMMAND ${CMAKE_COMMAND} + ARGS -E echo "Executed batch command to create H5Tinit.c" COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 + ARGS -E touch gen_SRCS.stamp1 DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) add_custom_target (gen_H5Tinit COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/wait_H5Tinit.cmake ) - if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" - COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) - endif () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + add_custom_command (TARGET H5detect POST_BUILD + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ARGS H5Tinit.c + BYPRODUCTS H5Tinit.c gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 + ARGS -E touch gen_SRCS.stamp1 DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Create H5Tinit.c" ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 + add_custom_command (TARGET H5detect POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c + BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS -E touch shared/shared_gen_SRCS.stamp1 + DEPENDS H5detect H5Tinit.c WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Copy H5Tinit.c to shared folder" ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () endif () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 + OUTPUT gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS -E touch gen_SRCS.stamp1 + DEPENDS H5Tinit.c WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Touch existing H5Tinit.c" ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 + OUTPUT shared/shared_gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + ARGS -E copy_if_different H5Tinit.c shared/H5Tinit.c + BYPRODUCTS shared/H5Tinit.c shared/shared_gen_SRCS.stamp1 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS -E touch shared/shared_gen_SRCS.stamp1 + DEPENDS H5Tinit.c WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + COMMENT "Copy existing H5Tinit.c to shared folder" ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () @@ -1082,8 +1077,11 @@ target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_ TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> - PRIVATE $<$:"-O0"> ) +target_compile_options(H5make_libsettings + PRIVATE "$<$:-O0>" +) +set (lib_prog_deps ${lib_prog_deps} H5make_libsettings) #----------------------------------------------------------------------------- # Add Target to clang-format @@ -1092,27 +1090,27 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_SRC_LIBSETTINGS_FORMAT H5make_libsettings) endif () -add_custom_command ( - OUTPUT ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c - ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ - ARGS ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c +add_custom_command (TARGET H5make_libsettings POST_BUILD + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ARGS H5lib_settings.c + BYPRODUCTS H5lib_settings.c gen_SRCS.stamp2 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2 + ARGS -E touch gen_SRCS.stamp2 DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR} + COMMENT "Create H5lib_settings.c" ) set_source_files_properties (${HDF5_SRC_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) - add_custom_command ( - OUTPUT ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c - ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2 + add_custom_command (TARGET H5make_libsettings POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_SRC_BINARY_DIR}/H5lib_settings.c" "${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c" + ARGS -E copy_if_different H5lib_settings.c shared/H5lib_settings.c + BYPRODUCTS shared/H5lib_settings.c shared/shared_gen_SRCS.stamp2 COMMAND ${CMAKE_COMMAND} - ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2 - DEPENDS ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c + ARGS -E touch shared/shared_gen_SRCS.stamp2 + DEPENDS H5make_libsettings H5lib_settings.c WORKING_DIRECTORY ${HDF5_SRC_BINARY_DIR} + COMMENT "Copy H5lib_settings.c to shared folder" ) set_source_files_properties (${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () @@ -1126,7 +1124,10 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- if (NOT ONLY_SHARED_LIBS) set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c) - add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) + add_custom_target (gen_${HDF5_LIB_TARGET} ALL + DEPENDS ${lib_prog_deps} ${gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/gen_SRCS.stamp2 + COMMENT "Generation target files" + ) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIB_TARGET} @@ -1162,7 +1163,10 @@ endif () if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/shared/H5lib_settings.c) - add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2) + add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL + DEPENDS ${lib_prog_deps} ${shared_gen_SRCS} ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_SRC_BINARY_DIR}/shared/shared_gen_SRCS.stamp2 + COMMENT "Shared generation target files" + ) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS} ${H5_MODULE_HEADERS}) target_include_directories (${HDF5_LIBSH_TARGET} @@ -1281,7 +1285,11 @@ install ( ) if (NOT WIN32) - set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + set (_PKG_CONFIG_COMPILER ${MPI_C_COMPILER}) + else () + set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + endif () configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in ${HDF5_BINARY_DIR}/CMakeFiles/h5cc @@ -1293,6 +1301,20 @@ if (NOT WIN32) PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT libraries ) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + #legacy requires a different name + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT libraries + ) + endif () endif () #----------------------------------------------------------------------------- @@ -1306,16 +1328,18 @@ if (DOXYGEN_FOUND) set (DOXYGEN_VERBATIM_VARS DOXYGEN_INCLUDE_ALIASES) set (DOXYGEN_PROJECT_LOGO ${HDF5_DOXYGEN_DIR}/img/HDFG-logo.png) set (DOXYGEN_PROJECT_BRIEF "C-API Reference") - set (DOXYGEN_INPUT_DIRECTORY "${HDF5_SRC_DIR} ${HDF5_DOXYGEN_DIR}/dox ${HDF5_GENERATED_SOURCE_DIR}/shared") + set (DOXYGEN_INPUT_DIRECTORY "${HDF5_SRC_DIR} ${HDF5_DOXYGEN_DIR}/dox ${HDF5_GENERATED_SOURCE_DIR}") set (DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES) set (DOXYGEN_MACRO_EXPANSION YES) set (DOXYGEN_OUTPUT_DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs) + set (DOXYGEN_EXAMPLES_DIRECTORY ${HDF5_DOXYGEN_DIR}/examples) # This configure and custom target work together # Replace variables inside @@ with the current values configure_file (${HDF5_DOXYGEN_DIR}/Doxyfile.in ${HDF5_BINARY_DIR}/Doxyfile @ONLY) add_custom_target (hdf5lib_doc ALL COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c WORKING_DIRECTORY ${HDF5_SRC_DIR} COMMENT "Generating HDF5 library Source API documentation with Doxygen" VERBATIM ) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 4d23de3..b28bbd6 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -197,18 +197,22 @@ if (UNIX) # testvdsswmr.sh: vds_swmr* add_test (H5SHELL-testflushrefresh ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh) set_tests_properties (H5SHELL-testflushrefresh PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (H5SHELL-test_usecases ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh) set_tests_properties (H5SHELL-test_usecases PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (H5SHELL-testswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.sh) set_tests_properties (H5SHELL-testswmr PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (H5SHELL-testvdsswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh) set_tests_properties (H5SHELL-testvdsswmr PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -- cgit v0.12