# global environment variables
environment:
  global:
    # path to source directory of project to be built
    PROJECT_DIR: .
    # output test results for failing tests
    CTEST_OUTPUT_ON_FAILURE: 1

  # test matrix
  matrix:

    - TOOLCHAIN: "vs-14-2015-sdk-8-1"
      GENERATOR: "Visual Studio 14 2015 Win64"
      TEST_TARGET: RUN_TESTS
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

    - TOOLCHAIN: "vs-14-2015-win64"
      GENERATOR: "Visual Studio 14 2015 Win64"
      TEST_TARGET: RUN_TESTS
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

    - TOOLCHAIN: "vs-15-2017-win64"
      GENERATOR: "Visual Studio 15 2017 Win64"
      TEST_TARGET: RUN_TESTS
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

    - TOOLCHAIN: "vs-15-2017-win64-cxx17"
      GENERATOR: "Visual Studio 15 2017 Win64"
      TEST_TARGET: RUN_TESTS
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

    - TOOLCHAIN: "mingw-cxx11"
      GENERATOR: "MinGW Makefiles"
      MINGW_PATH: "C:\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev1\\mingw64\\bin"
      TEST_TARGET: test
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

    - TOOLCHAIN: "mingw-gnuxx11"
      GENERATOR: "MinGW Makefiles"
      MINGW_PATH: "C:\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev1\\mingw64\\bin"
      TEST_TARGET: test
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

    - TOOLCHAIN: "mingw-cxx17"
      GENERATOR: "MinGW Makefiles"
      MINGW_PATH: "C:\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev1\\mingw64\\bin"
      TEST_TARGET: test
      APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017

install:
  # Remove entry with sh.exe from PATH to fix error with MinGW toolchain
  # (For MinGW make to work correctly sh.exe must NOT be in your path)
  # * http://stackoverflow.com/a/3870338/2288008
  - cmd: set PATH=%PATH:C:\Program Files\Git\usr\bin;=%

  # set MINGW path
  - cmd: IF DEFINED MINGW_PATH set PATH=%MINGW_PATH%;%PATH%

  # Visual Studio 15 2017: Mimic behavior of older versions
  - cmd: set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools

build_script:
  - cmd: cmake -H. -B_build_%TOOLCHAIN%_Debug -G "%GENERATOR%" -DCMAKE_TOOLCHAIN_FILE="%cd%\toolchains\%TOOLCHAIN%.cmake"
  - cmd: cmake --build _build_%TOOLCHAIN%_Debug --config Debug
  #- cmd: cmake -H. -B_build_%TOOLCHAIN%_Release -G "%GENERATOR%" -DCMAKE_TOOLCHAIN_FILE="%cd%\toolchains\%TOOLCHAIN%.cmake"
  #- cmd: cmake --build _build_%TOOLCHAIN%_Release --config Release
  # add git back to PATH for `diff` command in case of error
  - cmd: set PATH=C:\Program Files\Git\usr\bin;%PATH%
  - cmd: IF DEFINED TEST_TARGET cmake --build _build_%TOOLCHAIN%_Debug --target %TEST_TARGET%
  #- cmd: IF DEFINED TEST_TARGET cmake --build _build_%TOOLCHAIN%_Release --target %TEST_TARGET%

