summaryrefslogtreecommitdiffstats
path: root/config/cmake/HDF5_Examples.cmake.in
blob: d77e2dfb1fad58f1d5cb6d549ae498e4834053a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#
# 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://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
cmake_minimum_required (VERSION 3.12)
###############################################################################################################
# This script will build and run the examples from a folder
# Execute from a command line:
#     ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log
###############################################################################################################

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.
#INSTALLDIR - HDF5 root folder
#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF5Examples
if(DEFINED CTEST_SCRIPT_ARG)
  # transform ctest script arguments of the form
  # script.ctest,var1=value1,var2=value2
  # to variables with the respective names set to the respective values
  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()

###################################################################
### Following Line is one of [Release, RelWithDebInfo, Debug] #####
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}")
##################################################################

if(NOT DEFINED INSTALLDIR)
  if(WIN32)
    set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@")
  else()
    set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
  endif()
endif()

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()
if(NOT DEFINED CTEST_BUILD_NAME)
  set(CTEST_BUILD_NAME "examples")
endif()
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")

#TAR_SOURCE - name of tarfile
#if(NOT DEFINED TAR_SOURCE)
#  set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.3-Source")
#endif()

###############################################################################################################
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})
  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@")

###############################################################################################################
# For any comments please contact cdashhelp@hdfgroup.org
#
###############################################################################################################

if(WIN32)
  include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake)
  include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
else()
  include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake)
  include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
endif()