ci-mac.sh 4.82 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="$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
21
22
  BUILDPATH="$BUILDPATH-cpp11"  
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

Jan Möbius's avatar
Jan Möbius committed
31
echo -e "${OUTPUT}"
32
33
34
echo ""
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
35
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
36
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
37

38

39
40
if [ ! -d build-release-$BUILDPATH-Vector-Checks ]; then
  mkdir build-release-$BUILDPATH-Vector-Checks
41
42
fi

43
cd build-release-$BUILDPATH-Vector-Checks
44

45
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
46
47
48
49
50
51
52

#build it
make

#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
53
echo -e "${OUTPUT}"
54
55
56
echo ""
echo "======================================================================"
echo "Running unittests Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
57
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
58
echo -e "${NC}"
59
60
61
62
63
64

cd Unittests

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

Jan Möbius's avatar
Jan Möbius committed
65
cd ..
66
67
cd ..

Jan Möbius's avatar
Jan Möbius committed
68
echo -e "${OUTPUT}"
69
70
71
echo ""
echo "======================================================================"
echo "Building Release version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
72
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
73
echo -e "${NC}"
74
75
76
77
78
79
80

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

cd build-release-$BUILDPATH

81
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../
82
83
84
85

#build it
make

Jan Möbius's avatar
Jan Möbius committed
86
echo -e "${OUTPUT}"
87
88
89
echo ""
echo "======================================================================"
echo "Running Python unittests Release version "
Jan Möbius's avatar
Jan Möbius committed
90
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
91
echo -e "${NC}"
92
93


Jan Möbius's avatar
Jan Möbius committed
94
95
96
97
98
99
100
101
102
103
104
105
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
106
  echo -e "${WARNING}"
Jan Möbius's avatar
Jan Möbius committed
107
  echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
108
  echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
109
fi
Jan Möbius's avatar
Jan Möbius committed
110
111


112
113
114
115
cd ..



Jan Möbius's avatar
Jan Möbius committed
116
echo -e "${OUTPUT}"
117
118
119
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
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
124
125


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

128
cd build-debug-$BUILDPATH-Vector-Checks
129

130
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
131

Jan Möbius's avatar
Jan Möbius committed
132
133
134
#build it
make

135
136
137
#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
138
echo -e "${OUTPUT}"
139
140
141
echo ""
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
142
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
143
echo -e "${NC}"
144
145
146
147


cd Unittests

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

Jan Möbius's avatar
Jan Möbius committed
151
cd ..
152
153
cd ..

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

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
172
echo -e "${OUTPUT}"
173
174
175
echo ""
echo "======================================================================"
echo "Running Python unittests Debug version "
Jan Möbius's avatar
Jan Möbius committed
176
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
177
echo -e "${NC}"
178

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

Jan Möbius's avatar
Jan Möbius committed
181
182
  # Execute Python unittests
  cd Python-Unittests
183

Jan Möbius's avatar
Jan Möbius committed
184
185
186
  rm -f openmesh.so
  cp ../Build/python/openmesh.so .
  python -m unittest discover -v
187
else
188
189

  echo -e "${WARNING}"
190
  echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
191
192
  echo -e "${NC}"

193
fi
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211

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