2017-04-18 03:32:16 +08:00
|
|
|
#
|
|
|
|
# Copyright by The HDF Group.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
|
|
|
# the COPYING file, which can be found at the root of the source code
|
|
|
|
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
|
|
|
|
# If you do not have access to either file, you may request a copy from
|
|
|
|
# help@hdfgroup.org.
|
|
|
|
#
|
2018-03-10 02:31:58 +08:00
|
|
|
cmake_minimum_required (VERSION 3.10)
|
2015-08-06 00:37:54 +08:00
|
|
|
###############################################################################################################
|
2015-09-25 03:01:39 +08:00
|
|
|
# This script will build and run the examples from a folder
|
2015-08-06 00:37:54 +08:00
|
|
|
# Execute from a command line:
|
2017-05-31 00:33:21 +08:00
|
|
|
# ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log
|
2015-08-06 00:37:54 +08:00
|
|
|
###############################################################################################################
|
|
|
|
|
2017-05-31 00:33:21 +08:00
|
|
|
set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
|
2017-06-03 00:44:51 +08:00
|
|
|
if("@CMAKE_GENERATOR_TOOLSET@")
|
|
|
|
set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
|
2017-05-31 00:33:21 +08:00
|
|
|
endif()
|
|
|
|
set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
|
2015-09-24 04:31:50 +08:00
|
|
|
|
|
|
|
# handle input parameters to script.
|
2015-09-24 04:34:23 +08:00
|
|
|
#INSTALLDIR - HDF5 root folder
|
2016-08-23 01:22:38 +08:00
|
|
|
#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
|
2017-03-15 01:14:44 +08:00
|
|
|
#CTEST_SOURCE_NAME - name of source folder; HDF5Examples
|
2017-05-31 00:33:21 +08:00
|
|
|
if(DEFINED CTEST_SCRIPT_ARG)
|
2017-03-15 01:14:44 +08:00
|
|
|
# transform ctest script arguments of the form
|
|
|
|
# script.ctest,var1=value1,var2=value2
|
|
|
|
# to variables with the respective names set to the respective values
|
2017-05-31 00:33:21 +08:00
|
|
|
string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}")
|
|
|
|
foreach(current_var ${script_args})
|
|
|
|
if("${current_var}" MATCHES "^([^=]+)=(.+)$")
|
|
|
|
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2017-03-15 01:14:44 +08:00
|
|
|
|
|
|
|
###################################################################
|
|
|
|
### Following Line is one of [Release, RelWithDebInfo, Debug] #####
|
2017-05-31 00:33:21 +08:00
|
|
|
set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
|
|
|
|
if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
|
|
|
|
set(CTEST_CONFIGURATION_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${CTEST_CONFIGURATION_TYPE}")
|
2017-03-15 01:14:44 +08:00
|
|
|
##################################################################
|
|
|
|
|
2017-05-31 00:33:21 +08:00
|
|
|
if(NOT DEFINED INSTALLDIR)
|
2019-01-24 07:25:41 +08:00
|
|
|
if(WIN32)
|
|
|
|
set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@")
|
|
|
|
else()
|
|
|
|
set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
|
|
|
|
endif()
|
2017-05-31 00:33:21 +08:00
|
|
|
endif()
|
2017-03-15 01:14:44 +08:00
|
|
|
|
2017-05-31 00:33:21 +08:00
|
|
|
if(NOT DEFINED CTEST_SOURCE_NAME)
|
|
|
|
set(CTEST_SOURCE_NAME "HDF5Examples")
|
|
|
|
endif()
|
2017-03-15 01:14:44 +08:00
|
|
|
|
2017-05-31 00:33:21 +08:00
|
|
|
if(NOT DEFINED HDF_LOCAL)
|
|
|
|
set(CDASH_LOCAL "NO")
|
|
|
|
else()
|
|
|
|
set(CDASH_LOCAL "YES")
|
|
|
|
endif()
|
2016-09-17 04:57:28 +08:00
|
|
|
if(NOT DEFINED CTEST_SITE)
|
2017-05-31 00:33:21 +08:00
|
|
|
set(CTEST_SITE "local")
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED CTEST_BUILD_NAME)
|
|
|
|
set(CTEST_BUILD_NAME "examples")
|
|
|
|
endif()
|
2017-06-19 22:31:03 +08:00
|
|
|
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
|
2015-09-25 02:54:00 +08:00
|
|
|
|
|
|
|
#TAR_SOURCE - name of tarfile
|
2017-05-31 00:33:21 +08:00
|
|
|
#if(NOT DEFINED TAR_SOURCE)
|
2019-01-24 07:25:41 +08:00
|
|
|
# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.12.4-Source")
|
2017-05-31 00:33:21 +08:00
|
|
|
#endif()
|
2015-08-06 00:37:54 +08:00
|
|
|
|
|
|
|
###############################################################################################################
|
2017-05-31 00:33:21 +08:00
|
|
|
if(WIN32)
|
|
|
|
set(SITE_OS_NAME "Windows")
|
|
|
|
set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake")
|
|
|
|
set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build)
|
|
|
|
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}")
|
|
|
|
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}")
|
|
|
|
else()
|
|
|
|
set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake")
|
|
|
|
set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib")
|
|
|
|
set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build)
|
|
|
|
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
|
|
|
|
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
|
|
|
|
endif()
|
|
|
|
if(${CDASH_LOCAL})
|
2017-06-19 22:31:03 +08:00
|
|
|
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON")
|
2017-05-31 00:33:21 +08:00
|
|
|
endif()
|
2017-06-19 22:31:03 +08:00
|
|
|
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@")
|
2015-08-06 00:37:54 +08:00
|
|
|
|
|
|
|
###############################################################################################################
|
|
|
|
# For any comments please contact cdashhelp@hdfgroup.org
|
|
|
|
#
|
|
|
|
###############################################################################################################
|
2015-09-25 03:01:39 +08:00
|
|
|
|
2017-05-31 00:33:21 +08:00
|
|
|
if(WIN32)
|
|
|
|
include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake)
|
2019-03-29 05:37:11 +08:00
|
|
|
include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
|
2017-05-31 00:33:21 +08:00
|
|
|
else()
|
|
|
|
include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake)
|
2019-03-29 05:37:11 +08:00
|
|
|
include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
|
2017-05-31 00:33:21 +08:00
|
|
|
endif()
|