language: cpp
dist:     xenial
notifications:
  email:  false
services:
  - docker

matrix:
  include:
    - os:         linux
      env:        TARGET=system-qt4-linux
      addons:
        apt:
          packages:
          - libqtwebkit-dev

    - os:         linux
      env:        TARGET=system-qt5-linux
      addons:
        apt:
          packages:
          - libqt5webkit5-dev
          - libqt5xmlpatterns5-dev
          - libqt5svg5-dev

    - os:         linux
      env:        TARGET=custom-qt4-linux

    - os:         osx
      osx_image:  xcode9.3
      env:        TARGET=custom-qt4-macos

    - os:         windows
      env:        TARGET=custom-qt4-windows

install:
- sed -i -e 's/quiet = 0/quiet = 1/g' qt/bin/syncqt
- test -n "$CC"  && unset CC
- test -n "$CXX" && unset CXX
- git clone https://github.com/wkhtmltopdf/packaging.git ../packaging

script:
- >
    if   [[ $TARGET == "system-qt4-linux"   ]]; then qmake-qt4 CONFIG+=silent && make;
    elif [[ $TARGET == "system-qt5-linux"   ]]; then /usr/lib/x86_64-linux-gnu/qt5/bin/qmake CONFIG+=silent && make;
    elif [[ $TARGET == "custom-qt4-linux"   ]]; then ../packaging/build compile-docker stretch-amd64   $PWD ../build;
    elif [[ $TARGET == "custom-qt4-windows" ]]; then
        choco install -yr --no-progress python2 nsis vcbuildtools && \
        choco install -yr --no-progress cmake --installargs 'ADD_CMAKE_TO_PATH=System' && \
        export PATH="$(powershell -Command '("Process", "Machine" | % { [Environment]::GetEnvironmentVariable("PATH", $_) -Split ";" -Replace "\\$", "" } | Select -Unique | % { cygpath $_ }) -Join ":"')" && \
        C:/Python27/Scripts/pip install -q conan && \
        sed -i 's/-W3/-w/g' qt/mkspecs/win32-msvc2015/qmake.conf && \
        C:/Python27/python ../packaging/build vagrant msvc2015-win64 --version - - $PWD;
    elif [[ $TARGET == "custom-qt4-macos"   ]]; then
        brew install conan && sudo -H pip install pyyaml --ignore-installed six && sudo gem install fpm --no-ri --no-rdoc && \
        sudo xcode-select --switch /Library/Developer/CommandLineTools && \
        MACOSX_DEPLOYMENT_TARGET=10.7 ../packaging/build vagrant macos-cocoa --clean --version - - $PWD;
    fi
