~widelands-dev/widelands/ai_seafaring_fix

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
set -ex

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
  #Install requested compiler version for linux

  if [ "$CXX" = "g++" ]; then
    sudo apt-get install -qq g++-$GCC_VERSION;
    export CXX="g++-$GCC_VERSION" CC="gcc-$GCC_VERSION";
  fi
  if [ "$CXX" = "clang++" ]; then
    sudo apt-get install -qq clang-$CLANG_VERSION;
    export CXX="clang++-$CLANG_VERSION" CC="clang-$CLANG_VERSION";
  fi
fi

if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
  # Install osx dependencies
  # boost and cmake are preinstalled :)
  brew install gettext glew icu4c sdl2 sdl2_image sdl2_mixer sdl2_ttf zlib
  # brew doesn't add a link by default
  brew link --force gettext
  brew link --force icu4c
fi

# Configure the build
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE:STRING="$BUILD_TYPE" -DOPTION_ASAN="OFF"

if [ "$BUILD_TYPE" == "Debug" ]; then

   # Build the documentation. Any warning is an error.
   if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
     sudo pip install sphinx
   fi
   if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
     pip2 install sphinx
   fi
   pushd ../doc/sphinx
   mkdir source/_static
   ./extract_rst.py
   sphinx-build -W -b json -d build/doctrees source build/json
   popd

   # Run the codecheck test suite.
   pushd ../cmake/codecheck
   ./run_tests.py
   popd

   # Any codecheck warning is an error in Debug builds. Keep the codebase clean!!
   # Suppress color output.
   TERM=dumb make -j1 codecheck 2>&1 | tee codecheck.out
   if grep '^[/_.a-zA-Z]\+:[0-9]\+:' codecheck.out; then
      echo "You have codecheck warnings (see above) Please fix."
      exit 1 # CodeCheck warnings.
   fi
fi

# Do the actual build.
make -k -j3

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
  # Run the regression suite. Haven't gotten it working on osx, due to problems with xvfb and/or opengl support.
  cd ..
  ./regression_test.py -b build/src/widelands
fi