ci-mac.sh 5.15 KB
Newer Older
1
2
#!/bin/bash

Jan Möbius's avatar
Jan Möbius committed
3
#Exit on any error
4
set -e 
Jan Möbius's avatar
Jan Möbius committed
5

Jan Möbius's avatar
Jan Möbius committed
6
7
LANGUAGE=$1

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

Jan Möbius's avatar
Jan Möbius committed
9
10
PATH=$PATH:/opt/local/bin
export PATH
11

Jan Möbius's avatar
Jan Möbius committed
12
13
14
15
OPTIONS=""

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
16
  BUILDPATH="cpp98"
Jan Möbius's avatar
Jan Möbius committed
17
18
19
elif [ "$LANGUAGE" == "C++11" ]; then
  echo "Building with C++11";
  OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' "
20
  BUILDPATH="cpp11"  
21
22
fi  

Jan Möbius's avatar
Jan Möbius committed
23
24
25
26
27
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
28
WARNING='\033[0;93m'
Jan Möbius's avatar
Jan Möbius committed
29

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

31
32
33
34
35
36
37
38
39
40
41
42
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Basic configuration details:"
echo "======================================================================"
echo -e "${NC}"

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

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

50

51
52
if [ ! -d build-release-$BUILDPATH-Vector-Checks ]; then
  mkdir build-release-$BUILDPATH-Vector-Checks
53
54
fi

55
cd build-release-$BUILDPATH-Vector-Checks
56

57
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
58
59
60
61
62
63
64

#build it
make

#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
65
echo -e "${OUTPUT}"
66
67
68
echo ""
echo "======================================================================"
echo "Running unittests 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
75
76

cd Unittests

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

Jan Möbius's avatar
Jan Möbius committed
77
cd ..
78
79
cd ..

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

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

cd build-release-$BUILDPATH

93
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../
94
95
96
97

#build it
make

Jan Möbius's avatar
Jan Möbius committed
98
echo -e "${OUTPUT}"
99
100
101
echo ""
echo "======================================================================"
echo "Running Python unittests Release version "
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


Jan Möbius's avatar
Jan Möbius committed
106
107
108
109
110
111
112
113
114
115
116
117
if [ "$LANGUAGE" == "C++11" ]; then

  # Execute Python unittests
  cd Python-Unittests

  rm -f openmesh.so
  cp ../Build/python/openmesh.so .
  python -m unittest discover -v

  cd ..

else
118
  echo -e "${WARNING}"
Jan Möbius's avatar
Jan Möbius committed
119
  echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
120
  echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
121
fi
Jan Möbius's avatar
Jan Möbius committed
122

123
OPTIONS=
124
125
126
127
cd ..



Jan Möbius's avatar
Jan Möbius committed
128
echo -e "${OUTPUT}"
129
130
131
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
132
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
133
echo -e "${NC}"
134
135
136
137


if [ ! -d build-debug-$BUILDPATH-Vector-Checks ]; then
  mkdir build-debug-$BUILDPATH-Vector-Checks
138
139
fi

140
cd build-debug-$BUILDPATH-Vector-Checks
141

142
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
143

Jan Möbius's avatar
Jan Möbius committed
144
145
146
#build it
make

147
148
149
#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
150
echo -e "${OUTPUT}"
151
152
153
echo ""
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
154
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
155
echo -e "${NC}"
156
157
158
159


cd Unittests

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

Jan Möbius's avatar
Jan Möbius committed
163
cd ..
164
165
cd ..

Jan Möbius's avatar
Jan Möbius committed
166
echo -e "${OUTPUT}"
167
168
169
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
170
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
171
echo -e "${NC}"
172
173
174
175
176
177
178
179
180
181
182
183

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
184
echo -e "${OUTPUT}"
185
186
187
echo ""
echo "======================================================================"
echo "Running Python unittests Debug version "
Jan Möbius's avatar
Jan Möbius committed
188
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
189
echo -e "${NC}"
190

191
if [ "$LANGUAGE" == "C++11" ]; then
Jan Möbius's avatar
Jan Möbius committed
192

Jan Möbius's avatar
Jan Möbius committed
193
194
  # Execute Python unittests
  cd Python-Unittests
195

Jan Möbius's avatar
Jan Möbius committed
196
197
198
  rm -f openmesh.so
  cp ../Build/python/openmesh.so .
  python -m unittest discover -v
199
else
200
201

  echo -e "${WARNING}"
202
  echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
203
204
  echo -e "${NC}"

205
fi
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

cd .. 
cd ..

echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Package creation"
echo "======================================================================"
echo -e "${NC}"

cd build-release-$BUILDPATH
cp ../build-debug-$BUILDPATH/Build/lib/* ./Build/lib/
cmake .
make package