| 1 |
# |
| 2 |
# Copyright by The HDF Group. |
| 3 |
# All rights reserved. |
| 4 |
# |
| 5 |
# This file is part of HDF5. The full HDF5 copyright notice, including |
| 6 |
# terms governing use, modification, and redistribution, is contained in |
| 7 |
# the COPYING file, which can be found at the root of the source code |
| 8 |
# distribution tree, or in https://www.hdfgroup.org/licenses. |
| 9 |
# If you do not have access to either file, you may request a copy from |
| 10 |
# [email protected]. |
| 11 |
# |
| 12 |
#[[ ITK --start |
| 13 |
cmake_minimum_required (VERSION 3.12) |
| 14 |
# ITK --stop ]] |
| 15 |
############################################################################################################### |
| 16 |
# This script will build and run the examples from a folder |
| 17 |
# Execute from a command line: |
| 18 |
# ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log |
| 19 |
############################################################################################################### |
| 20 |
|
| 21 |
set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") |
| 22 |
if("@CMAKE_GENERATOR_TOOLSET@") |
| 23 |
set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") |
| 24 |
endif() |
| 25 |
if("@CMAKE_GENERATOR_ARCHITECTURE@") |
| 26 |
set(CMAKE_GENERATOR_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@") |
| 27 |
endif() |
| 28 |
set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) |
| 29 |
|
| 30 |
# handle input parameters to script. |
| 31 |
#INSTALLDIR - HDF5 root folder |
| 32 |
#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo |
| 33 |
#CTEST_SOURCE_NAME - name of source folder; HDF5Examples |
| 34 |
if(DEFINED CTEST_SCRIPT_ARG) |
| 35 |
# transform ctest script arguments of the form |
| 36 |
# script.ctest,var1=value1,var2=value2 |
| 37 |
# to variables with the respective names set to the respective values |
| 38 |
string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") |
| 39 |
foreach(current_var ${script_args}) |
| 40 |
if("${current_var}" MATCHES "^([^=]+)=(.+)$") |
| 41 |
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") |
| 42 |
endif() |
| 43 |
endforeach() |
| 44 |
endif() |
| 45 |
|
| 46 |
################################################################### |
| 47 |
### Following Line is one of [Release, RelWithDebInfo, Debug] ##### |
| 48 |
set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") |
| 49 |
if(NOT DEFINED CTEST_CONFIGURATION_TYPE) |
| 50 |
set(CTEST_CONFIGURATION_TYPE "Release") |
| 51 |
endif() |
| 52 |
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${CTEST_CONFIGURATION_TYPE}") |
| 53 |
################################################################## |
| 54 |
|
| 55 |
if(NOT DEFINED INSTALLDIR) |
| 56 |
if(WIN32) |
| 57 |
set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") |
| 58 |
else() |
| 59 |
set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") |
| 60 |
endif() |
| 61 |
endif() |
| 62 |
|
| 63 |
if(NOT DEFINED CTEST_SOURCE_NAME) |
| 64 |
set(CTEST_SOURCE_NAME "HDF5Examples") |
| 65 |
endif() |
| 66 |
|
| 67 |
if(NOT DEFINED HDF_LOCAL) |
| 68 |
set(CDASH_LOCAL "NO") |
| 69 |
else() |
| 70 |
set(CDASH_LOCAL "YES") |
| 71 |
endif() |
| 72 |
if(NOT DEFINED CTEST_SITE) |
| 73 |
set(CTEST_SITE "local") |
| 74 |
endif() |
| 75 |
if(NOT DEFINED CTEST_BUILD_NAME) |
| 76 |
set(CTEST_BUILD_NAME "examples") |
| 77 |
endif() |
| 78 |
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") |
| 79 |
|
| 80 |
#TAR_SOURCE - name of tarfile |
| 81 |
#if(NOT DEFINED TAR_SOURCE) |
| 82 |
# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.12.7-Source") |
| 83 |
#endif() |
| 84 |
|
| 85 |
############################################################################################################### |
| 86 |
if(WIN32) |
| 87 |
set(SITE_OS_NAME "Windows") |
| 88 |
set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") |
| 89 |
set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) |
| 90 |
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") |
| 91 |
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") |
| 92 |
else() |
| 93 |
set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") |
| 94 |
set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") |
| 95 |
set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) |
| 96 |
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") |
| 97 |
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") |
| 98 |
endif() |
| 99 |
if(${CDASH_LOCAL}) |
| 100 |
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON") |
| 101 |
endif() |
| 102 |
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") |
| 103 |
|
| 104 |
############################################################################################################### |
| 105 |
# For any comments please contact [email protected] |
| 106 |
# |
| 107 |
############################################################################################################### |
| 108 |
|
| 109 |
if(WIN32) |
| 110 |
include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake) |
| 111 |
include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) |
| 112 |
else() |
| 113 |
include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake) |
| 114 |
include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) |
| 115 |
endif() |