ci-linux.sh 4.58 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=""
Jan Möbius's avatar
Jan Möbius committed
10
BUILDPATH=""
Jan Möbius's avatar
Jan Möbius committed
11
12
13

if [ "$COMPILER" == "gcc" ]; then
  echo "Building with GCC";
Jan Möbius's avatar
Jan Möbius committed
14
  BUILDPATH="gcc"
Jan Möbius's avatar
Jan Möbius committed
15
16
17
18
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
19
  BUILDPATH="clang"  
Jan Möbius's avatar
Jan Möbius committed
20
21
22
23
fi  

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
Jan Möbius's avatar
Jan Möbius committed
24
  BUILDPATH="$BUILDPATH-cpp98"
Jan Möbius's avatar
Jan Möbius committed
25
26
27
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
28
  BUILDPATH="$BUILDPATH-cpp11"  
Jan Möbius's avatar
Jan Möbius committed
29
30
fi  

Jan Möbius's avatar
Jan Möbius committed
31
32
33
34
35
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
36
WARNING='\033[0;93m'
Jan Möbius's avatar
Jan Möbius committed
37

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

Jan Möbius's avatar
Jan Möbius committed
39
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
40
echo ""
41
42
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
43
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
44
echo -e "${NC}"
45
46
47
48


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

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

Alexander Dielen's avatar
Alexander Dielen committed
53
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
54
55
56
57
58
59
60

#build it
make

#build the unit tests
make unittests

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 "Running unittests 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}"
Jan Möbius's avatar
Jan Möbius committed
67
68
69
70
71
72
73

cd Unittests

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

cd ..
74
75
cd ..

Jan Möbius's avatar
Jan Möbius committed
76
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
77
echo ""
78
79
echo "======================================================================"
echo "Building Release version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
80
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
81
echo -e "${NC}"
82
83
84
85
86
87
88
89
90
91
92
93

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
make

Jan Möbius's avatar
Jan Möbius committed
94
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
95
echo ""
96
97
echo "======================================================================"
echo "Running Python unittests Release version "
Jan Möbius's avatar
Jan Möbius committed
98
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
99
echo -e "${NC}"
100

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

103
104
105
106
107
108
109
110
111
112
113
114
  # 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
115

Jan Möbius's avatar
Jan Möbius committed
116
117
118
119
120

cd ..



Jan Möbius's avatar
Jan Möbius committed
121
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
122
echo ""
123
124
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
125
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
126
echo -e "${NC}"
127
128
129
130


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

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

Alexander Dielen's avatar
Alexander Dielen committed
135
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
136

137
138
139
#build it
make

Jan Möbius's avatar
Jan Möbius committed
140
141
142
#build the unit tests
make unittests

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 "Running unittests 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}"
Jan Möbius's avatar
Jan Möbius committed
149
150
151
152


cd Unittests

153
#execute tests
Jan Möbius's avatar
Jan Möbius committed
154
155
./unittests --gtest_color=yes --gtest_output=xml

156
cd ..
157
158
cd ..

Jan Möbius's avatar
Jan Möbius committed
159
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
160
echo ""
161
162
echo "======================================================================"
echo "Building Debug version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
163
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
164
echo -e "${NC}"
165
166
167
168
169
170
171
172
173
174
175
176

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
make

Jan Möbius's avatar
Jan Möbius committed
177
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
178
echo ""
179
180
echo "======================================================================"
echo "Running Python unittests Debug version "
Jan Möbius's avatar
Jan Möbius committed
181
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
182
echo -e "${NC}"
183

184
185
186
187
if [ "$LANGUAGE" == "C++11"  ] || [ "$COMPILER" == "gcc" ] ; then

  # Execute Python unittests
  cd Python-Unittests
188

189
190
  python -m unittest discover -v
else
Jan Möbius's avatar
Jan Möbius committed
191

192
193
194
195
196
  echo -e "${WARNING}"
  echo "WARNING! Python unittests disabled !!"
  echo -e "${NC}"

fi