1 2#################################################################### 3# 4# Usage: 5# - create a new folder, let's call it cdash 6# - in that folder, do: 7# ctest -S path/to/eigen/test/testsuite.cmake[,option1=value1[,option2=value2]] 8# 9# Options: 10# - EIGEN_CXX: compiler, eg.: g++-4.2 11# default: default c++ compiler 12# - EIGEN_SITE: eg, INRIA-Bdx_pc-gael, or the name of the contributor, etc. 13# default: hostname 14# - EIGEN_BUILD_STRING: a string which identify the system/compiler. It should be formed like that: 15# <OS_name>-<OS_version>-<arch>-<compiler-version> 16# with: 17# <OS_name> = opensuse, debian, osx, windows, cygwin, freebsd, solaris, etc. 18# <OS_version> = 11.1, XP, vista, leopard, etc. 19# <arch> = i386, x86_64, ia64, powerpc, etc. 20# <compiler-version> = gcc-4.3.2, icc-11.0, MSVC-2008, etc. 21# - EIGEN_EXPLICIT_VECTORIZATION: novec, SSE2, Altivec 22# default: SSE2 for x86_64 systems, novec otherwise 23# Its value is automatically appended to EIGEN_BUILD_STRING 24# - EIGEN_CMAKE_DIR: path to cmake executable 25# - EIGEN_MODE: dashboard model, can be Experimental, Nightly, or Continuous 26# default: Nightly 27# - EIGEN_WORK_DIR: directory used to download the source files and make the builds 28# default: folder which contains this script 29# - EIGEN_CMAKE_ARGS: additional arguments passed to cmake 30# - EIGEN_GENERATOR_TYPE: allows to overwrite the generator type 31# default: nmake (windows 32# See http://www.cmake.org/cmake/help/cmake2.6docs.html#section_Generators for a complete 33# list of supported generators. 34# - EIGEN_NO_UPDATE: allows to submit dash boards from local repositories 35# This might be interesting in case you want to submit dashboards 36# including local changes. 37# - CTEST_SOURCE_DIRECTORY: path to eigen's src (use a new and empty folder, not the one you are working on) 38# default: <EIGEN_WORK_DIR>/src 39# - CTEST_BINARY_DIRECTORY: build directory 40# default: <EIGEN_WORK_DIR>/nightly-<EIGEN_CXX> 41# 42# Here is an example running several compilers on a linux system: 43# #!/bin/bash 44# ARCH=`uname -m` 45# SITE=`hostname` 46# VERSION=opensuse-11.1 47# WORK_DIR=/home/gael/Coding/eigen/cdash 48# # get the last version of the script 49# wget http://bitbucket.org/eigen/eigen/raw/tip/test/testsuite.cmake -o $WORK_DIR/testsuite.cmake 50# COMMON="ctest -S $WORK_DIR/testsuite.cmake,EIGEN_WORK_DIR=$WORK_DIR,EIGEN_SITE=$SITE,EIGEN_MODE=$1,EIGEN_BUILD_STRING=$OS_VERSION-$ARCH" 51# $COMMON-gcc-3.4.6,EIGEN_CXX=g++-3.4 52# $COMMON-gcc-4.0.1,EIGEN_CXX=g++-4.0.1 53# $COMMON-gcc-4.3.2,EIGEN_CXX=g++-4.3,EIGEN_EXPLICIT_VECTORIZATION=novec 54# $COMMON-gcc-4.3.2,EIGEN_CXX=g++-4.3,EIGEN_EXPLICIT_VECTORIZATION=SSE2 55# $COMMON-icc-11.0,EIGEN_CXX=icpc 56# 57#################################################################### 58 59# process the arguments 60 61set(ARGLIST ${CTEST_SCRIPT_ARG}) 62while(${ARGLIST} MATCHES ".+.*") 63 64 # pick first 65 string(REGEX MATCH "([^,]*)(,.*)?" DUMMY ${ARGLIST}) 66 SET(TOP ${CMAKE_MATCH_1}) 67 68 # remove first 69 string(REGEX MATCHALL "[^,]*,(.*)" DUMMY ${ARGLIST}) 70 SET(ARGLIST ${CMAKE_MATCH_1}) 71 72 # decompose as a pair key=value 73 string(REGEX MATCH "([^=]*)(=.*)?" DUMMY ${TOP}) 74 SET(KEY ${CMAKE_MATCH_1}) 75 76 string(REGEX MATCH "[^=]*=(.*)" DUMMY ${TOP}) 77 SET(VALUE ${CMAKE_MATCH_1}) 78 79 # set the variable to the specified value 80 if(VALUE) 81 SET(${KEY} ${VALUE}) 82 else(VALUE) 83 SET(${KEY} ON) 84 endif(VALUE) 85 86endwhile(${ARGLIST} MATCHES ".+.*") 87 88#################################################################### 89# Automatically set some user variables if they have not been defined manually 90#################################################################### 91cmake_minimum_required(VERSION 2.6 FATAL_ERROR) 92 93if(NOT EIGEN_SITE) 94 site_name(EIGEN_SITE) 95endif(NOT EIGEN_SITE) 96 97if(NOT EIGEN_CMAKE_DIR) 98 SET(EIGEN_CMAKE_DIR "") 99endif(NOT EIGEN_CMAKE_DIR) 100 101if(NOT EIGEN_BUILD_STRING) 102 103 # let's try to find all information we need to make the build string ourself 104 105 # OS 106 build_name(EIGEN_OS_VERSION) 107 108 # arch 109 set(EIGEN_ARCH ${CMAKE_SYSTEM_PROCESSOR}) 110 if(WIN32) 111 set(EIGEN_ARCH $ENV{PROCESSOR_ARCHITECTURE}) 112 else(WIN32) 113 execute_process(COMMAND uname -m OUTPUT_VARIABLE EIGEN_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) 114 endif(WIN32) 115 116 set(EIGEN_BUILD_STRING ${EIGEN_OS_VERSION}${EIGEN_ARCH}-${EIGEN_CXX}) 117 118endif(NOT EIGEN_BUILD_STRING) 119 120if(DEFINED EIGEN_EXPLICIT_VECTORIZATION) 121 set(EIGEN_BUILD_STRING ${EIGEN_BUILD_STRING}-${EIGEN_EXPLICIT_VECTORIZATION}) 122endif(DEFINED EIGEN_EXPLICIT_VECTORIZATION) 123 124if(NOT EIGEN_WORK_DIR) 125 set(EIGEN_WORK_DIR ${CTEST_SCRIPT_DIRECTORY}) 126endif(NOT EIGEN_WORK_DIR) 127 128if(NOT CTEST_SOURCE_DIRECTORY) 129 SET (CTEST_SOURCE_DIRECTORY "${EIGEN_WORK_DIR}/src") 130endif(NOT CTEST_SOURCE_DIRECTORY) 131 132if(NOT CTEST_BINARY_DIRECTORY) 133 SET (CTEST_BINARY_DIRECTORY "${EIGEN_WORK_DIR}/nightly_${EIGEN_CXX}") 134endif(NOT CTEST_BINARY_DIRECTORY) 135 136if(NOT EIGEN_MODE) 137 set(EIGEN_MODE Nightly) 138endif(NOT EIGEN_MODE) 139 140## mandatory variables (the default should be ok in most cases): 141 142if(NOT EIGEN_NO_UPDATE) 143 SET (CTEST_CVS_COMMAND "hg") 144 SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone http://bitbucket.org/eigen/eigen \"${CTEST_SOURCE_DIRECTORY}\"") 145 SET(CTEST_BACKUP_AND_RESTORE TRUE) # the backup is CVS related ... 146endif(NOT EIGEN_NO_UPDATE) 147 148# which ctest command to use for running the dashboard 149SET (CTEST_COMMAND "${EIGEN_CMAKE_DIR}ctest -D ${EIGEN_MODE} --no-compress-output") 150if($ENV{EIGEN_CTEST_ARGS}) 151SET (CTEST_COMMAND "${CTEST_COMMAND} $ENV{EIGEN_CTEST_ARGS}") 152endif($ENV{EIGEN_CTEST_ARGS}) 153# what cmake command to use for configuring this dashboard 154SET (CTEST_CMAKE_COMMAND "${EIGEN_CMAKE_DIR}cmake -DEIGEN_LEAVE_TEST_IN_ALL_TARGET=ON") 155 156#################################################################### 157# The values in this section are optional you can either 158# have them or leave them commented out 159#################################################################### 160 161# this make sure we get consistent outputs 162SET($ENV{LC_MESSAGES} "en_EN") 163 164# should ctest wipe the binary tree before running 165SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) 166 167# raise the warning/error limit 168set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "33331") 169set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "33331") 170 171# this is the initial cache to use for the binary tree, be careful to escape 172# any quotes inside of this string if you use it 173if(WIN32 AND NOT UNIX) 174 #message(SEND_ERROR "win32") 175 if(EIGEN_GENERATOR_TYPE) 176 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -G \"${EIGEN_GENERATOR_TYPE}\"") 177 SET (CTEST_INITIAL_CACHE " 178 CMAKE_BUILD_TYPE:STRING=Release 179 BUILDNAME:STRING=${EIGEN_BUILD_STRING} 180 SITE:STRING=${EIGEN_SITE} 181 ") 182 else(EIGEN_GENERATOR_TYPE) 183 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -G \"NMake Makefiles\" -DCMAKE_MAKE_PROGRAM=nmake") 184 SET (CTEST_INITIAL_CACHE " 185 MAKECOMMAND:STRING=nmake /i 186 CMAKE_MAKE_PROGRAM:FILEPATH=nmake 187 CMAKE_GENERATOR:INTERNAL=NMake Makefiles 188 CMAKE_BUILD_TYPE:STRING=Release 189 BUILDNAME:STRING=${EIGEN_BUILD_STRING} 190 SITE:STRING=${EIGEN_SITE} 191 ") 192 endif(EIGEN_GENERATOR_TYPE) 193else(WIN32 AND NOT UNIX) 194 SET (CTEST_INITIAL_CACHE " 195 BUILDNAME:STRING=${EIGEN_BUILD_STRING} 196 SITE:STRING=${EIGEN_SITE} 197 ") 198endif(WIN32 AND NOT UNIX) 199 200# set any extra environment variables to use during the execution of the script here: 201# setting this variable on windows machines causes trouble ... 202 203if(EIGEN_CXX AND NOT WIN32) 204 set(CTEST_ENVIRONMENT "CXX=${EIGEN_CXX}") 205endif(EIGEN_CXX AND NOT WIN32) 206 207if(DEFINED EIGEN_EXPLICIT_VECTORIZATION) 208 if(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2) 209 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON") 210 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE3) 211 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON -DEIGEN_TEST_SSE3=ON") 212 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSSE3) 213 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON -DEIGEN_TEST_SSE3=ON -DEIGEN_TEST_SSSE3=ON") 214 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE4_1) 215 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON -DEIGEN_TEST_SSE3=ON -DEIGEN_TEST_SSSE3=ON -DEIGEN_TEST_SSE4_1=ON") 216 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE4_2) 217 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON -DEIGEN_TEST_SSE3=ON -DEIGEN_TEST_SSSE3=ON -DEIGEN_TEST_SSE4_1=ON -DEIGEN_TEST_SSE4_2=ON") 218 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES Altivec) 219 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_ALTIVEC=ON") 220 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES novec) 221 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_NO_EXPLICIT_VECTORIZATION=ON") 222 else(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2) 223 message(FATAL_ERROR "Invalid value for EIGEN_EXPLICIT_VECTORIZATION (${EIGEN_EXPLICIT_VECTORIZATION}), must be: novec, SSE2, SSE3, Altivec") 224 endif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2) 225endif(DEFINED EIGEN_EXPLICIT_VECTORIZATION) 226 227if(DEFINED EIGEN_CMAKE_ARGS) 228 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} ${EIGEN_CMAKE_ARGS}") 229endif(DEFINED EIGEN_CMAKE_ARGS) 230