You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
7.2 KiB

  1. ####################################################################
  2. #
  3. # Usage:
  4. # - create a new folder, let's call it cdash
  5. # - in that folder, do:
  6. # ctest -S path/to/eigen2/test/testsuite.cmake[,option1=value1[,option2=value2]]
  7. #
  8. # Options:
  9. # - EIGEN_CXX: compiler, eg.: g++-4.2
  10. # default: default c++ compiler
  11. # - EIGEN_SITE: eg, INRIA-Bdx_pc-gael, or the name of the contributor, etc.
  12. # default: hostname
  13. # - EIGEN_BUILD_STRING: a string which identify the system/compiler. It should be formed like that:
  14. # <OS_name>-<OS_version>-<arch>-<compiler-version>
  15. # with:
  16. # <OS_name> = opensuse, debian, osx, windows, cygwin, freebsd, solaris, etc.
  17. # <OS_version> = 11.1, XP, vista, leopard, etc.
  18. # <arch> = i386, x86_64, ia64, powerpc, etc.
  19. # <compiler-version> = gcc-4.3.2, icc-11.0, MSVC-2008, etc.
  20. # - EIGEN_EXPLICIT_VECTORIZATION: novec, SSE2, Altivec
  21. # default: SSE2 for x86_64 systems, novec otherwise
  22. # Its value is automatically appended to EIGEN_BUILD_STRING
  23. # - EIGEN_CMAKE_DIR: path to cmake executable
  24. # - EIGEN_MODE: dashboard model, can be Experimental, Nightly, or Continuous
  25. # default: Nightly
  26. # - EIGEN_WORK_DIR: directory used to download the source files and make the builds
  27. # default: folder which contains this script
  28. # - EIGEN_CMAKE_ARGS: additional arguments passed to cmake
  29. # - CTEST_SOURCE_DIRECTORY: path to eigen's src (use a new and empty folder, not the one you are working on)
  30. # default: <EIGEN_WORK_DIR>/src
  31. # - CTEST_BINARY_DIRECTORY: build directory
  32. # default: <EIGEN_WORK_DIR>/nightly-<EIGEN_CXX>
  33. #
  34. # Here is an example running several compilers on a linux system:
  35. # #!/bin/bash
  36. # ARCH=`uname -m`
  37. # SITE=`hostname`
  38. # VERSION=opensuse-11.1
  39. # WORK_DIR=/home/gael/Coding/eigen2/cdash
  40. # # get the last version of the script
  41. # wget http://bitbucket.org/eigen/eigen/raw/tip/test/testsuite.cmake -o $WORK_DIR/testsuite.cmake
  42. # COMMON="ctest -S $WORK_DIR/testsuite.cmake,EIGEN_WORK_DIR=$WORK_DIR,EIGEN_SITE=$SITE,EIGEN_MODE=$1,EIGEN_BUILD_STRING=$OS_VERSION-$ARCH"
  43. # $COMMON-gcc-3.4.6,EIGEN_CXX=g++-3.4
  44. # $COMMON-gcc-4.0.1,EIGEN_CXX=g++-4.0.1
  45. # $COMMON-gcc-4.3.2,EIGEN_CXX=g++-4.3,EIGEN_EXPLICIT_VECTORIZATION=novec
  46. # $COMMON-gcc-4.3.2,EIGEN_CXX=g++-4.3,EIGEN_EXPLICIT_VECTORIZATION=SSE2
  47. # $COMMON-icc-11.0,EIGEN_CXX=icpc
  48. #
  49. ####################################################################
  50. # process the arguments
  51. set(ARGLIST ${CTEST_SCRIPT_ARG})
  52. while(${ARGLIST} MATCHES ".+.*")
  53. # pick first
  54. string(REGEX MATCH "([^,]*)(,.*)?" DUMMY ${ARGLIST})
  55. SET(TOP ${CMAKE_MATCH_1})
  56. # remove first
  57. string(REGEX MATCHALL "[^,]*,(.*)" DUMMY ${ARGLIST})
  58. SET(ARGLIST ${CMAKE_MATCH_1})
  59. # decompose as a pair key=value
  60. string(REGEX MATCH "([^=]*)(=.*)?" DUMMY ${TOP})
  61. SET(KEY ${CMAKE_MATCH_1})
  62. string(REGEX MATCH "[^=]*=(.*)" DUMMY ${TOP})
  63. SET(VALUE ${CMAKE_MATCH_1})
  64. # set the variable to the specified value
  65. if(VALUE)
  66. SET(${KEY} ${VALUE})
  67. else(VALUE)
  68. SET(${KEY} ON)
  69. endif(VALUE)
  70. endwhile(${ARGLIST} MATCHES ".+.*")
  71. ####################################################################
  72. # Automatically set some user variables if they have not been defined manually
  73. ####################################################################
  74. cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
  75. if(NOT EIGEN_SITE)
  76. site_name(EIGEN_SITE)
  77. endif(NOT EIGEN_SITE)
  78. if(NOT EIGEN_CMAKE_DIR)
  79. SET(EIGEN_CMAKE_DIR "")
  80. endif(NOT EIGEN_CMAKE_DIR)
  81. if(NOT EIGEN_BUILD_STRING)
  82. # let's try to find all information we need to make the build string ourself
  83. # OS
  84. build_name(EIGEN_OS_VERSION)
  85. # arch
  86. set(EIGEN_ARCH ${CMAKE_SYSTEM_PROCESSOR})
  87. if(WIN32)
  88. set(EIGEN_ARCH $ENV{PROCESSOR_ARCHITECTURE})
  89. else(WIN32)
  90. execute_process(COMMAND uname -m OUTPUT_VARIABLE EIGEN_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
  91. endif(WIN32)
  92. set(EIGEN_BUILD_STRING ${EIGEN_OS_VERSION}${EIGEN_ARCH}-${EIGEN_CXX})
  93. endif(NOT EIGEN_BUILD_STRING)
  94. if(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
  95. set(EIGEN_BUILD_STRING ${EIGEN_BUILD_STRING}-${EIGEN_EXPLICIT_VECTORIZATION})
  96. endif(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
  97. if(NOT EIGEN_WORK_DIR)
  98. set(EIGEN_WORK_DIR ${CTEST_SCRIPT_DIRECTORY})
  99. endif(NOT EIGEN_WORK_DIR)
  100. if(NOT CTEST_SOURCE_DIRECTORY)
  101. SET (CTEST_SOURCE_DIRECTORY "${EIGEN_WORK_DIR}/src")
  102. endif(NOT CTEST_SOURCE_DIRECTORY)
  103. if(NOT CTEST_BINARY_DIRECTORY)
  104. SET (CTEST_BINARY_DIRECTORY "${EIGEN_WORK_DIR}/nightly_${EIGEN_CXX}")
  105. endif(NOT CTEST_BINARY_DIRECTORY)
  106. if(NOT EIGEN_MODE)
  107. set(EIGEN_MODE Nightly)
  108. endif(NOT EIGEN_MODE)
  109. ## mandatory variables (the default should be ok in most cases):
  110. SET (CTEST_CVS_COMMAND "hg")
  111. SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone -r 2.0 http://bitbucket.org/eigen/eigen \"${CTEST_SOURCE_DIRECTORY}\"")
  112. # which ctest command to use for running the dashboard
  113. SET (CTEST_COMMAND "${EIGEN_CMAKE_DIR}ctest -D ${EIGEN_MODE}")
  114. # what cmake command to use for configuring this dashboard
  115. SET (CTEST_CMAKE_COMMAND "${EIGEN_CMAKE_DIR}cmake -DEIGEN_BUILD_TESTS=on ")
  116. ####################################################################
  117. # The values in this section are optional you can either
  118. # have them or leave them commented out
  119. ####################################################################
  120. # this make sure we get consistent outputs
  121. SET($ENV{LC_MESSAGES} "en_EN")
  122. # should ctest wipe the binary tree before running
  123. SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
  124. SET(CTEST_BACKUP_AND_RESTORE TRUE)
  125. # this is the initial cache to use for the binary tree, be careful to escape
  126. # any quotes inside of this string if you use it
  127. if(WIN32 AND NOT UNIX)
  128. #message(SEND_ERROR "win32")
  129. set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -G \"NMake Makefiles\" -DCMAKE_MAKE_PROGRAM=nmake")
  130. SET (CTEST_INITIAL_CACHE "
  131. MAKECOMMAND:STRING=nmake -i
  132. CMAKE_MAKE_PROGRAM:FILEPATH=nmake
  133. CMAKE_GENERATOR:INTERNAL=NMake Makefiles
  134. BUILDNAME:STRING=${EIGEN_BUILD_STRING}
  135. SITE:STRING=${EIGEN_SITE}
  136. ")
  137. else(WIN32 AND NOT UNIX)
  138. SET (CTEST_INITIAL_CACHE "
  139. BUILDNAME:STRING=${EIGEN_BUILD_STRING}
  140. SITE:STRING=${EIGEN_SITE}
  141. ")
  142. endif(WIN32 AND NOT UNIX)
  143. # set any extra environment variables to use during the execution of the script here:
  144. if(EIGEN_CXX)
  145. set(CTEST_ENVIRONMENT "CXX=${EIGEN_CXX}")
  146. endif(EIGEN_CXX)
  147. if(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
  148. if(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
  149. set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON")
  150. elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE3)
  151. set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON -DEIGEN_TEST_SSE3=ON")
  152. elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES Altivec)
  153. set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_ALTIVEC=ON")
  154. elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES novec)
  155. set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_NO_EXPLICIT_VECTORIZATION=ON")
  156. else(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
  157. message(FATAL_ERROR "Invalid value for EIGEN_EXPLICIT_VECTORIZATION (${EIGEN_EXPLICIT_VECTORIZATION}), must be: novec, SSE2, SSE3, Altivec")
  158. endif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
  159. endif(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
  160. if(DEFINED EIGEN_CMAKE_ARGS)
  161. set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} ${EIGEN_CMAKE_ARGS}")
  162. endif(DEFINED EIGEN_CMAKE_ARGS)