ci-mac.sh 3.34 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
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
83
cd ..
84 85
cd ..

Jan Möbius's avatar
Jan Möbius committed
86
echo -e "${OUTPUT}"
87 88 89
echo ""
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
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 94 95


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

98
cd build-debug-$BUILDPATH-Vector-Checks
99

100
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
101

Jan Möbius's avatar
Jan Möbius committed
102 103 104
#build it
make

105 106 107
#build the unit tests
make unittests

Jan Möbius's avatar
Jan Möbius committed
108
echo -e "${OUTPUT}"
109 110 111
echo ""
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
112
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
113
echo -e "${NC}"
114 115 116 117


cd Unittests

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

121 122
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
123
cd ..
124 125
cd ..

126 127 128
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
129
echo "Package creation (DMG and tarball)"
130 131 132 133
echo "======================================================================"
echo -e "${NC}"


134 135 136 137 138
if [ ! -d build-release-$BUILDPATH ]; then
  mkdir build-release-$BUILDPATH
fi

cd build-release-$BUILDPATH
139

140
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../
141

142 143 144
#build it
make
make package