version: '{build}'

build:
    verbosity: detailed

branches:
    only:
        - master

environment:
    matrix:
        - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
          COMPILER: cl.exe
          MSVC_BAT: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
          MSVC_BAT_ARCH: x86
          GENERATOR: "Visual Studio 14 2015 Win64"
          APPVEYOR_SAVE_CACHE_ON_ERROR: true
          DLL_PATH: lib\Release\fec.dll

install:
    - call "%APPVEYOR_BUILD_FOLDER%\\.appveyor-install-tools.cmd"

before_build:
    - if DEFINED MSVC_BAT call "%MSVC_BAT%" %MSVC_BAT_ARCH%
    - cd %APPVEYOR_BUILD_FOLDER%

build_script:
    - mkdir build
    - cd build
    - cmake -G "%GENERATOR%" -DCMAKE_C_COMPILER=%COMPILER% -DCMAKE_CXX_COMPILER=%COMPILER% -DCMAKE_BUILD_TYPE=Release ..
    - cmake --build . --config Release --target shim
    - cmake --build . --config Release --target test_runners
    - dumpbin /EXPORTS %DLL_PATH%

test_script:
    - cd tests
    - set CTEST_OUTPUT_ON_FAILURE=1
    - ctest -C Release

cache:
    - C:\projects\tools\ninja
    - C:\projects\tools\cmake
    - C:\projects\tools\llvm-installer.exe
