version: '{build}'
image: Visual Studio 2015
environment:
  matrix:
    # job names are used for FTP uploads, try to not change them
    - JOB_NAME: "win32"
      CMAKE_TARGET: "Visual Studio 14 2015"
      PLATFORM: "Win32"
      CMAKE_PLATFORM_TOOLSET: "-T v140"
    - JOB_NAME: "win64"
      CMAKE_TARGET: "Visual Studio 14 2015 Win64"
      PLATFORM: "x64"
      CMAKE_PLATFORM_TOOLSET: "-T v140"
    - JOB_NAME: "xp_compat"
      CMAKE_TARGET: "Visual Studio 14 2015"
      PLATFORM: "Win32"
      CMAKE_PLATFORM_TOOLSET: "-T v140_xp"
    # needs to be VS2017 because the LLVM toolset only exists there
    - JOB_NAME: "clang"
      CMAKE_TARGET: "Visual Studio 15 2017"
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
      PLATFORM: "Win32"
      CMAKE_PLATFORM_TOOLSET: "-T llvm"

install:
- cmd: >-
    mkdir build

    cd build

    set PATH=C:\MinGW\bin;%PATH%

    vcpkg integrate remove
    
    cmake %CMAKE_EXTRA_FLAGS% -G "%CMAKE_TARGET%" %CMAKE_PLATFORM_TOOLSET% ..\src

on_failure:
- cmd: >-

    type C:\projects\asar\build\CMakeFiles\CMakeOutput.log

    type C:\projects\asar\build\CMakeFiles\CMakeError.log

build:
  verbosity: minimal

artifacts:
- path: build\asar\bin\**\asar.exe
- path: build\asar\lib\**\*asar.dll

configuration: MinSizeRel

test_script:
  - cmd: >-
      cmake --build . --config MinSizeRel --target run-tests

deploy:
  provider: FTP
  protocol: sftp
  host: r9.pm
  username: asar_ftp
  password:
    secure: 2O8zpJfSlxa28ibgfgXNsca2OJhU4TAbOfpLaFcjf1BLqkLsjYHNlQ8p6PkI3Rki
  folder: asar/windows/$(APPVEYOR_REPO_BRANCH)/$(JOB_NAME)/
