sudo: required
dist: bionic
language: cpp

git:
  submodules: false

addons:
  apt:
    sources:
      - sourceline: 'deb https://apt.kitware.com/ubuntu/ xenial main'
        key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
    packages:
    - libasound2-dev
    - libfftw3-dev
    - libhunspell-dev
    - libfribidi-dev
    - libass-dev
    - libicu-dev
    - luarocks
    - cmake
    - build-essential
    - libboost-all-dev
    - libffms2-dev
    - libfontconfig1-dev
    - libalut-dev
    - libuchardet-dev
    - libwxgtk3.0-dev
    - portaudio19-dev
    - libpulse-dev

matrix:
  include:
  - {}
  - env: BUILD_SUIT=autotools

install:
- sudo luarocks install busted > /dev/null
- sudo luarocks install moonscript > /dev/null
- sudo luarocks install uuid > /dev/null
# Remove the CMake provided by travis
- sudo rm -rf /usr/local/cmake*
- if [ "$BUILD_SUIT" = "autotools" ]; then
    sudo pip install -U cpp-coveralls;
    git submodule --quiet init;
    git submodule --quiet update vendor/googletest;
  fi

script:
- if [ "$BUILD_SUIT" = "autotools" ]; then
    export CPPFLAGS="-fprofile-arcs -ftest-coverage";
    export LIBS="-lgcov";
    ./autogen.sh;
    ./configure --enable-debug || cat config.log;
    make -j2;
    make test || travis_terminate 1;
    coveralls --exclude vendor --exclude src --exclude build --exclude tools --exclude libaegisub/windows > /dev/null;
  else
    ./build/version.sh .;
    mkdir build-dir;
    cd build-dir;
    cmake -DCMAKE_CXX_FLAGS='-Wall -Wextra -pedantic -std=gnu++11' ..;
    make -j2;
  fi

notifications:
  email:
  - on_success: change
  - on_failure: change

