Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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  # See T24757.
13  # if(IS_PHABRICATOR_URL)
14  # set(url "https://phabricator.mitk.org/source/mitk/browse/${GIT_BRANCH}/CMake/mitkDetectOS.sh?view=raw")
15  # else()
16  set(url "https://raw.githubusercontent.com/MITK/MITK/master/CMake/mitkDetectOS.sh")
17  # endif()
18  set(dest "${CTEST_SCRIPT_DIRECTORY}/mitkDetectOS.sh")
19  downloadFile("${url}" "${dest}")
20  execute_process(COMMAND sh "${dest}"
21  RESULT_VARIABLE _result OUTPUT_VARIABLE _out
22  OUTPUT_STRIP_TRAILING_WHITESPACE)
23 
24  if(NOT _result)
25  set(MY_OPERATING_SYSTEM "${_out}")
26  endif()
27 endif()
28 
29 if(NOT MY_OPERATING_SYSTEM)
30  set(MY_OPERATING_SYSTEM "${CMAKE_HOST_SYSTEM}") # Windows 7, Linux-2.6.32, Darwin...
31 endif()
32 
33 site_name(CTEST_SITE)
34 
35 if(NOT DEFINED MITK_USE_Qt5)
36  set(MITK_USE_Qt5 1)
37 endif()
38 
39 if(MITK_USE_Qt5)
40  if(NOT QT_QMAKE_EXECUTABLE)
41  find_program(QT_QMAKE_EXECUTABLE NAMES qmake qmake-qt5
42  HINTS ${QT_BINARY_DIR})
43  endif()
44 
45  execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} --version
46  OUTPUT_VARIABLE MY_QT_VERSION
47  RESULT_VARIABLE qmake_error)
48  if(qmake_error)
49  message(FATAL_ERROR "Error when executing ${QT_QMAKE_EXECUTABLE} --version\n${qmake_error}")
50  endif()
51 
52  string(REGEX REPLACE ".*Qt version ([0-9.]+) .*" "\\1" MY_QT_VERSION ${MY_QT_VERSION})
53 endif()
54 
55 #
56 # Project specific properties
57 #
58 if(NOT CTEST_BUILD_NAME)
59  if(MITK_USE_Qt5)
60  set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM} ${MY_COMPILER} Qt${MY_QT_VERSION} ${CTEST_BUILD_CONFIGURATION}")
61  else()
62  set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM} ${MY_COMPILER} ${CTEST_BUILD_CONFIGURATION}")
63  endif()
64  set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}${CTEST_BUILD_NAME_SUFFIX}")
65 endif()
66 set(PROJECT_BUILD_DIR "MITK-build")
67 
68 set(CTEST_PATH "$ENV{PATH}")
69 if(WIN32)
70  if("${CTEST_CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64")
71  set(CMAKE_LIBRARY_ARCHITECTURE x64)
72  else()
73  set(CMAKE_LIBRARY_ARCHITECTURE x86)
74  endif()
75  string(SUBSTRING "${MY_COMPILER}" 2 2 vc_version)
76 
77  set(OPENCV_BIN_DIR "${CTEST_BINARY_DIRECTORY}/ep/${CMAKE_LIBRARY_ARCHITECTURE}/vc${vc_version}/bin")
78 
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  get_filename_component(_python_dir "${Python3_EXECUTABLE}" DIRECTORY)
83  list(APPEND PYTHON_BINARY_DIRS "${_python_dir}")
84 
85  set(CTEST_PATH "${CTEST_PATH};${CTEST_BINARY_DIRECTORY}/ep/bin;${QT_BINARY_DIR};${BLUEBERRY_RUNTIME_DIR};${OPENCV_BIN_DIR};${PYTHON_BINARY_DIRS}")
86 endif()
87 set(ENV{PATH} "${CTEST_PATH}")
88 
89 # If the dashscript doesn't define a GIT_REPOSITORY variable, let's define it here.
90 if(NOT DEFINED GIT_REPOSITORY OR GIT_REPOSITORY STREQUAL "")
91  set(GIT_REPOSITORY "https://phabricator.mitk.org/source/mitk.git")
92 endif()
93 
94 #
95 # Display build info
96 #
97 message("Site name: ${CTEST_SITE}")
98 message("Build name: ${CTEST_BUILD_NAME}")
99 message("Script Mode: ${SCRIPT_MODE}")
100 message("Coverage: ${WITH_COVERAGE}, MemCheck: ${WITH_MEMCHECK}")
101 
102 #
103 # Set initial cache options
104 #
105 if(CTEST_CMAKE_GENERATOR MATCHES ".*Makefiles.*")
106  set(CTEST_USE_LAUNCHERS 1)
107 else()
108  set(CTEST_USE_LAUNCHERS 0)
109 endif()
110 set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} ${CTEST_USE_LAUNCHERS})
111 
112 if(NOT DEFINED MITK_BUILD_CONFIGURATION)
113  set(MITK_BUILD_CONFIGURATION "All")
114 endif()
115 
116 if(NOT DEFINED MITK_VTK_DEBUG_LEAKS)
117  set(MITK_VTK_DEBUG_LEAKS 1)
118 endif()
119 
120 set(INITIAL_CMAKECACHE_OPTIONS "
121 SUPERBUILD_EXCLUDE_MITKBUILD_TARGET:BOOL=TRUE
122 MITK_BUILD_CONFIGURATION:STRING=${MITK_BUILD_CONFIGURATION}
123 MITK_VTK_DEBUG_LEAKS:BOOL=${MITK_VTK_DEBUG_LEAKS}
124 ${ADDITIONAL_CMAKECACHE_OPTION}
125 ")
126 
127 if(MITK_USE_Qt5)
128  set(INITIAL_CMAKECACHE_OPTIONS "${INITIAL_CMAKECACHE_OPTIONS}
129 QT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}")
130 endif()
131 
132 # Write a cache file for populating the MITK initial cache (not the superbuild cache).
133 # This can be used to provide variables which are not passed through the
134 # superbuild process to the MITK configure step)
135 if(MITK_INITIAL_CACHE)
136  set(mitk_cache_file "${CTEST_SCRIPT_DIRECTORY}/mitk_initial_cache.txt")
137  file(WRITE "${mitk_cache_file}" "${MITK_INITIAL_CACHE}")
138  set(INITIAL_CMAKECACHE_OPTIONS "${INITIAL_CMAKECACHE_OPTIONS}
139 MITK_INITIAL_CACHE_FILE:INTERNAL=${mitk_cache_file}
140 ")
141 endif()
142 
143 if(MITK_EXTENSIONS)
144  set(MITK_EXTENSION_DIRS "")
145  foreach(extension ${MITK_EXTENSIONS})
146  if(extension MATCHES "[^|]+\\|[^|]+\\|(.+)")
147  if(MITK_EXTENSION_DIRS)
148  set(MITK_EXTENSION_DIRS "${MITK_EXTENSION_DIRS};")
149  endif()
150  set(MITK_EXTENSION_DIRS "${MITK_EXTENSION_DIRS}${CTEST_DASHBOARD_ROOT}/${CMAKE_MATCH_1}")
151  endif()
152  endforeach()
153 endif()
154 
155 #
156 # Download and include dashboard driver script
157 #
158 if(IS_PHABRICATOR_URL)
159  string(REPLACE "/" "%252F" GIT_BRANCH_URL ${GIT_BRANCH})
160  set(url "https://phabricator.mitk.org/source/mitk/browse/${GIT_BRANCH_URL}/CMake/MITKDashboardDriverScript.cmake?view=raw")
161 else()
162  set(url "https://raw.githubusercontent.com/MITK/MITK/master/CMake/MITKDashboardDriverScript.cmake")
163 endif()
164 set(dest ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}.driver)
165 downloadFile("${url}" "${dest}")
166 include(${dest})
#define MITK_EXTENSION_DIRS
Definition: mitkConfig.h:10
downloadFile(url, dest)
const std::string FILEPATH