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

COMPILER=$1
LANGUAGE=$2

Jan Möbius's avatar
Jan Möbius committed
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
./unittests_customvec --gtest_color=yes --gtest_output=xml

Jan Möbius's avatar
Jan Möbius committed
101
cd ..
102 103
cd ..

Jan Möbius's avatar
Jan Möbius committed
104
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
105
echo ""
106 107
echo "======================================================================"
echo "Building Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
108
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
109
echo -e "${NC}"
110 111 112 113


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

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

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

120
#build it
121
make $MAKE_OPTIONS
122

Jan Möbius's avatar
Jan Möbius committed
123
#build the unit tests
124
make  $MAKE_OPTIONS unittests
Jan Möbius's avatar
Jan Möbius committed
125

Jan Möbius's avatar
Jan Möbius committed
126
echo -e "${OUTPUT}"
Jan Möbius's avatar
Jan Möbius committed
127
echo ""
128 129
echo "======================================================================"
echo "Running unittests Debug version with vectorchecks enabled"
Jan Möbius's avatar
Jan Möbius committed
130
echo "======================================================================"
Jan Möbius's avatar
Jan Möbius committed
131
echo -e "${NC}"
Jan Möbius's avatar
Jan Möbius committed
132 133 134 135


cd Unittests

136
#execute tests
Jan Möbius's avatar
Jan Möbius committed
137 138
./unittests --gtest_color=yes --gtest_output=xml

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

141
cd ..
142
cd ..