From b6e61e8310a1e0a14de6f427b853716d447af373 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 23 Oct 2018 11:00:36 -0500 Subject: Merge CMake changes from develop Improved cross-compiling and toolchains --- CMakeInstallation.cmake | 2 +- CMakeLists.txt | 6 +++ MANIFEST | 3 +- config/cmake/UserMacros/Windows_MT.cmake | 3 +- config/cmake/scripts/CTestScript.cmake | 6 ++- config/cmake/scripts/HDF5options.cmake | 16 ++++---- config/cmake_ext_mod/ConfigureChecks.cmake | 4 +- config/intel.cmake | 10 ----- config/toolchain/GCC.cmake | 10 +++++ config/toolchain/intel.cmake | 10 +++++ configure.ac | 18 ++++----- fortran/src/H5config_f.inc.cmake | 2 +- release_docs/RELEASE.txt | 8 ++-- src/CMakeLists.txt | 62 +++++++++++++++++++++--------- tools/src/h5format_convert/CMakeLists.txt | 2 +- 15 files changed, 104 insertions(+), 58 deletions(-) delete mode 100644 config/intel.cmake create mode 100644 config/toolchain/GCC.cmake create mode 100644 config/toolchain/intel.cmake diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 2339049..464477b 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -125,7 +125,7 @@ else () endif () configure_file ( ${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in - ${HDF5_BINARY_DIR}/libhdf5.settings @ONLY + ${HDF5_BINARY_DIR}/libhdf5.settings ESCAPE_QUOTES @ONLY ) install ( FILES ${HDF5_BINARY_DIR}/libhdf5.settings diff --git a/CMakeLists.txt b/CMakeLists.txt index 24bb83d..f1603f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -903,4 +903,10 @@ endif () #----------------------------------------------------------------------------- configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY) +#----------------------------------------------------------------------------- +# Options for use by cross compiling and toolchains +#----------------------------------------------------------------------------- +option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) +option (HDF5_BATCH_H5DETECT "Use a batch command for running h5detect" OFF) + include (CMakeInstallation.cmake) diff --git a/MANIFEST b/MANIFEST index 11611d6..8b60dd5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3146,7 +3146,8 @@ ./java/lib/ext/slf4j-simple-1.7.25.jar # CMake-specific Files -./config/intel.cmake +./config/toolchain/GCC.cmake +./config/toolchain/intel.cmake ./config/cmake/cacheinit.cmake ./config/cmake/CMakeFindJavaCommon.cmake diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index b6cc513..78d8277 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -14,7 +14,8 @@ ######################################################## # To use this option, copy both the macro and option code -# into the root UserMacros.cmake file. +# into the root UserMacros.cmake file. Then enable the option, +# using the command line add "-DBUILD_STATIC_CRT_LIBS:BOOL=ON" # OR add an include to the root UserMacros.cmake file: # INCLUDE(path_to_file/WINDOWS_MT.cmake) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 670196b..43cd48d 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -263,7 +263,11 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") if (NOT LOCAL_SKIP_TEST) if (NOT LOCAL_MEMCHECK_TEST) - ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + if (NOT LOCAL_BATCH_TEST) + ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + else () + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_NAME}) + endif () if (LOCAL_SUBMIT) ctest_submit (PARTS Test) endif () diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 80a28d3..629d277 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -70,18 +70,18 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING ### enable parallel builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") ############################################################################################# ### enable thread-safety builds -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON”) +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON") #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF") -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF”) -#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF”) +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF") ############################################################################################# ### disable test program builds @@ -98,6 +98,6 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") ############################################################################################# ### use a toolchain file -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/intel.cmake") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") ############################################################################################# diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 4204511..40f1440 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -273,7 +273,7 @@ if (NOT WINDOWS) set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE) option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) - if (HDF_ENABLE_LARGE_FILE) + if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN) set (msg "Performing TEST_LFS_WORKS") TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE ${CMAKE_BINARY_DIR} @@ -563,7 +563,7 @@ endif () if (WINDOWS) if (NOT HDF_NO_IOEO_TEST) message (STATUS "Checking for InitOnceExecuteOnce:") - if (NOT DEFINED ${${HDF_PREFIX}_HAVE_IOEO}) + if (NOT DEFINED ${HDF_PREFIX}_HAVE_IOEO) if (LARGEFILE) set (CMAKE_REQUIRED_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" diff --git a/config/intel.cmake b/config/intel.cmake deleted file mode 100644 index f1a5734..0000000 --- a/config/intel.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# Uncomment the following to use cross-compiling -#set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_COMPILER_VENDOR "intel") - -set(CMAKE_C_COMPILER icc) -set(CMAKE_CXX_COMPILER icpc) -set(CMAKE_Fortran_COMPILER ifort) - -# the following is used if cross-compiling -set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/toolchain/GCC.cmake b/config/toolchain/GCC.cmake new file mode 100644 index 0000000..ddb1641 --- /dev/null +++ b/config/toolchain/GCC.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "GCC") + +set(CMAKE_C_COMPILER cc) +set(CMAKE_CXX_COMPILER c++) +set(CMAKE_Fortran_COMPILER gfortran) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake new file mode 100644 index 0000000..f1a5734 --- /dev/null +++ b/config/toolchain/intel.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "intel") + +set(CMAKE_C_COMPILER icc) +set(CMAKE_CXX_COMPILER icpc) +set(CMAKE_Fortran_COMPILER ifort) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/configure.ac b/configure.ac index 0f1f230..e82a244 100644 --- a/configure.ac +++ b/configure.ac @@ -1262,8 +1262,8 @@ AC_ARG_WITH([dmalloc], [Use dmalloc memory debugging aid [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_DMALLOC="yes" AC_CHECK_HEADERS([dmalloc.h],, [unset HAVE_DMALLOC]) if test "x$HAVE_DMALLOC" = "xyes"; then @@ -1273,7 +1273,7 @@ case $withval in AC_MSG_ERROR([couldn't find dmalloc library]) fi ;; - no) + X-|X-no|X-none) HAVE_DMALLOC="no" AC_MSG_CHECKING([for dmalloc library]) AC_MSG_RESULT([suppressed]) @@ -1341,8 +1341,8 @@ AC_ARG_WITH([zlib], filter [default=yes]])],, [withval=yes]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_ZLIB="yes" AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB]) if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then @@ -1356,7 +1356,7 @@ case $withval in AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) fi ;; - no) + X-|X-no|X-none) HAVE_ZLIB="no" AC_MSG_CHECKING([for zlib]) AC_MSG_RESULT([suppressed]) @@ -1435,8 +1435,8 @@ AC_ARG_WITH([szlib], filter [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_SZLIB="yes" AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZLIB]) if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then @@ -1446,7 +1446,7 @@ case $withval in AC_MSG_ERROR([couldn't find szlib library]) fi ;; - no) + X-|X-no|X-none) HAVE_SZLIB="no" AC_MSG_CHECKING([for szlib]) AC_MSG_RESULT([suppressed]) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index aa3d135..3dd3c8c 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -12,7 +12,7 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure ! Define if we have parallel support -#cmakedefine01 H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +#cmakedefine01 H5_HAVE_PARALLEL #if H5_HAVE_PARALLEL == 0 #undef H5_HAVE_PARALLEL #endif diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index fbad2f3..e7c1014 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -161,7 +161,7 @@ Bug Fixes since HDF5-1.10.3 release Java Library: ---------------- - JNI native library dependencies - + The build for the hdf5_java native library used the wrong hdf5 target library for CMake builds. Correcting the hdf5_java library to build with the shared hdf5 library required testing @@ -216,10 +216,9 @@ Supported Platforms Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Windows 7 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake) - Visual Studio 2013 w/ Intel Fortran 15 (cmake) + Windows 7 x64 Visual Studio 2013 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake) + Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake) Visual Studio 2015 w/ MSMPI 8 (cmake) Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake) @@ -239,6 +238,7 @@ Supported Platforms 64-bit gfortran GNU Fortran (GCC) 7.1.0 (swallow/kite) Intel icc/icpc/ifort version 17.0.2 + Tested Configuration Features Summary ===================================== diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3370c99..6cc0123 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -853,7 +853,6 @@ endif () # Setup the H5detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) if (HDF5_USE_PREGEN) set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR}) else () @@ -871,31 +870,54 @@ 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> - INTERFACE $<$:"-O0"> + PRIVATE $<$:"-O0"> ) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - if (BUILD_SHARED_LIBS) - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + if (HDF5_BATCH_H5DETECT) + configure_file ( + ${HDF5_SOURCE_DIR}/bin/batch/${HDF5_DETECT_BATCH_SCRIPT}.in + ${HDF5_BINARY_DIR}/${HDF5_DETECT_BATCH_SCRIPT} ESCAPE_QUOTES @ONLY + ) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${HDF5_BATCH_CMD} + ARGS ${HDF5_BATCH_H5DETECT_SCRIPT} + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + 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 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ) - else () set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () + else () + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () + endif () endif () else () - 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 @@ -913,7 +935,7 @@ 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> - INTERFACE $<$:"-O0"> + PRIVATE $<$:"-O0"> ) add_custom_command ( @@ -923,6 +945,7 @@ add_custom_command ( DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) +set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c @@ -931,6 +954,7 @@ if (BUILD_SHARED_LIBS) DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) + set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 62f269b..79a1316 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -34,4 +34,4 @@ if (HDF5_EXPORTED_TARGETS) ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) -endif () \ No newline at end of file +endif () -- cgit v0.12 From 81b2943b6fc01b52de2048d9503d524b2780112b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Oct 2018 15:54:09 -0500 Subject: Fix typo in whitespace area --- config/cmake/ConversionTests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index 321d879..c2748b2 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -9,7 +9,7 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -+ + #if defined(__has_attribute) #if __has_attribute(no_sanitize) #define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) -- cgit v0.12