ci-linux.sh 5.49 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"  
36 37 38 39
elif [ "$LANGUAGE" == "C++14" ]; then
  echo "Building with C++14";
  OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++14' "
  BUILDPATH="$BUILDPATH-cpp14"  
Jan Möbius's avatar
Jan Möbius committed
40 41
fi  

Jan Möbius's avatar
Jan Möbius committed
42 43 44 45 46
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
47
WARNING='\033[0;93m'
Jan Möbius's avatar
Jan Möbius committed
48

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

Jan Möbius's avatar
Jan Möbius committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
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
65
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
66
echo ""
67 68
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
69
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
70
echo -e "${NC}"
71 72 73 74


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

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

Alexander Dielen's avatar
Alexander Dielen committed
79
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
80 81

#build it
82
make $MAKE_OPTIONS
Jan Möbius's avatar
Jan Möbius committed
83 84

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

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

cd Unittests

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

cd ..
100 101
cd ..

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

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
118
make $MAKE_OPTIONS
119

Jan Möbius's avatar
Jan Möbius committed
120
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
121
echo ""
122 123
echo "======================================================================"
echo "Running Python unittests Release version "
Jan Möbius's avatar
Jan Möbius committed
124
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
125
echo -e "${NC}"
126

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

129 130 131 132 133 134 135 136 137 138 139 140
  # 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
141

Jan Möbius's avatar
Jan Möbius committed
142 143 144 145 146

cd ..



Jan Möbius's avatar
Jan Möbius committed
147
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
148
echo ""
149 150
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
151
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
152
echo -e "${NC}"
153 154 155 156


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

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

Alexander Dielen's avatar
Alexander Dielen committed
161
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
162

163
#build it
164
make $MAKE_OPTIONS
165

Jan Möbius's avatar
Jan Möbius committed
166
#build the unit tests
167
make  $MAKE_OPTIONS unittests
Jan Möbius's avatar
Jan Möbius committed
168

Jan Möbius's avatar
Jan Möbius committed
169
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
170
echo ""
171 172
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
173
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
174
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
175 176 177 178


cd Unittests

179
#execute tests
Jan Möbius's avatar
Jan Möbius committed
180 181
./unittests --gtest_color=yes --gtest_output=xml

182
cd ..
183 184
cd ..

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

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
201
make $MAKE_OPTIONS
202

Jan Möbius's avatar
Jan Möbius committed
203
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
204
echo ""
205 206
echo "======================================================================"
echo "Running Python unittests Debug version "
Jan Möbius's avatar
Jan Möbius committed
207
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
208
echo -e "${NC}"
209

210 211 212 213
if [ "$LANGUAGE" == "C++11"  ] || [ "$COMPILER" == "gcc" ] ; then

  # Execute Python unittests
  cd Python-Unittests
214

215 216
  python -m unittest discover -v
else
Jan Möbius's avatar
Jan Möbius committed
217

218 219 220 221 222
  echo -e "${WARNING}"
  echo "WARNING! Python unittests disabled !!"
  echo -e "${NC}"

fi