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

Jan Möbius's avatar
Jan Möbius committed
3
4
5
# Script abort on error
set -e

Jan Möbius's avatar
Jan Möbius committed
6
7
8
9
10
COMPILER=$1
LANGUAGE=$2
QTVERSION=$3

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

Jan Möbius's avatar
Jan Möbius committed
13
BUILDPATH=""
14

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

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

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

Jan Möbius's avatar
Jan Möbius committed
26
27
28
29
30
  OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DGTEST_PREFIX=~/sw/gtest-1.7.0-clang/ "

#  Build options with icecc /not working due to strange symbol errors
#  OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=/usr/lib/icecc/bin/g++ -DCMAKE_C_COMPILER=/usr/lib/icecc/bin/gcc -DGTEST_PREFIX=~/sw/gtest-1.7.0-clang/ "
#  export ICECC_CXX=/usr/bin/clang++ ; export ICECC_CC=/usr/bin/clang
31

Jan Möbius's avatar
Jan Möbius committed
32
  BUILDPATH="clang"
33
  MAKE_OPTIONS="-j4"
34

Jan Möbius's avatar
Jan Möbius committed
35
36
37
38
39
  echo "Building with CLANG";
fi  

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
Jan Möbius's avatar
Jan Möbius committed
40
  BUILDPATH="$BUILDPATH-cpp98"
Jan Möbius's avatar
Jan Möbius committed
41
42
43
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
44
  BUILDPATH="$BUILDPATH-cpp11"
Jan Möbius's avatar
Jan Möbius committed
45
46
fi  

Jan Möbius's avatar
Jan Möbius committed
47
if [ "$QTVERSION" == "QT4" ]; then
Jan Möbius's avatar
Jan Möbius committed
48
49
  echo "Building with QT4";
  OPTIONS="$OPTIONS -DFORCE_QT4=TRUE "
Jan Möbius's avatar
Jan Möbius committed
50
  BUILDPATH="$BUILDPATH-qt4"
Jan Möbius's avatar
Jan Möbius committed
51
elif [ "$QTVERSION" == "QT5" ]; then
Jan Möbius's avatar
Jan Möbius committed
52
  echo "Building with QT5";
Jan Möbius's avatar
Jan Möbius committed
53
  BUILDPATH="$BUILDPATH-qt5"
Jan Möbius's avatar
Jan Möbius committed
54
  OPTIONS="$OPTIONS -DFORCE_QT4=FALSE -DQWT6_INCLUDE_DIR=~/sw/qwt-6.1.2-qt5/include -DQWT6_LIBRARY_DIR=~/sw/qwt-6.1.2-qt5/lib -DQWT6_LIBRARY=~/sw/qwt-6.1.2-qt5/lib/libqwt-qt5.so -DQT5_INSTALL_PATH=~/sw/qt-5.5.1/5.5/gcc_64"
Jan Möbius's avatar
Jan Möbius committed
55
56
fi

Jan Möbius's avatar
Jan Möbius committed
57
echo "Building with path: build-release-$BUILDPATH"
58
echo "Full cmake options: $OPTIONS  "
Jan Möbius's avatar
Jan Möbius committed
59

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

Jan Möbius's avatar
Jan Möbius committed
61
62
63
64
65
66
67
########################################
# Fetch submodules
########################################
git submodule init
git submodule update --remote


Jan Möbius's avatar
Jan Möbius committed
68
69
70
71
72
73
74
75
76
77
78
79
########################################
# Fetch test data
########################################
rm -rf TestData
git clone git@roosevelt:moebius/OpenFlipper-Test-Data.git TestData


#########################################
# Build Release version and Unittests
#########################################

# Make release build folder
Jan Möbius's avatar
Jan Möbius committed
80
if [ ! -d build-release-$BUILDPATH ]; then
Jan Möbius's avatar
Jan Möbius committed
81
  mkdir build-release-$BUILDPATH
Jan Möbius's avatar
Jan Möbius committed
82
83
fi

Jan Möbius's avatar
Jan Möbius committed
84
cd build-release-$BUILDPATH
Jan Möbius's avatar
Jan Möbius committed
85
86
87
88

cmake -DCMAKE_BUILD_TYPE=Release -DOPENFLIPPER_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../

#build it
Jan Möbius's avatar
Jan Möbius committed
89
make $MAKE_OPTIONS
Jan Möbius's avatar
Jan Möbius committed
90
91
92
93
94
95
96
97
98
99
100

#########################################
# Run Release Unittests
#########################################

# Run tests
cd tests
bash run_tests.sh

cd ..