Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
usCTestScript.cmake
Go to the documentation of this file.
1 
2 macro(build_and_test)
3 
4  set(CTEST_SOURCE_DIRECTORY ${US_SOURCE_DIR})
5  set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_PROJECT_NAME}_${CTEST_DASHBOARD_NAME}")
6 
7  #if(NOT CTEST_BUILD_NAME)
8  # set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}_${CTEST_COMPILER}_${CTEST_DASHBOARD_NAME}")
9  #endif()
10 
11  ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
12 
13  ctest_start("Experimental")
14 
15  if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
16  file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${CTEST_INITIAL_CACHE}")
17  endif()
18 
19  ctest_configure(RETURN_VALUE res)
20  if (res)
21  message(FATAL_ERROR "CMake configure error")
22  endif()
23  ctest_build(RETURN_VALUE res)
24  if (res)
25  message(FATAL_ERROR "CMake build error")
26  endif()
27 
28  ctest_test(RETURN_VALUE res PARALLEL_LEVEL ${CTEST_PARALLEL_LEVEL})
29  if (res)
30  message(FATAL_ERROR "CMake test error")
31  endif()
32 
33 
34  if(WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
35  ctest_memcheck()
36  endif()
37 
38  if(WITH_COVERAGE AND CTEST_COVERAGE_COMMAND)
39  ctest_coverage()
40  endif()
41 
42  #ctest_submit()
43 
44 endmacro()
45 
46 function(create_initial_cache var _shared _threading _autoload)
47 
48  set(_initial_cache "
49  US_BUILD_TESTING:BOOL=ON
50  US_BUILD_SHARED_LIBS:BOOL=${_shared}
51  US_ENABLE_THREADING_SUPPORT:BOOL=${_threading}
52  US_ENABLE_AUTOLOADING_SUPPORT:BOOL=${_autoload}
53  ")
54  if(_shared)
55  set(_initial_cache "${_initial_cache} US_BUILD_EXAMPLES:BOOL=ON
56  ")
57  endif()
58 
59  set(${var} ${_initial_cache} PARENT_SCOPE)
60 
61  if(_shared)
62  set(CTEST_DASHBOARD_NAME "shared")
63  else()
64  set(CTEST_DASHBOARD_NAME "static")
65  endif()
66 
67  if(_threading)
68  set(CTEST_DASHBOARD_NAME "${CTEST_DASHBOARD_NAME}-threading")
69  endif()
70  if(_autoload)
71  set(CTEST_DASHBOARD_NAME "${CTEST_DASHBOARD_NAME}-autoloading")
72  endif()
73 
74  set(CTEST_DASHBOARD_NAME "${CTEST_DASHBOARD_NAME} (${_generator})" PARENT_SCOPE)
75 
76 endfunction()
77 
78 #=========================================================
79 
80 set(CTEST_PROJECT_NAME CppMicroServices)
81 
82 if(NOT CTEST_PARALLEL_LEVEL)
83  set(CTEST_PARALLEL_LEVEL 1)
84 endif()
85 
86 
87 # SHARED THREADING AUTOLOAD
88 
89 set(config0 0 0 0 )
90 set(config1 0 0 1 )
91 set(config2 0 1 0 )
92 set(config3 0 1 1 )
93 set(config4 1 0 0 )
94 set(config5 1 0 1 )
95 set(config6 1 1 0 )
96 set(config7 1 1 1 )
97 
98 if(NOT US_CMAKE_GENERATOR)
99  set(US_CMAKE_GENERATOR "Unix Makefiles")
100 endif()
101 
102 foreach (_generator ${US_CMAKE_GENERATOR})
103  set(CTEST_CMAKE_GENERATOR ${_generator})
104  foreach(i ${US_BUILD_CONFIGURATION})
105  create_initial_cache(CTEST_INITIAL_CACHE ${config${i}})
106  message("Testing build configuration: ${CTEST_DASHBOARD_NAME}")
107  build_and_test()
108  endforeach()
109 endforeach()
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:32
build_and_test()