ci-mac.sh 5.16 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
124
125
126
cd ..



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


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

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

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

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

146
147
148
#build the unit tests
make unittests

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


cd Unittests

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

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

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

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

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

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

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

  cd ..

201
else
202
203

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

207
fi
208
  
209
210
211
212
213
cd ..

echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
214
echo "Package creation (DMG and tarball)"
215
216
217
218
219
220
221
222
223
224
echo "======================================================================"
echo -e "${NC}"

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