CircleCI_CTK_Docker.cmake 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. if( NOT "${CTK_QT_VERSION}" MATCHES "4|5" )
  24. message( FATAL_ERROR "CTK_QT_VERSION should be set to either 4 or 5" )
  25. endif()
  26. set( CTK_SOURCE_DIR "/usr/src/CTK" )
  27. set( CTK_BINARY_DIR "/usr/src/CTK-build" )
  28. set( CTEST_SOURCE_DIRECTORY "${CTK_SOURCE_DIR}" )
  29. set( CTEST_BINARY_DIRECTORY "${CTK_BINARY_DIR}/CTK-build" )
  30. #############
  31. set( SITE_CTEST_MODE "Experimental" ) # Experimental, Continuous, or Nightly
  32. set( CTEST_CMAKE_GENERATOR "Unix Makefiles" ) # Ninja or Unix Makefiles
  33. set( CTK_GIT_REPOSITORY "https://github.com/commontk/CTK.git" )
  34. # Follow format for caps and components as given on CTK dashboard
  35. set( CTEST_SITE "CircleCI_CTK" )
  36. # Follow format for caps and components as given on CTK dashboard
  37. set( SITE_PLATFORM "Ubuntu-64" )
  38. # Use SITE_BUILD_TYPE specified by circle.yml
  39. set( SITE_BUILD_TYPE "$ENV{SITE_BUILD_TYPE}" )
  40. if( NOT( (SITE_BUILD_TYPE MATCHES "Debug") OR (SITE_BUILD_TYPE MATCHES "Release") ) )
  41. set( SITE_BUILD_TYPE "Debug" ) # Release, Debug
  42. endif()
  43. # Named SITE_BUILD_NAME
  44. string( SUBSTRING $ENV{CIRCLE_SHA1} 0 7 commit )
  45. set( what $ENV{CIRCLE_BRANCH} )
  46. set( SITE_BUILD_NAME_SUFFIX _${commit}_${what} )
  47. set( SITE_BUILD_NAME "CircleCI-${SITE_PLATFORM}-${SITE_BUILD_TYPE}${SITE_BUILD_NAME_SUFFIX}" )
  48. set( CTEST_BUILD_NAME "${SITE_BUILD_NAME}-BuildTest-Qt${CTK_QT_VERSION}-${SITE_CTEST_MODE}" )
  49. ###################
  50. set( CTEST_CONFIGURATION_TYPE "${SITE_BUILD_TYPE}")
  51. set( CMAKE_BUILD_TYPE "${SITE_BUILD_TYPE}")
  52. set( BUILD_TESTING ON )
  53. set( CTK_BUILD_EXAMPLES OFF )
  54. # Disable MIT_SHM X11 extension
  55. set( ENV{QT_X11_NO_MITSHM} 1 )
  56. ###################
  57. set(ctk_configure_options
  58. -DCTK_QT_VERSION:STRING=${CTK_QT_VERSION}
  59. -DCTK_ENABLE_Widgets:BOOL=ON
  60. )
  61. ctest_start( "${SITE_CTEST_MODE}" )
  62. ctest_configure(
  63. BUILD "${CTK_BINARY_DIR}"
  64. SOURCE "${CTK_SOURCE_DIR}"
  65. OPTIONS "${ctk_configure_options}"
  66. )
  67. ctest_build( BUILD ${CTK_BINARY_DIR} )
  68. ctest_test(
  69. BUILD ${CTEST_BINARY_DIRECTORY}
  70. RETURN_VALUE result
  71. )
  72. ctest_submit()
  73. if(result)
  74. message(FATAL_ERROR "ERROR: Tests failed")
  75. endif()