ci-mac.sh 3.86 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 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 23 24
elif [ "$LANGUAGE" == "C++14" ]; then
  echo "Building with C++14";
  OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++14' "
  BUILDPATH="cpp14"
25 26
fi  

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

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

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

54

55 56
if [ ! -d build-release-$BUILDPATH-Vector-Checks ]; then
  mkdir build-release-$BUILDPATH-Vector-Checks
57 58
fi

59
cd build-release-$BUILDPATH-Vector-Checks
60

61
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
62 63 64 65 66 67 68

#build it
make

#build the unit tests
make unittests

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

cd Unittests

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

81 82 83 84 85 86 87
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version with minimal vector type"
echo "======================================================================"
echo -e "${NC}"

88 89
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
90
cd ..
91 92
cd ..

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


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

105
cd build-debug-$BUILDPATH-Vector-Checks
106

107
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
108

Jan Möbius's avatar
Jan Möbius committed
109 110 111
#build it
make

112 113 114
#build the unit tests
make unittests

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


cd Unittests

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

128 129 130 131 132 133 134
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version with minimal vector type"
echo "======================================================================"
echo -e "${NC}"

135 136
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
137
cd ..
138 139
cd ..

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


148 149 150 151 152
if [ ! -d build-release-$BUILDPATH ]; then
  mkdir build-release-$BUILDPATH
fi

cd build-release-$BUILDPATH
153

154
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../
155

156 157 158
#build it
make
make package