From 528a8e7f46a2adc9b70e47eb7166c385d36220e8 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 2 Nov 2023 07:54:32 -0500 Subject: Sync CMake changes from develop (#3811) Guard test dirs with HDF5_EXTERNALLY_CONFIGURED Add toolchain support to examples testing --- CMakeInstallation.cmake | 10 +++++++--- CTestConfig.cmake | 12 ++---------- c++/CMakeLists.txt | 2 +- config/cmake/LIBAEC/CMakeLists.txt | 6 +++--- config/cmake/ZLIB/CMakeLists.txt | 6 +++--- config/cmake/cacheinit.cmake | 2 +- config/cmake/examples/HDF5_Examples.cmake.in | 15 +++++++-------- config/cmake/examples/HDF5_Examples_options.cmake | 13 +++++++++++++ config/cmake/scripts/HDF5options.cmake | 1 - config/sanitizer/README.md | 1 + fortran/CMakeLists.txt | 2 +- hl/CMakeLists.txt | 2 +- java/CMakeLists.txt | 2 +- tools/CMakeLists.txt | 2 +- utils/CMakeLists.txt | 2 +- 15 files changed, 43 insertions(+), 35 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index bb24476..02f8dc3 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -141,6 +141,10 @@ install ( #----------------------------------------------------------------------------- option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) if (HDF5_PACK_EXAMPLES) + if (DEFINED CMAKE_TOOLCHAIN_FILE) + get_filename_component(TOOLCHAIN ${CMAKE_TOOLCHAIN_FILE} NAME) + set(CTEST_TOOLCHAIN_FILE "\${CTEST_SOURCE_DIRECTORY}/config/toolchain/${TOOLCHAIN}") + endif () configure_file ( ${HDF_RESOURCES_DIR}/examples/HDF5_Examples.cmake.in ${HDF5_BINARY_DIR}/HDF5_Examples.cmake @ONLY @@ -295,10 +299,10 @@ endif () if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_PACKAGE_VENDOR "HDF_Group") set (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}") - if (CDASH_LOCAL) - set (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}") - else () + if (NOT WIN32 OR HDF5_VERS_SUBRELEASE MATCHES "^[0-9]+$") set (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION_STRING}") + else () + set (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}") endif () set (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 9332de0..741f56a 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -22,20 +22,12 @@ set (CTEST_DROP_METHOD "https") if (CTEST_DROP_SITE_INIT) set (CTEST_DROP_SITE "${CTEST_DROP_SITE_INIT}") else () - if (CDASH_LOCAL) - set (CTEST_DROP_SITE "cdash-internal.hdfgroup.org") - else () - set (CTEST_DROP_SITE "cdash.hdfgroup.org") - endif () + set (CTEST_DROP_SITE "cdash.hdfgroup.org") endif () if (CTEST_DROP_LOCATION_INIT) set (CTEST_DROP_LOCATION "${CTEST_DROP_LOCATION_INIT}") else () - if (CDASH_LOCAL) - set (CTEST_DROP_LOCATION "/submit.php?project=HDF5114") - else () - set (CTEST_DROP_LOCATION "/submit.php?project=HDF5114") - endif () + set (CTEST_DROP_LOCATION "/submit.php?project=HDF5114") endif () set (CTEST_DROP_SITE_CDASH TRUE) diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 2c0275b..b419c80 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -13,6 +13,6 @@ endif () #----------------------------------------------------------------------------- # Build the CPP unit tests #----------------------------------------------------------------------------- -if (BUILD_TESTING) +if (NOT HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING) add_subdirectory (test) endif () diff --git a/config/cmake/LIBAEC/CMakeLists.txt b/config/cmake/LIBAEC/CMakeLists.txt index 53950d8..9ffb68d 100644 --- a/config/cmake/LIBAEC/CMakeLists.txt +++ b/config/cmake/LIBAEC/CMakeLists.txt @@ -369,10 +369,10 @@ configure_file (${LIBAEC_SOURCE_DIR}/README.md ${LIBAEC_BINARY_DIR}/LIBAEC_READM if (NOT LIBAEC_EXTERNALLY_CONFIGURED) set (CPACK_PACKAGE_VENDOR "HDF_Group") set (CPACK_PACKAGE_NAME "${LIBAEC_PACKAGE_NAME}") - if (CDASH_LOCAL) - set (CPACK_PACKAGE_VERSION "${LIBAEC_PACKAGE_VERSION}") - else () + if (NOT WIN32 OR LIBAEC_VERS_SUBRELEASE MATCHES "^[0-9]+$") set (CPACK_PACKAGE_VERSION "${LIBAEC_PACKAGE_VERSION_STRING}") + else () + set (CPACK_PACKAGE_VERSION "${LIBAEC_PACKAGE_VERSION}") endif () set (CPACK_PACKAGE_VERSION_MAJOR "${LIBAEC_PACKAGE_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${LIBAEC_PACKAGE_VERSION_MINOR}") diff --git a/config/cmake/ZLIB/CMakeLists.txt b/config/cmake/ZLIB/CMakeLists.txt index 12411ac..5c06a54 100644 --- a/config/cmake/ZLIB/CMakeLists.txt +++ b/config/cmake/ZLIB/CMakeLists.txt @@ -428,10 +428,10 @@ configure_file (${ZLIB_SOURCE_DIR}/README ${ZLIB_BINARY_DIR}/ZLIB_README @ONLY) if (NOT ZLIB_EXTERNALLY_CONFIGURED) set (CPACK_PACKAGE_VENDOR "HDF_Group") set (CPACK_PACKAGE_NAME "${ZLIB_PACKAGE_NAME}") - if (CDASH_LOCAL) - set (CPACK_PACKAGE_VERSION "${ZLIB_PACKAGE_VERSION}") - else () + if (NOT WIN32 OR ZLIB_VERS_SUBRELEASE MATCHES "^[0-9]+$") set (CPACK_PACKAGE_VERSION "${ZLIB_PACKAGE_VERSION_STRING}") + else () + set (CPACK_PACKAGE_VERSION "${ZLIB_PACKAGE_VERSION}") endif () set (CPACK_PACKAGE_VERSION_MAJOR "${ZLIB_PACKAGE_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${ZLIB_PACKAGE_VERSION_MINOR}") diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 159a4e2..c8f5d06 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -73,7 +73,7 @@ set (PLUGIN_USE_LOCALCONTENT ON CACHE BOOL "Use local file for PLUGIN FetchConte set (PLUGIN_PACKAGE_NAME "pl" CACHE STRING "Name of PLUGIN package" FORCE) set (H5PL_VERS_MAJOR "1" CACHE STRING "Major version of hdf5 package for PLUGIN package" FORCE) set (H5PL_VERS_MINOR "14" CACHE STRING "Minor version of hdf5 package for PLUGIN package" FORCE) -set (H5PL_VERS_RELEASE "3" CACHE STRING "Release version of hdf5 package for PLUGIN package" FORCE) +set (H5PL_VERS_RELEASE "4" CACHE STRING "Release version of hdf5 package for PLUGIN package" FORCE) ############# # bitshuffle diff --git a/config/cmake/examples/HDF5_Examples.cmake.in b/config/cmake/examples/HDF5_Examples.cmake.in index d77c16d..2f3a649 100644 --- a/config/cmake/examples/HDF5_Examples.cmake.in +++ b/config/cmake/examples/HDF5_Examples.cmake.in @@ -29,6 +29,7 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) #INSTALLDIR - HDF5 root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF5Examples +#CTEST_TOOLCHAIN_FILE - name and path in source of toolchain file if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 @@ -62,11 +63,6 @@ if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "HDF5Examples") endif() -if(NOT DEFINED HDF_LOCAL) - set(CDASH_LOCAL "NO") -else() - set(CDASH_LOCAL "YES") -endif() if(NOT DEFINED CTEST_SITE) set(CTEST_SITE "local") endif() @@ -100,10 +96,13 @@ else() endif() ### default HDF5_PLUGIN_PATH to where the filter libraries are located set(ENV{HDF5_PLUGIN_PATH} "${INSTALLDIR}/lib/plugin") -if(${CDASH_LOCAL}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") -endif() set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") +### use a toolchain file (supported everywhere) #### +if(NOT DEFINED CTEST_TOOLCHAIN_FILE) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=@CTEST_TOOLCHAIN_FILE@") +else() + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=${CTEST_TOOLCHAIN_FILE}") +endif() ############################################################################################################### # For any comments please contact cdashhelp@hdfgroup.org diff --git a/config/cmake/examples/HDF5_Examples_options.cmake b/config/cmake/examples/HDF5_Examples_options.cmake index cdd49eb..684ec5b 100644 --- a/config/cmake/examples/HDF5_Examples_options.cmake +++ b/config/cmake/examples/HDF5_Examples_options.cmake @@ -29,6 +29,19 @@ #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=ON") ############################################################################################# +#### maximum parallel processor count for build and test #### +#set(MAX_PROC_COUNT 8) + +############################################################################################# +#### alternate toolsets (Windows usually) #### +#set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") + +############################################################################################# +### use a toolchain file (supported everywhere) #### +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/clang.cmake") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") + +############################################################################################# #### languages #### ### disable C builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_C:BOOL=OFF") diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 5267212..d208d65 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -26,7 +26,6 @@ ############################################################################################# ### use a toolchain file (supported everywhere) #### - #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") ############################################################################################# diff --git a/config/sanitizer/README.md b/config/sanitizer/README.md index b33c100..e314145 100644 --- a/config/sanitizer/README.md +++ b/config/sanitizer/README.md @@ -305,3 +305,4 @@ file(GLOB_RECURSE CMAKE_FILES cmake_format(TARGET_NAME ${CMAKE_FILES}) ``` + diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index cf9b427..efaf963 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -22,7 +22,7 @@ endif () #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- -if (BUILD_TESTING) +if (NOT HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING) add_subdirectory (test) if (MPI_Fortran_FOUND) add_subdirectory (testpar) diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index a777b72..45a9a22 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -26,6 +26,6 @@ if (HDF5_BUILD_EXAMPLES) endif () #-- Build the Unit testing if requested -if (BUILD_TESTING AND HDF5_TEST_SERIAL) +if (HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING AND HDF5_TEST_SERIAL) add_subdirectory (test) endif () diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index ae37ceb..4965f2c 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -49,7 +49,7 @@ endif () #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- -if (BUILD_TESTING) +if (NOT HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING) add_subdirectory (test) endif () diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 55f2c2a..91c57c9 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -7,7 +7,7 @@ add_subdirectory (lib) add_subdirectory (src) #-- Add the tests -if (BUILD_TESTING) +if (NOT HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING) add_subdirectory (test) # -------------------------------------------------------------------- diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 718f88e..b7e4630 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.18) project (HDF5_UTILS C) -if (BUILD_TESTING) +if (NOT HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING) add_subdirectory (test) endif () -- cgit v0.12