version: '{branch}-{build}'
image: Visual Studio 2015

environment:
 matrix:
  - QTDIR: C:\Qt\5.6\mingw49_32
    MINGWDIR: C:\Qt\Tools\mingw492_32
    CMAKE_GENERATOR: "MinGW Makefiles"
  - QTDIR: C:\Qt\5.6\msvc2013
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.6\msvc2013_64
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.6\msvc2015
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.6\msvc2015_64
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.7\msvc2015
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.9\mingw53_32
    MINGWDIR: C:\Qt\Tools\mingw530_32
    CMAKE_GENERATOR: "MinGW Makefiles"
  - QTDIR: C:\Qt\5.9\msvc2015
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.9\msvc2013_64
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.9\msvc2015_64
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.10\mingw53_32
    MINGWDIR: C:\Qt\Tools\mingw530_32
    CMAKE_GENERATOR: "MinGW Makefiles"
  - QTDIR: C:\Qt\5.10\msvc2015
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.10\msvc2013_64
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.10\msvc2015_64
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.11\mingw53_32
    MINGWDIR: C:\Qt\Tools\mingw530_32
    CMAKE_GENERATOR: "MinGW Makefiles"
  - QTDIR: C:\Qt\5.11\msvc2015
    CMAKE_GENERATOR: "NMake Makefiles"
  - QTDIR: C:\Qt\5.11\msvc2015_64
    CMAKE_GENERATOR: "NMake Makefiles"

install:
 - set PATH=%QTDIR%\bin;%MINGWDIR%\bin;%PATH%
 - qmake -v
 - if %QTDIR:_64=%==%QTDIR% ( set ARCH=x86 ) else set ARCH=x64
 - if %QTDIR:_64=%==%QTDIR% ( set OPENSSL_ROOT_DIR=C:\OpenSSL-Win32 ) else set OPENSSL_ROOT_DIR=C:\OpenSSL-Win64
 - if %QTDIR:msvc=%==%QTDIR% g++ --version
 - if %QTDIR:msvc=%==%QTDIR% set make=mingw32-make.exe
 - if %QTDIR:msvc=%==%QTDIR% set PATH=%QTDIR%\bin;%MINGWDIR%\bin;C:\Program Files (x86)\CMake\bin
 - if %QTDIR:msvc=%==%QTDIR% %make% --version
 - if not %QTDIR:msvc2013=%==%QTDIR% call "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %ARCH%
 - if not %QTDIR:msvc2015=%==%QTDIR% call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH%
 - if not %QTDIR:msvc=%==%QTDIR% set make=nmake.exe
 - if not %QTDIR:msvc=%==%QTDIR% %make% /? > nul

build_script:
 - cd %APPVEYOR_BUILD_FOLDER%
 - cmake . -G "%CMAKE_GENERATOR%" -DQTERM_ENABLE_SCRIPT_DEBUGGER=On -DCMAKE_BUILD_TYPE=Release -DQT5=Yes
 - '%make% VERBOSE=1'
 - if not %QTDIR:msvc=%==%QTDIR% %make% package

artifacts:
 - path: QTerm*-win64.exe
   name: Win64Installer
 - path: QTerm*-win32.exe
   name: Win32Installer

deploy:
  - provider: GitHub
    artifact: Win64Installer
    auth_token:
      secure: wc0cFfZSLHWbW3W8FKqgVPHQfF0bV1l54wkpLcpsq4EuBliQdwfV+4JLnWuHBdr4
    on:
      appveyor_repo_tag: true
      QTDIR: C:\Qt\5.11\msvc2015_64
  - provider: GitHub
    artifact: Win32Installer
    auth_token:
      secure: wc0cFfZSLHWbW3W8FKqgVPHQfF0bV1l54wkpLcpsq4EuBliQdwfV+4JLnWuHBdr4
    on:
      appveyor_repo_tag: true
      QTDIR: C:\Qt\5.11\msvc2015
