language: c++
cache: ccache
sudo: enabled

os:
  - linux
  - osx
dist: bionic
osx_image: xcode10

before_script:
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; sudo apt-get install -y cppcheck cmake extra-cmake-modules libkf5globalaccel-dev libkf5notifications-dev libkf5windowsystem-dev libx11-dev qt5-qmake qtbase5-dev qtbase5-private-dev qttools5-dev-tools libglib2.0-dev zlib1g-dev qt5-default; fi
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cppcheck qt5 glib; brew link --force qt5; fi

script:
  - cppcheck -j1 --quiet -f --error-exitcode=2 -iplugins/stardict -iqxt .
  - qmake
  - make -j$(nproc || sysctl -n hw.ncpu)
  - sudo make install
