ci-linux.sh 5.34 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2 3 4 5
#!/bin/bash

COMPILER=$1
LANGUAGE=$2

Jan Möbius's avatar
Jan Möbius committed
6 7 8
# Exit script on any error
set -e 

Jan Möbius's avatar
Jan Möbius committed
9
OPTIONS=""
10
MAKE_OPTIONS=""
Jan Möbius's avatar
Jan Möbius committed
11
BUILDPATH=""
Jan Möbius's avatar
Jan Möbius committed
12 13 14

if [ "$COMPILER" == "gcc" ]; then
  echo "Building with GCC";
Jan Möbius's avatar
Jan Möbius committed
15
  BUILDPATH="gcc"
16 17 18 19 20 21

  # without icecc: no options required
  OPTIONS="-DCMAKE_CXX_COMPILER=/usr/lib/icecc/bin/g++ -DCMAKE_C_COMPILER=/usr/lib/icecc/bin/gcc"
  MAKE_OPTIONS="-j16"
  export ICECC_CXX=/usr/bin/g++ ; export ICECC_CC=/usr/bin/gcc

Jan Möbius's avatar
Jan Möbius committed
22 23 24 25
elif [ "$COMPILER" == "clang" ]; then

  OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
  echo "Building with CLANG";
Jan Möbius's avatar
Jan Möbius committed
26
  BUILDPATH="clang"  
Jan Möbius's avatar
Jan Möbius committed
27 28 29 30
fi  

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
Jan Möbius's avatar
Jan Möbius committed
31
  BUILDPATH="$BUILDPATH-cpp98"
Jan Möbius's avatar
Jan Möbius committed
32 33 34
elif [ "$LANGUAGE" == "C++11" ]; then
  echo "Building with C++11";
  OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' "
Jan Möbius's avatar
Jan Möbius committed
35
  BUILDPATH="$BUILDPATH-cpp11"  
Jan Möbius's avatar
Jan Möbius committed
36 37
fi  

Jan Möbius's avatar
Jan Möbius committed
38 39 40 41 42
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
43
WARNING='\033[0;93m'
Jan Möbius's avatar
Jan Möbius committed
44

Jan Möbius's avatar
Jan Möbius committed
45

Jan Möbius's avatar
Jan Möbius committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Basic configuration details:"
echo "======================================================================"
echo -e "${NC}"

echo "Compiler:     $COMPILER"
echo "Options:      $OPTIONS"
echo "Language:     $LANGUAGE"
echo "Make Options: $OPTIONS"
echo "BuildPath:    $BUILDPATH"
echo "Path:         $PATH"
echo "Language:     $LANGUAGE"

Jan Möbius's avatar
Jan Möbius committed
61
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
62
echo ""
63 64
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
65
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
66
echo -e "${NC}"
67 68 69 70


if [ ! -d build-release-$BUILDPATH-Vector-Checks ]; then
  mkdir build-release-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
71 72
fi

73
cd build-release-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
74

Alexander Dielen's avatar
Alexander Dielen committed
75
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_BINDINGS=OFF $OPTIONS ../
Jan Möbius's avatar
Jan Möbius committed
76 77

#build it
78
make $MAKE_OPTIONS
Jan Möbius's avatar
Jan Möbius committed
79 80

#build the unit tests
81
make  $MAKE_OPTIONS unittests
Jan Möbius's avatar
Jan Möbius committed
82

Jan Möbius's avatar
Jan Möbius committed
83
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
84
echo ""
85 86
echo "======================================================================"
echo "Running unittests Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
87
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
88
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
89 90 91 92 93 94 95

cd Unittests

#execute tests
./unittests --gtest_color=yes --gtest_output=xml

cd ..
96 97
cd ..

Jan Möbius's avatar
Jan Möbius committed
98
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
99
echo ""
100 101
echo "======================================================================"
echo "Building Release version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
102
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
103
echo -e "${NC}"
104 105 106 107 108 109 110 111 112 113

if [ ! -d build-release-$BUILDPATH ]; then
  mkdir build-release-$BUILDPATH
fi

cd build-release-$BUILDPATH

cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../

#build it
114
make $MAKE_OPTIONS
115

Jan Möbius's avatar
Jan Möbius committed
116
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
117
echo ""
118 119
echo "======================================================================"
echo "Running Python unittests Release version "
Jan Möbius's avatar
Jan Möbius committed
120
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
121
echo -e "${NC}"
122

123
if [ "$LANGUAGE" == "C++11"  ] || [ "$COMPILER" == "gcc" ] ; then
Jan Möbius's avatar
Jan Möbius committed
124

125 126 127 128 129 130 131 132 133 134 135 136
  # Execute Python unittests
  cd Python-Unittests

  python -m unittest discover -v

  cd ..

else
  echo -e "${WARNING}"
  echo "WARNING! Python unittests disabled !!"
  echo -e "${NC}"
fi
137

Jan Möbius's avatar
Jan Möbius committed
138 139 140 141 142

cd ..



Jan Möbius's avatar
Jan Möbius committed
143
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
144
echo ""
145 146
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
147
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
148
echo -e "${NC}"
149 150 151 152


if [ ! -d build-debug-$BUILDPATH-Vector-Checks ]; then
  mkdir build-debug-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
153 154
fi

155
cd build-debug-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
156

Alexander Dielen's avatar
Alexander Dielen committed
157
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_BINDINGS=OFF $OPTIONS ../
Jan Möbius's avatar
Jan Möbius committed
158

159
#build it
160
make $MAKE_OPTIONS
161

Jan Möbius's avatar
Jan Möbius committed
162
#build the unit tests
163
make  $MAKE_OPTIONS unittests
Jan Möbius's avatar
Jan Möbius committed
164

Jan Möbius's avatar
Jan Möbius committed
165
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
166
echo ""
167 168
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
169
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
170
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
171 172 173 174


cd Unittests

175
#execute tests
Jan Möbius's avatar
Jan Möbius committed
176 177
./unittests --gtest_color=yes --gtest_output=xml

178
cd ..
179 180
cd ..

Jan Möbius's avatar
Jan Möbius committed
181
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
182
echo ""
183 184
echo "======================================================================"
echo "Building Debug version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
185
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
186
echo -e "${NC}"
187 188 189 190 191 192 193 194 195 196

if [ ! -d build-debug-$BUILDPATH ]; then
  mkdir build-debug-$BUILDPATH
fi

cd build-debug-$BUILDPATH

cmake -DCMAKE_BUILD_TYPE=DEBUG -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../

#build it
197
make $MAKE_OPTIONS
198

Jan Möbius's avatar
Jan Möbius committed
199
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
200
echo ""
201 202
echo "======================================================================"
echo "Running Python unittests Debug version "
Jan Möbius's avatar
Jan Möbius committed
203
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
204
echo -e "${NC}"
205

206 207 208 209
if [ "$LANGUAGE" == "C++11"  ] || [ "$COMPILER" == "gcc" ] ; then

  # Execute Python unittests
  cd Python-Unittests
210

211 212
  python -m unittest discover -v
else
Jan Möbius's avatar
Jan Möbius committed
213

214 215 216 217 218
  echo -e "${WARNING}"
  echo "WARNING! Python unittests disabled !!"
  echo -e "${NC}"

fi