Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
MITKDashboardSetup.cmake
Go to the documentation of this file.
1 # This file is intended to be included at the end of a custom MITKDashboardScript.TEMPLATE.cmake file
2 
3 list(APPEND CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
4 
5 #
6 # Automatically determined properties
7 #
8 set(MY_OPERATING_SYSTEM )
9 
10 if(UNIX)
11  # Download a utility script
12  if(IS_PHABRICATOR_URL)
13  set(url "https://phabricator.mitk.org/source/mitk/browse/${GIT_BRANCH}/CMake/mitkDetectOS.sh?view=raw")
14  else()
15  set(url "https://raw.githubusercontent.com/MITK/MITK/master/CMake/mitkDetectOS.sh")
16  endif()
17  set(dest "${CTEST_SCRIPT_DIRECTORY}/mitkDetectOS.sh")
18  downloadFile("${url}" "${dest}")
19  execute_process(COMMAND sh "${dest}"
20  RESULT_VARIABLE _result OUTPUT_VARIABLE _out
21  OUTPUT_STRIP_TRAILING_WHITESPACE)
22 
23  if(NOT _result)
24  set(MY_OPERATING_SYSTEM "${_out}")
25  endif()
26 endif()
27 
28 if(NOT MY_OPERATING_SYSTEM)
29  set(MY_OPERATING_SYSTEM "${CMAKE_HOST_SYSTEM}") # Windows 7, Linux-2.6.32, Darwin...
30 endif()
31 
32 site_name(CTEST_SITE)
33 
34 if(NOT DEFINED MITK_USE_Qt5)
35  set(MITK_USE_Qt5 1)
36 endif()
37 
38 if(MITK_USE_Qt5)
39  if(NOT QT_QMAKE_EXECUTABLE)
40  find_program(QT_QMAKE_EXECUTABLE NAMES qmake qmake-qt5
41  HINTS ${QT_BINARY_DIR})
42  endif()
43 
44  execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} --version
45  OUTPUT_VARIABLE MY_QT_VERSION
46  RESULT_VARIABLE qmake_error)
47  if(qmake_error)
48  message(FATAL_ERROR "Error when executing ${QT_QMAKE_EXECUTABLE} --version\n${qmake_error}")
49  endif()
50 
51  string(REGEX REPLACE ".*Qt version ([0-9.]+) .*" "\\1" MY_QT_VERSION ${MY_QT_VERSION})
52 endif()
53 
54 #
55 # Project specific properties
56 #
57 if(NOT CTEST_BUILD_NAME)
58  if(MITK_USE_Qt5)
59  set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM} ${MY_COMPILER} Qt${MY_QT_VERSION} ${CTEST_BUILD_CONFIGURATION}")
60  else()
61  set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM} ${MY_COMPILER} ${CTEST_BUILD_CONFIGURATION}")
62  endif()
63  set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}${CTEST_BUILD_NAME_SUFFIX}")
64 endif()
65 set(PROJECT_BUILD_DIR "MITK-build")
66 
67 set(CTEST_PATH "$ENV{PATH}")
68 if(WIN32)
69  if("${CTEST_CMAKE_GENERATOR}" MATCHES ".*Win64")
70  set(CMAKE_LIBRARY_ARCHITECTURE x64)
71  else()
72  set(CMAKE_LIBRARY_ARCHITECTURE x86)
73  endif()
74  string(SUBSTRING "${MY_COMPILER}" 2 2 vc_version)
75 
76  set(OPENCV_BIN_DIR "${CTEST_BINARY_DIRECTORY}/ep/${CMAKE_LIBRARY_ARCHITECTURE}/vc${vc_version}/bin")
77 
78  set(SOFA_BINARY_DIR "${CTEST_BINARY_DIRECTORY}/ep/src/SOFA-build/bin/${CTEST_BUILD_CONFIGURATION}")
79  set(BLUEBERRY_RUNTIME_DIR "${CTEST_BINARY_DIRECTORY}/MITK-build/bin/plugins/${CTEST_BUILD_CONFIGURATION}")
80 
81  set(PYTHON_BINARY_DIRS "${CTEST_BINARY_DIRECTORY}/ep/src/CTK-build/CMakeExternals/Install/bin")
82  list(APPEND PYTHON_BINARY_DIRS "${CTEST_BINARY_DIRECTORY}/ep/lib/python2.7/bin")
83 
84  set(CTEST_PATH "${CTEST_PATH};${CTEST_BINARY_DIRECTORY}/ep/bin;${QT_BINARY_DIR};${SOFA_BINARY_DIR};${BLUEBERRY_RUNTIME_DIR};${OPENCV_BIN_DIR};${PYTHON_BINARY_DIRS}")
85 endif()
86 set(ENV{PATH} "${CTEST_PATH}")
87 
88 # If the dashscript doesn't define a GIT_REPOSITORY variable, let's define it here.
89 if(NOT DEFINED GIT_REPOSITORY OR GIT_REPOSITORY STREQUAL "")
90  set(GIT_REPOSITORY "https://phabricator.mitk.org/source/mitk.git")
91 endif()
92 
93 #
94 # Display build info
95 #
96 message("Site name: ${CTEST_SITE}")
97 message("Build name: ${CTEST_BUILD_NAME}")
98 message("Script Mode: ${SCRIPT_MODE}")
99 message("Coverage: ${WITH_COVERAGE}, MemCheck: ${WITH_MEMCHECK}")
100 
101 #
102 # Set initial cache options
103 #
104 if(CTEST_CMAKE_GENERATOR MATCHES ".*Makefiles.*")
105  set(CTEST_USE_LAUNCHERS 1)
106 else()
107  set(CTEST_USE_LAUNCHERS 0)
108 endif()
109 set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} ${CTEST_USE_LAUNCHERS})
110 
111 # Remove this if block after all dartclients work
112 if(DEFINED ADDITIONNAL_CMAKECACHE_OPTION)
113  message(WARNING "Rename ADDITIONNAL to ADDITIONAL in your dartlclient script: ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
114  set(ADDITIONAL_CMAKECACHE_OPTION ${ADDITIONNAL_CMAKECACHE_OPTION})
115 endif()
116 
117 if(NOT DEFINED MITK_BUILD_CONFIGURATION)
118  set(MITK_BUILD_CONFIGURATION "All")
119 endif()
120 
121 if(NOT DEFINED MITK_VTK_DEBUG_LEAKS)
122  set(MITK_VTK_DEBUG_LEAKS 1)
123 endif()
124 
125 set(INITIAL_CMAKECACHE_OPTIONS "
126 SUPERBUILD_EXCLUDE_MITKBUILD_TARGET:BOOL=TRUE
127 MITK_BUILD_CONFIGURATION:STRING=${MITK_BUILD_CONFIGURATION}
128 MITK_VTK_DEBUG_LEAKS:BOOL=${MITK_VTK_DEBUG_LEAKS}
129 ${ADDITIONAL_CMAKECACHE_OPTION}
130 ")
131 
132 if(MITK_USE_Qt5)
133  set(INITIAL_CMAKECACHE_OPTIONS "${INITIAL_CMAKECACHE_OPTIONS}
134 QT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}")
135 endif()
136 
137 # Write a cache file for populating the MITK initial cache (not the superbuild cache).
138 # This can be used to provide variables which are not passed through the
139 # superbuild process to the MITK configure step)
140 if(MITK_INITIAL_CACHE)
141  set(mitk_cache_file "${CTEST_SCRIPT_DIRECTORY}/mitk_initial_cache.txt")
142  file(WRITE "${mitk_cache_file}" "${MITK_INITIAL_CACHE}")
143  set(INITIAL_CMAKECACHE_OPTIONS "${INITIAL_CMAKECACHE_OPTIONS}
144 MITK_INITIAL_CACHE_FILE:INTERNAL=${mitk_cache_file}
145 ")
146 endif()
147 
148 
149 #
150 # Download and include dashboard driver script
151 #
152 if(IS_PHABRICATOR_URL)
153  set(url "https://phabricator.mitk.org/source/mitk/browse/${GIT_BRANCH}/CMake/MITKDashboardDriverScript.cmake?view=raw")
154 else()
155  set(url "https://raw.githubusercontent.com/MITK/MITK/master/CMake/MITKDashboardDriverScript.cmake")
156 endif()
157 set(dest ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}.driver)
158 downloadFile("${url}" "${dest}")
159 include(${dest})
160 
161 
downloadFile(url, dest)
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:244
const std::string FILEPATH