ci-mac.sh 4.35 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'
Jan Möbius's avatar
Jan Möbius committed
28

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

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

37

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

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

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

#build it
make

#build the unit tests
make unittests

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

cd Unittests

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

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

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

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
85
echo -e "${OUTPUT}"
86
87
88
echo ""
echo "======================================================================"
echo "Running Python unittests Release version "
Jan Möbius's avatar
Jan Möbius committed
89
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
90
echo -e "${NC}"
91
92


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


109
110
111
112
cd ..



Jan Möbius's avatar
Jan Möbius committed
113
echo -e "${OUTPUT}"
114
115
116
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
117
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
118
echo -e "${NC}"
119
120
121
122


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

125
cd build-debug-$BUILDPATH-Vector-Checks
126

127
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
128

Jan Möbius's avatar
Jan Möbius committed
129
130
131
#build it
make

132
133
134
#build the unit tests
make unittests

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


cd Unittests

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

Jan Möbius's avatar
Jan Möbius committed
148
cd ..
149
150
cd ..

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

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

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

Jan Möbius's avatar
Jan Möbius committed
178
179
  # Execute Python unittests
  cd Python-Unittests
180

Jan Möbius's avatar
Jan Möbius committed
181
182
183
  rm -f openmesh.so
  cp ../Build/python/openmesh.so .
  python -m unittest discover -v
184
185
186
else
  echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
fi