ci-mac.sh 4.21 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
# Execute Python unittests
cd Python-Unittests

rm -f openmesh.so
cp ../Build/python/openmesh.so .
98
python -m unittest discover -v
Jan Möbius's avatar
Jan Möbius committed
99
100

cd ..
101
102
103
104
cd ..



Jan Möbius's avatar
Jan Möbius committed
105
echo -e "${OUTPUT}"
106
107
108
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
109
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
110
echo -e "${NC}"
111
112
113
114


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

117
cd build-debug-$BUILDPATH-Vector-Checks
118

119
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
120

Jan Möbius's avatar
Jan Möbius committed
121
122
123
#build it
make

124
125
126
#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
127
echo -e "${OUTPUT}"
128
129
130
echo ""
echo "======================================================================"
echo "Running unittests 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


cd Unittests

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

Jan Möbius's avatar
Jan Möbius committed
140
cd ..
141
142
cd ..

Jan Möbius's avatar
Jan Möbius committed
143
echo -e "${OUTPUT}"
144
145
146
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks disabled for python tests"
Jan Möbius's avatar
Jan Möbius committed
147
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
148
echo -e "${NC}"
149
150
151
152
153
154
155
156
157
158
159
160

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
161
echo -e "${OUTPUT}"
162
163
164
echo ""
echo "======================================================================"
echo "Running Python unittests Debug version "
Jan Möbius's avatar
Jan Möbius committed
165
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
166
echo -e "${NC}"
167

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

Jan Möbius's avatar
Jan Möbius committed
170
171
# Execute Python unittests
cd Python-Unittests
172

Jan Möbius's avatar
Jan Möbius committed
173
174
rm -f openmesh.so
cp ../Build/python/openmesh.so .
175
python -m unittest discover -v
176
177
178
else
  echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
fi