CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
CircleCI_CTK_Docker.cmake
Go to the documentation of this file.
1 ##############################################################################
2 #
3 # Library: CTK
4 #
5 # Copyright 2010 Kitware Inc. 28 Corporate Drive,
6 # Clifton Park, NY, 12065, USA.
7 #
8 # All rights reserved.
9 #
10 # Licensed under the Apache License, Version 2.0 (the "License");
11 # you may not use this file except in compliance with the License.
12 # You may obtain a copy of the License at
13 #
14 # http://www.apache.org/licenses/LICENSE-2.0
15 #
16 # Unless required by applicable law or agreed to in writing, software
17 # distributed under the License is distributed on an "AS IS" BASIS,
18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 # See the License for the specific language governing permissions and
20 # limitations under the License.
21 #
22 ##############################################################################
23 
24 if( NOT "${CTK_QT_VERSION}" MATCHES "4|5" )
25  message( FATAL_ERROR "CTK_QT_VERSION should be set to either 4 or 5" )
26 endif()
27 
28 set( CTK_SOURCE_DIR "/usr/src/CTK" )
29 set( CTK_BINARY_DIR "/usr/src/CTK-build" )
30 
31 set( CTEST_SOURCE_DIRECTORY "${CTK_SOURCE_DIR}" )
32 set( CTEST_BINARY_DIRECTORY "${CTK_BINARY_DIR}/CTK-build" )
33 
34 #############
35 
36 set( SITE_CTEST_MODE "Experimental" ) # Experimental, Continuous, or Nightly
37 
38 set( CTEST_CMAKE_GENERATOR "Unix Makefiles" ) # Ninja or Unix Makefiles
39 
40 set( CTK_GIT_REPOSITORY "https://github.com/commontk/CTK.git" )
41 
42 # Follow format for caps and components as given on CTK dashboard
43 set( CTEST_SITE "CircleCI_CTK" )
44 
45 # Follow format for caps and components as given on CTK dashboard
46 set( SITE_PLATFORM "Ubuntu-64" )
47 
48 # Use SITE_BUILD_TYPE specified by circle.yml
49 set( SITE_BUILD_TYPE "$ENV{SITE_BUILD_TYPE}" )
50 if( NOT( (SITE_BUILD_TYPE MATCHES "Debug") OR (SITE_BUILD_TYPE MATCHES "Release") ) )
51  set( SITE_BUILD_TYPE "Debug" ) # Release, Debug
52 endif()
53 
54 # Named SITE_BUILD_NAME
55 string( SUBSTRING $ENV{CIRCLE_SHA1} 0 7 commit )
56 set( what $ENV{CIRCLE_BRANCH} )
57 set( SITE_BUILD_NAME_SUFFIX _${commit}_${what} )
58 
59 set( SITE_BUILD_NAME "CircleCI-${SITE_PLATFORM}-${SITE_BUILD_TYPE}${SITE_BUILD_NAME_SUFFIX}" )
60 
61 set( CTEST_BUILD_NAME "${SITE_BUILD_NAME}-BuildTest-Qt${CTK_QT_VERSION}-${SITE_CTEST_MODE}" )
62 
63 ###################
64 
65 set( CTEST_CONFIGURATION_TYPE "${SITE_BUILD_TYPE}")
66 set( CMAKE_BUILD_TYPE "${SITE_BUILD_TYPE}")
67 set( BUILD_TESTING ON )
68 set( CTK_BUILD_EXAMPLES OFF )
69 
70 # Disable MIT_SHM X11 extension
71 set( ENV{QT_X11_NO_MITSHM} 1 )
72 
73 ###################
74 
75 set(ctk_configure_options
76  -DCTK_QT_VERSION:STRING=${CTK_QT_VERSION}
77  -DCTK_ENABLE_Widgets:BOOL=ON
78  )
79 
80 ctest_start( "${SITE_CTEST_MODE}" )
81 
82 ctest_configure(
83  BUILD "${CTK_BINARY_DIR}"
84  SOURCE "${CTK_SOURCE_DIR}"
85  OPTIONS "${ctk_configure_options}"
86  )
87 
88 ctest_build( BUILD ${CTK_BINARY_DIR} )
89 
90 ctest_test(
91  BUILD ${CTEST_BINARY_DIRECTORY}
92  EXCLUDE "ctkWidgetsUtilsTestGrabWidget" # See https://github.com/commontk/CTK/issues/764
93  RETURN_VALUE result
94  )
95 
96 ctest_submit()
97 
98 if(result)
99  message(FATAL_ERROR "ERROR: Tests failed")
100 endif()