ci-linux.sh 1.82 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=""
Jan Möbius's avatar
Jan Möbius committed
10
BUILDPATH=""
Jan Möbius's avatar
Jan Möbius committed
11 12 13

if [ "$COMPILER" == "gcc" ]; then
  echo "Building with GCC";
Jan Möbius's avatar
Jan Möbius committed
14
  BUILDPATH="gcc"
Jan Möbius's avatar
Jan Möbius committed
15 16 17 18
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
19
  BUILDPATH="clang"  
Jan Möbius's avatar
Jan Möbius committed
20 21 22 23
fi  

if [ "$LANGUAGE" == "C++98" ]; then
  echo "Building with C++98";
Jan Möbius's avatar
Jan Möbius committed
24
  BUILDPATH="$BUILDPATH-cpp98"
Jan Möbius's avatar
Jan Möbius committed
25 26 27
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
28
  BUILDPATH="$BUILDPATH-cpp11"  
Jan Möbius's avatar
Jan Möbius committed
29 30 31 32 33
fi  

#########################################

# Make release build folder
Jan Möbius's avatar
Jan Möbius committed
34 35
if [ ! -d build-release-$BUILDPATH ]; then
  mkdir build-release-$BUILDPATH
Jan Möbius's avatar
Jan Möbius committed
36 37
fi

Jan Möbius's avatar
Jan Möbius committed
38
cd build-release-$BUILDPATH
Jan Möbius's avatar
Jan Möbius committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

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

#build it
make

#build the unit tests
make unittests


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

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

cd ..

# Execute Python unittests
cd Python-Unittests
python -m unittest discover -v

cd ..
cd ..


#########################################
# Build Debug version and Unittests
#########################################

Jan Möbius's avatar
Jan Möbius committed
71 72
if [ ! -d build-debug-$BUILDPATH ]; then
  mkdir build-debug-$BUILDPATH
Jan Möbius's avatar
Jan Möbius committed
73 74
fi

Jan Möbius's avatar
Jan Möbius committed
75
cd build-debug-$BUILDPATH
Jan Möbius's avatar
Jan Möbius committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

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

#build the unit tests
make unittests


#########################################
# Run Debug Unittests
#########################################

cd Unittests

# Run the unittests
./unittests --gtest_color=yes --gtest_output=xml