ci-linux.sh 4.13 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2 3 4 5
#!/bin/bash

COMPILER=$1
LANGUAGE=$2

6 7 8
# Exit script on any error
set -e 

Jan Möbius's avatar
Jan Möbius committed
9
OPTIONS=""
10
MAKE_OPTIONS=""
Jan Möbius's avatar
Jan Möbius committed
11
BUILDPATH=""
Jan Möbius's avatar
Jan Möbius committed
12

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

Jan Möbius's avatar
Jan Möbius committed
16 17
if [ "$COMPILER" == "gcc" ]; then
  echo "Building with GCC";
Jan Möbius's avatar
Jan Möbius committed
18
  BUILDPATH="gcc"
19 20

  # without icecc: no options required
Matthias Möller's avatar
Matthias Möller committed
21
  OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=/usr/lib/icecc/bin/g++ -DCMAKE_C_COMPILER=/usr/lib/icecc/bin/gcc"
22 23 24
  MAKE_OPTIONS="-j16"
  export ICECC_CXX=/usr/bin/g++ ; export ICECC_CC=/usr/bin/gcc

Jan Möbius's avatar
Jan Möbius committed
25 26 27 28
elif [ "$COMPILER" == "clang" ]; then

  OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
  echo "Building with CLANG";
Jan Möbius's avatar
Jan Möbius committed
29
  BUILDPATH="clang"  
Jan Möbius's avatar
Jan Möbius committed
30 31 32 33
fi  

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
Jan Möbius's avatar
Jan Möbius committed
34
  BUILDPATH="$BUILDPATH-cpp98"
Jan Möbius's avatar
Jan Möbius committed
35 36 37
elif [ "$LANGUAGE" == "C++11" ]; then
  echo "Building with C++11";
  OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' "
Jan Möbius's avatar
Jan Möbius committed
38
  BUILDPATH="$BUILDPATH-cpp11"  
39 40 41 42
elif [ "$LANGUAGE" == "C++14" ]; then
  echo "Building with C++14";
  OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++14' "
  BUILDPATH="$BUILDPATH-cpp14"  
Jan Möbius's avatar
Jan Möbius committed
43 44
fi  

Jan Möbius's avatar
Jan Möbius committed
45 46 47 48 49
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
50
WARNING='\033[0;93m'
Jan Möbius's avatar
Jan Möbius committed
51

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

Jan Möbius's avatar
Jan Möbius committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Basic configuration details:"
echo "======================================================================"
echo -e "${NC}"

echo "Compiler:     $COMPILER"
echo "Options:      $OPTIONS"
echo "Language:     $LANGUAGE"
echo "Make Options: $OPTIONS"
echo "BuildPath:    $BUILDPATH"
echo "Path:         $PATH"
echo "Language:     $LANGUAGE"

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


if [ ! -d build-release-$BUILDPATH-Vector-Checks ]; then
  mkdir build-release-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
78 79
fi

80
cd build-release-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
81

82
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
Jan Möbius's avatar
Jan Möbius committed
83 84

#build it
85
make $MAKE_OPTIONS
Jan Möbius's avatar
Jan Möbius committed
86 87

#build the unit tests
88
make  $MAKE_OPTIONS unittests
Jan Möbius's avatar
Jan Möbius committed
89

Jan Möbius's avatar
Jan Möbius committed
90
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
91
echo ""
92 93
echo "======================================================================"
echo "Running unittests Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
94
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
95
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
96 97 98 99 100 101

cd Unittests

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

102 103 104 105 106 107 108
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version with custom vector type"
echo "======================================================================"
echo -e "${NC}"

109 110
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
111
cd ..
112 113
cd ..

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


if [ ! -d build-debug-$BUILDPATH-Vector-Checks ]; then
  mkdir build-debug-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
124 125
fi

126
cd build-debug-$BUILDPATH-Vector-Checks
Jan Möbius's avatar
Jan Möbius committed
127

128
cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
Jan Möbius's avatar
Jan Möbius committed
129

130
#build it
131
make $MAKE_OPTIONS
132

Jan Möbius's avatar
Jan Möbius committed
133
#build the unit tests
134
make  $MAKE_OPTIONS unittests
Jan Möbius's avatar
Jan Möbius committed
135

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


cd Unittests

146
#execute tests
Jan Möbius's avatar
Jan Möbius committed
147 148
./unittests --gtest_color=yes --gtest_output=xml

149 150 151 152 153 154 155
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version with custom vector type"
echo "======================================================================"
echo -e "${NC}"

156 157
./unittests_customvec --gtest_color=yes --gtest_output=xml

158
cd ..
159
cd ..