summaryrefslogtreecommitdiffstats
path: root/Tests/Contracts/cse-snapshot/Dashboard.cmake.in
blob: 138eb3f810b4110741c98e650ff663185dbd4ad0 (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
# This "ctest -S" script may be configured to drive a nightly dashboard on any
# Linux machine.
#
set(CTEST_BINARY_DIRECTORY "@binary_dir@")
set(CTEST_BUILD_NAME "@BUILDNAME@")
set(CTEST_SITE "@SITE@")
set(CTEST_SOURCE_DIRECTORY "@source_dir@")
set(PROCESSOR_COUNT "@PROCESSOR_COUNT@")

# Assume a Linux build, with a make that supports -j. Modify this script if
# assumption is ever invalid.
#
if(PROCESSOR_COUNT)
  set(CTEST_BUILD_FLAGS "-j${PROCESSOR_COUNT}")
endif()

set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")

message("Cleaning binary dir '${CTEST_BINARY_DIRECTORY}'")
ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")

# Intentionally no ctest_update step in this script. This script is run as a
# "Contract" test on a CMake dashboard submission using the just-built ctest
# as the driver. The download step in the Contract CMakeLists file takes care
# of setting up the source tree before calling this ctest -S script. The idea
# is that the source tree will be the same every day, so there should not be
# an "update" step for this build.

message("Configuring CSE in binary dir '${CTEST_BINARY_DIRECTORY}'")
set_property(GLOBAL PROPERTY SubProject "CSE-toplevel")
set_property(GLOBAL PROPERTY Label "CSE-toplevel")

ctest_start("Experimental")

set(CSE_TOPLEVEL_OPTIONS
  -DEXTERNAL_PROJECT_DASHBOARD_BUILD:BOOL=ON
  -DEXTERNAL_PROJECT_TESTS:BOOL=ON
  -DCSE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY}/built
  -DCSE_SUBSET:STRING=ALL
  -DCTEST_SITE:STRING=${CTEST_SITE}
)

ctest_configure(OPTIONS "${CSE_TOPLEVEL_OPTIONS}")

# The configure step produces a file listing the CSE packages and dependencies.
# This file also generates Project.xml and stores it in ${PROJECT_XML}.
#
set(subprojects "")
if(EXISTS "${CTEST_BINARY_DIRECTORY}/CSEBuildtimeDepends.cmake")
  message("Including CSEBuildtimeDepends.cmake")
  include("${CTEST_BINARY_DIRECTORY}/CSEBuildtimeDepends.cmake")
  set(subprojects ${CSE_ALL_SORTED})
  message("Submitting Project.xml")
  ctest_submit(FILES ${PROJECT_XML})
endif()

message("Submitting CSE configure results")
ctest_submit()

if(subprojects)
  message("Building by looping over subprojects...")
  foreach(subproject ${subprojects})
    message("##########  ${subproject}  ##########")
    set_property(GLOBAL PROPERTY SubProject "${subproject}")
    set_property(GLOBAL PROPERTY Label "${subproject}")
    ctest_build(TARGET "${subproject}" APPEND)
    message("Submitting ${subproject} build results")
    ctest_submit(PARTS build)
  endforeach()
else()
  message("Building all...")
  ctest_build(APPEND)
  message("Submitting build results")
  ctest_submit(PARTS build)
endif()