From 265325fb9aa5dd6e8ca95fecb52528d7f8702c7d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 18 Nov 2019 14:58:06 -0600 Subject: Add VS2019 support --- config/cmake/CTestScript.cmake | 6 +++++- config/cmake/HDF5_Examples.cmake.in | 3 +++ config/cmake/hdf5-config.cmake.in | 1 + config/cmake/scripts/CTestScript.cmake | 12 ++++++++++-- config/cmake/scripts/HDF5config.cmake | 18 ++++++++++++++++-- config/cmake_ext_mod/HDFMacros.cmake | 8 +++++++- config/cmake_ext_mod/HDFUseFortran.cmake | 4 ++-- config/toolchain/clang.cmake | 4 ++-- release_docs/INSTALL_CMake.txt | 14 +++++++++----- release_docs/RELEASE.txt | 8 ++++++++ release_docs/USING_CMake_Examples.txt | 2 +- 11 files changed, 64 insertions(+), 16 deletions(-) diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake index e819e58..e914c4d 100644 --- a/config/cmake/CTestScript.cmake +++ b/config/cmake/CTestScript.cmake @@ -119,8 +119,12 @@ set(CTEST_CONFIGURE_TOOLSET "") if(CMAKE_GENERATOR_TOOLSET) set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}") endif() +set(CTEST_CONFIGURE_ARCHITECTURE "") +if(CMAKE_GENERATOR_ARCHITECTURE) + set(CTEST_CONFIGURE_ARCHITECTURE "-A${CMAKE_GENERATOR_ARCHITECTURE}") +endif() set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" ) #----------------------------------------------------------------------------- diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 042b17b..4755ec8 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -20,6 +20,9 @@ set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") if("@CMAKE_GENERATOR_TOOLSET@") set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") endif() +if("@CMAKE_GENERATOR_ARCHITECTURE@") + set(CMAKE_GENERATOR_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@") +endif() set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) # handle input parameters to script. diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index afb2a5c..b5a12a6 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -46,6 +46,7 @@ set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @H5_ENABLE_SHARED_LIB@) set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS @H5_ENABLE_STATIC_LIB@) set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@) set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF5_LIBRARIES_TO_EXPORT@) +set (${HDF5_PACKAGE_NAME}_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@") set (${HDF5_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set (${HDF5_PACKAGE_NAME}_DEFAULT_API_VERSION "@DEFAULT_API_VERSION@") set (${HDF5_PACKAGE_NAME}_PARALLEL_FILTERED_WRITES "@PARALLEL_FILTERED_WRITES@") diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index dc3939e..febe109 100644 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -195,20 +195,28 @@ if (CMAKE_GENERATOR_TOOLSET) else () set (CTEST_CONFIGURE_TOOLSET "") endif() +if (CMAKE_GENERATOR_ARCHITECTURE) + set (CTEST_CONFIGURE_ARCHITECTURE "-A${CMAKE_GENERATOR_ARCHITECTURE}") +else () + set (CTEST_CONFIGURE_ARCHITECTURE "") +endif() if (LOCAL_MEMCHECK_TEST) find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind) set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" ) else () if (LOCAL_COVERAGE_TEST) find_program (CTEST_COVERAGE_COMMAND NAMES gcov) endif () set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" ) endif () +set(CTEST_USE_LAUNCHERS 1) +set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1) + #----------------------------------------------------------------------------- ## -- set output to english set ($ENV{LC_MESSAGES} "en_EN") diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index ad5fbdc..775fb37 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -22,6 +22,8 @@ cmake_minimum_required (VERSION 3.10) # where valid options for OPTION are: # BUILD_GENERATOR - The cmake build generator: # Unix * Unix Makefiles +# VS2019 * Visual Studio 16 2019 +# VS201964 * Visual Studio 16 2019 # VS2017 * Visual Studio 15 2017 # VS201764 * Visual Studio 15 2017 Win64 # VS2015 * Visual Studio 14 2015 @@ -106,8 +108,20 @@ if (NOT DEFINED HPC) endif () if (WIN32 AND NOT MINGW) set (SITE_OS_NAME "Windows") - set (SITE_OS_VERSION "WIN7") - if (BUILD_GENERATOR STREQUAL "VS201764") + set (SITE_OS_VERSION "WIN10") + if (BUILD_GENERATOR STREQUAL "VS201964") + set (CTEST_CMAKE_GENERATOR "Visual Studio 16 2019") + set (CMAKE_GENERATOR_ARCHITECTURE "x64") + set (SITE_OS_BITS "64") + set (SITE_COMPILER_NAME "vs2019") + set (SITE_COMPILER_VERSION "16") + elseif (BUILD_GENERATOR STREQUAL "VS2019") + set (CTEST_CMAKE_GENERATOR "Visual Studio 16 2019") + set (CMAKE_GENERATOR_ARCHITECTURE "Win32") + set (SITE_OS_BITS "32") + set (SITE_COMPILER_NAME "vs2019") + set (SITE_COMPILER_VERSION "16") + elseif (BUILD_GENERATOR STREQUAL "VS201764") set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64") set (SITE_OS_BITS "64") set (SITE_COMPILER_NAME "vs2017") diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index e320c07..148e9d7 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -261,6 +261,10 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM} Intel") if (${CMAKE_C_COMPILER_VERSION} MATCHES "^17.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 17") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^18.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 18") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 19") else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel ${CMAKE_C_COMPILER_VERSION}") endif () @@ -277,8 +281,10 @@ macro (HDF_README_PROPERTIES target_fortran) elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*") if (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.0.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") - else () + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.16.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017") + else () #19.23 + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2019") endif () else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index bfb45fa..1cce918 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -192,7 +192,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding #----------------------------------------------------------------------------- if (CMAKE_Fortran_COMPILER MATCHES ifort) if (WIN32 AND NOT MINGW) - set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE) - set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE) + set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE STRING "flags" FORCE) + set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "flags" FORCE) endif () endif () diff --git a/config/toolchain/clang.cmake b/config/toolchain/clang.cmake index 7dac587..f9da787 100644 --- a/config/toolchain/clang.cmake +++ b/config/toolchain/clang.cmake @@ -13,8 +13,8 @@ find_program( DOC "Path to clang-tidy executable" ) -set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*) -set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*) +set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*,-clang-analyzer-cplusplus*,-readability-*,-google*) +set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*,-clang-analyzer-cplusplus*,-readability-*,-google*) #find_program( # CLANG_FORMAT_EXE diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 49fef76..652e1f4 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -31,7 +31,8 @@ Obtaining HDF5 source code CMake version 1. We suggest you obtain the latest CMake from the Kitware web site. The HDF5 1.10."X" product requires a minimum CMake version 3.10, - where "X" is the current HDF5 release version. + where "X" is the current HDF5 release version. If you are using + VS2019, the minimum version is 3.15. Note: To change the install prefix from the platform defaults initialize @@ -90,6 +91,10 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to: 5. From the "myhdfstuff" directory execute the CTest Script with the following options: + On 32-bit Windows with Visual Studio 2019, execute: + ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2019 -C Release -VV -O hdf5.log + On 64-bit Windows with Visual Studio 2019, execute: + ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201964 -C Release -VV -O hdf5.log On 32-bit Windows with Visual Studio 2017, execute: ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2017 -C Release -VV -O hdf5.log On 64-bit Windows with Visual Studio 2017, execute: @@ -439,12 +444,11 @@ These five steps are described in detail below. * MinGW Makefiles * NMake Makefiles * Unix Makefiles - * Visual Studio 11 2012 - * Visual Studio 11 2012 Win64 - * Visual Studio 12 2013 - * Visual Studio 12 2013 Win64 * Visual Studio 14 2015 * Visual Studio 14 2015 Win64 + * Visual Studio 15 2017 + * Visual Studio 15 2017 Win64 + * Visual Studio 16 2019 is: * SZIP_INCLUDE_DIR:PATH= diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c2f2ebe..d08bd33 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,14 @@ New Features Configuration: ------------- + - Update CMake for VS2019 support + + CMake added support for VS2019 in version 3.15. Changes to the CMake + generator setting required changes to scripts. Also updated version + references in CMake files as necessary. + + (ADB - 2019/11/18, HDFFV-10962) + - Update CMake tests to use FIXTURES CMake test fixtures allow setup/cleanup tests and other dependency diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index ea352fe..21e153f 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -22,7 +22,7 @@ I. Preconditions 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 1.10.x product requires a minimum CMake version - of 3.10.2. + of 3.10.2. If you are using VS2019, the minimum version is 3.15. 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for -- cgit v0.12