source: pacpussensors/trunk/Vislab/lib3dv/eigen/test/eigen2/testsuite.cmake@ 141

Last change on this file since 141 was 136, checked in by ldecherf, 8 years ago

Doc

File size: 7.2 KB
Line 
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/eigen2/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# - CTEST_SOURCE_DIRECTORY: path to eigen's src (use a new and empty folder, not the one you are working on)
31# default: <EIGEN_WORK_DIR>/src
32# - CTEST_BINARY_DIRECTORY: build directory
33# default: <EIGEN_WORK_DIR>/nightly-<EIGEN_CXX>
34#
35# Here is an example running several compilers on a linux system:
36# #!/bin/bash
37# ARCH=`uname -m`
38# SITE=`hostname`
39# VERSION=opensuse-11.1
40# WORK_DIR=/home/gael/Coding/eigen2/cdash
41# # get the last version of the script
42# wget http://bitbucket.org/eigen/eigen/raw/tip/test/testsuite.cmake -o $WORK_DIR/testsuite.cmake
43# COMMON="ctest -S $WORK_DIR/testsuite.cmake,EIGEN_WORK_DIR=$WORK_DIR,EIGEN_SITE=$SITE,EIGEN_MODE=$1,EIGEN_BUILD_STRING=$OS_VERSION-$ARCH"
44# $COMMON-gcc-3.4.6,EIGEN_CXX=g++-3.4
45# $COMMON-gcc-4.0.1,EIGEN_CXX=g++-4.0.1
46# $COMMON-gcc-4.3.2,EIGEN_CXX=g++-4.3,EIGEN_EXPLICIT_VECTORIZATION=novec
47# $COMMON-gcc-4.3.2,EIGEN_CXX=g++-4.3,EIGEN_EXPLICIT_VECTORIZATION=SSE2
48# $COMMON-icc-11.0,EIGEN_CXX=icpc
49#
50####################################################################
51
52# process the arguments
53
54set(ARGLIST ${CTEST_SCRIPT_ARG})
55while(${ARGLIST} MATCHES ".+.*")
56
57 # pick first
58 string(REGEX MATCH "([^,]*)(,.*)?" DUMMY ${ARGLIST})
59 SET(TOP ${CMAKE_MATCH_1})
60
61 # remove first
62 string(REGEX MATCHALL "[^,]*,(.*)" DUMMY ${ARGLIST})
63 SET(ARGLIST ${CMAKE_MATCH_1})
64
65 # decompose as a pair key=value
66 string(REGEX MATCH "([^=]*)(=.*)?" DUMMY ${TOP})
67 SET(KEY ${CMAKE_MATCH_1})
68
69 string(REGEX MATCH "[^=]*=(.*)" DUMMY ${TOP})
70 SET(VALUE ${CMAKE_MATCH_1})
71
72 # set the variable to the specified value
73 if(VALUE)
74 SET(${KEY} ${VALUE})
75 else(VALUE)
76 SET(${KEY} ON)
77 endif(VALUE)
78
79endwhile(${ARGLIST} MATCHES ".+.*")
80
81####################################################################
82# Automatically set some user variables if they have not been defined manually
83####################################################################
84cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
85
86if(NOT EIGEN_SITE)
87 site_name(EIGEN_SITE)
88endif(NOT EIGEN_SITE)
89
90if(NOT EIGEN_CMAKE_DIR)
91 SET(EIGEN_CMAKE_DIR "")
92endif(NOT EIGEN_CMAKE_DIR)
93
94if(NOT EIGEN_BUILD_STRING)
95
96 # let's try to find all information we need to make the build string ourself
97
98 # OS
99 build_name(EIGEN_OS_VERSION)
100
101 # arch
102 set(EIGEN_ARCH ${CMAKE_SYSTEM_PROCESSOR})
103 if(WIN32)
104 set(EIGEN_ARCH $ENV{PROCESSOR_ARCHITECTURE})
105 else(WIN32)
106 execute_process(COMMAND uname -m OUTPUT_VARIABLE EIGEN_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
107 endif(WIN32)
108
109 set(EIGEN_BUILD_STRING ${EIGEN_OS_VERSION}${EIGEN_ARCH}-${EIGEN_CXX})
110
111endif(NOT EIGEN_BUILD_STRING)
112
113if(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
114 set(EIGEN_BUILD_STRING ${EIGEN_BUILD_STRING}-${EIGEN_EXPLICIT_VECTORIZATION})
115endif(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
116
117if(NOT EIGEN_WORK_DIR)
118 set(EIGEN_WORK_DIR ${CTEST_SCRIPT_DIRECTORY})
119endif(NOT EIGEN_WORK_DIR)
120
121if(NOT CTEST_SOURCE_DIRECTORY)
122 SET (CTEST_SOURCE_DIRECTORY "${EIGEN_WORK_DIR}/src")
123endif(NOT CTEST_SOURCE_DIRECTORY)
124
125if(NOT CTEST_BINARY_DIRECTORY)
126 SET (CTEST_BINARY_DIRECTORY "${EIGEN_WORK_DIR}/nightly_${EIGEN_CXX}")
127endif(NOT CTEST_BINARY_DIRECTORY)
128
129if(NOT EIGEN_MODE)
130 set(EIGEN_MODE Nightly)
131endif(NOT EIGEN_MODE)
132
133## mandatory variables (the default should be ok in most cases):
134
135SET (CTEST_CVS_COMMAND "hg")
136SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone -r 2.0 http://bitbucket.org/eigen/eigen \"${CTEST_SOURCE_DIRECTORY}\"")
137
138# which ctest command to use for running the dashboard
139SET (CTEST_COMMAND "${EIGEN_CMAKE_DIR}ctest -D ${EIGEN_MODE}")
140
141# what cmake command to use for configuring this dashboard
142SET (CTEST_CMAKE_COMMAND "${EIGEN_CMAKE_DIR}cmake -DEIGEN_BUILD_TESTS=on ")
143
144####################################################################
145# The values in this section are optional you can either
146# have them or leave them commented out
147####################################################################
148
149# this make sure we get consistent outputs
150SET($ENV{LC_MESSAGES} "en_EN")
151
152# should ctest wipe the binary tree before running
153SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
154SET(CTEST_BACKUP_AND_RESTORE TRUE)
155
156# this is the initial cache to use for the binary tree, be careful to escape
157# any quotes inside of this string if you use it
158if(WIN32 AND NOT UNIX)
159 #message(SEND_ERROR "win32")
160 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -G \"NMake Makefiles\" -DCMAKE_MAKE_PROGRAM=nmake")
161 SET (CTEST_INITIAL_CACHE "
162 MAKECOMMAND:STRING=nmake -i
163 CMAKE_MAKE_PROGRAM:FILEPATH=nmake
164 CMAKE_GENERATOR:INTERNAL=NMake Makefiles
165 BUILDNAME:STRING=${EIGEN_BUILD_STRING}
166 SITE:STRING=${EIGEN_SITE}
167 ")
168else(WIN32 AND NOT UNIX)
169 SET (CTEST_INITIAL_CACHE "
170 BUILDNAME:STRING=${EIGEN_BUILD_STRING}
171 SITE:STRING=${EIGEN_SITE}
172 ")
173endif(WIN32 AND NOT UNIX)
174
175# set any extra environment variables to use during the execution of the script here:
176
177if(EIGEN_CXX)
178 set(CTEST_ENVIRONMENT "CXX=${EIGEN_CXX}")
179endif(EIGEN_CXX)
180
181if(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
182 if(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
183 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON")
184 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE3)
185 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_SSE2=ON -DEIGEN_TEST_SSE3=ON")
186 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES Altivec)
187 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_ALTIVEC=ON")
188 elseif(EIGEN_EXPLICIT_VECTORIZATION MATCHES novec)
189 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -DEIGEN_TEST_NO_EXPLICIT_VECTORIZATION=ON")
190 else(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
191 message(FATAL_ERROR "Invalid value for EIGEN_EXPLICIT_VECTORIZATION (${EIGEN_EXPLICIT_VECTORIZATION}), must be: novec, SSE2, SSE3, Altivec")
192 endif(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
193endif(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
194
195if(DEFINED EIGEN_CMAKE_ARGS)
196 set(CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} ${EIGEN_CMAKE_ARGS}")
197endif(DEFINED EIGEN_CMAKE_ARGS)
Note: See TracBrowser for help on using the repository browser.