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

3
#Exit on any error
4
set -e 
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
OPTIONS=""

14
# set GTEST path
Matthias Möller's avatar
Matthias Möller committed
15
OPTIONS="$OPTIONS -DGTEST_ROOT=~/sw/gtest-1.7.0/"
16

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

Jan Möbius's avatar
Jan Möbius committed
30 31 32 33 34
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
35
WARNING='\033[0;93m'
Jan Möbius's avatar
Jan Möbius committed
36

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

38 39 40 41 42 43 44 45 46 47 48 49
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
50
echo -e "${OUTPUT}"
51 52 53
echo ""
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
54
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
55
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
56

57

58 59
if [ ! -d build-release-$BUILDPATH-Vector-Checks ]; then
  mkdir build-release-$BUILDPATH-Vector-Checks
60 61
fi

62
cd build-release-$BUILDPATH-Vector-Checks
63

64
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
65 66 67 68 69 70 71

#build it
make

#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
72
echo -e "${OUTPUT}"
73 74 75
echo ""
echo "======================================================================"
echo "Running unittests Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
76
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
77
echo -e "${NC}"
78 79 80 81 82 83

cd Unittests

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

84 85 86 87 88 89 90
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version with minimal vector type"
echo "======================================================================"
echo -e "${NC}"

91 92
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
93
cd ..
94 95
cd ..

Jan Möbius's avatar
Jan Möbius committed
96
echo -e "${OUTPUT}"
97 98 99
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
100
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
101
echo -e "${NC}"
102 103 104 105


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

108
cd build-debug-$BUILDPATH-Vector-Checks
109

110
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
111

Jan Möbius's avatar
Jan Möbius committed
112 113 114
#build it
make

115 116 117
#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
118
echo -e "${OUTPUT}"
119 120 121
echo ""
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
122
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
123
echo -e "${NC}"
124 125 126 127


cd Unittests

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

131 132 133 134 135 136 137
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version with minimal vector type"
echo "======================================================================"
echo -e "${NC}"

138 139
./unittests_customvec --gtest_color=yes --gtest_output=xml

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

143 144 145
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
146
echo "Package creation (DMG and tarball)"
147 148 149 150
echo "======================================================================"
echo -e "${NC}"


151 152 153 154 155
if [ ! -d build-release-$BUILDPATH ]; then
  mkdir build-release-$BUILDPATH
fi

cd build-release-$BUILDPATH
156

157
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../
158

159 160 161
#build it
make
make package