ci-linux.sh 4.06 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 14

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

  # without icecc: no options required
  OPTIONS="-DCMAKE_CXX_COMPILER=/usr/lib/icecc/bin/g++ -DCMAKE_C_COMPILER=/usr/lib/icecc/bin/gcc"
  MAKE_OPTIONS="-j16"
  export ICECC_CXX=/usr/bin/g++ ; export ICECC_CC=/usr/bin/gcc

Jan Möbius's avatar
Jan Möbius committed
22 23 24 25
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
26
  BUILDPATH="clang"  
Jan Möbius's avatar
Jan Möbius committed
27 28 29 30
fi  

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
Jan Möbius's avatar
Jan Möbius committed
31
  BUILDPATH="$BUILDPATH-cpp98"
Jan Möbius's avatar
Jan Möbius committed
32 33 34
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
35
  BUILDPATH="$BUILDPATH-cpp11"  
36 37 38 39
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
40 41
fi  

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

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

Jan Möbius's avatar
Jan Möbius committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
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
65
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
66
echo ""
67 68
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
69
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
70
echo -e "${NC}"
71 72 73 74


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

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

79
cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
Jan Möbius's avatar
Jan Möbius committed
80 81

#build it
82
make $MAKE_OPTIONS
Jan Möbius's avatar
Jan Möbius committed
83 84

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

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

cd Unittests

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

99 100 101 102 103 104 105
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version with custom vector type"
echo "======================================================================"
echo -e "${NC}"

106 107
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
108
cd ..
109 110
cd ..

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


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

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

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

127
#build it
128
make $MAKE_OPTIONS
129

Jan Möbius's avatar
Jan Möbius committed
130
#build the unit tests
131
make  $MAKE_OPTIONS unittests
Jan Möbius's avatar
Jan Möbius committed
132

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


cd Unittests

143
#execute tests
Jan Möbius's avatar
Jan Möbius committed
144 145
./unittests --gtest_color=yes --gtest_output=xml

146 147 148 149 150 151 152
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version with custom vector type"
echo "======================================================================"
echo -e "${NC}"

153 154
./unittests_customvec --gtest_color=yes --gtest_output=xml

155
cd ..
156
cd ..