version: 0.0.{build}
environment:
  global:
    CFLAGS: /MP
    TERM: xterm
  matrix:
    # array of all environments used to test builds
    # Note that we require relatively modern Visual Studio, in order to pick
    # up snprintf.  You don't want the older versions of VS, really!
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
#      GENERATOR: Visual Studio 15 2017
      GENERATOR: Ninja
      CFG: Debug
      VSINSTALL: '"Microsoft Visual Studio"/2017/Community/VC/Auxiliary/Build'
      MSVC_PLATFORM: x86
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
#      GENERATOR: Visual Studio 15 2017 Win64
      GENERATOR: Ninja
      CFG: Debug
      VSINSTALL: '"Microsoft Visual Studio"/2017/Community/VC/Auxiliary/Build'
      MSVC_PLATFORM: amd64


cache:
  - C:\ProgramData\chocolatey\bin -> appveyor.yml
  - C:\ProgramData\chocolatey\lib -> appveyor.yml

install:
  - ps: |
      choco install ninja


init:
  - cmake --version
  - C:\"Program Files (x86)"/%VSINSTALL%/vcvarsall.bat %MSVC_PLATFORM%

build:
  parallel: true

build_script:
  - cmd: md build
  - cmd: cd build
  - cmd: cmake -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%CFG% ..
  - cmd: cmake --build .

test_script:
  - cmd: ctest --output-on-failure -C "%CFG%"
