image:
  - Visual Studio 2019

environment:
  PATH: C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\Windows\System32;C:\Windows;%PATH%

  matrix:
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      GENERATOR: Visual Studio 16 2019
      ARCHITECTURE: Win32
      CONFIG: Release
      SHARED_LIBS: ON
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      GENERATOR: Visual Studio 16 2019
      ARCHITECTURE: Win32
      CONFIG: Release
      SHARED_LIBS: OFF
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      GENERATOR: Visual Studio 16 2019
      ARCHITECTURE: x64
      CONFIG: Release
      SHARED_LIBS: ON
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      GENERATOR: Visual Studio 16 2019
      ARCHITECTURE: x64
      CONFIG: Release
      SHARED_LIBS: OFF

init:
  # update mysy2
  - C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy pacman-mirrors"
  - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu"
  - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy autoconf perl git automake libtool"

before_build:
  - bash autogen.sh
  - mkdir build
  - cd build
  - cmake .. -G "%GENERATOR%" -A "%ARCHITECTURE%" -DBUILD_SHARED_LIBS=%SHARED_LIBS% -DCMAKE_INSTALL_PREFIX=../local

build_script:
  - cmake --build . --config %CONFIG%

test_script:
  - ctest -C %CONFIG% --timeout 150 --output-on-failure

on_failure:
  - 7z a Testing.zip Testing
  - appveyor PushArtifact Testing.zip

artifacts:
  - path: build
    type: zip
