version: '2.4.{build}'

# branches to build
branches:
  # whitelist
  only:
    - master

image:
#- Visual Studio 2015
- Visual Studio 2017

environment: 
  matrix:
    # Win32/x64/Debug
    - platform: x64
      configuration: Debug
      cmake_args: -D CMAKE_INSTALL_PREFIX=install
      platform_name: Windows

    # Win32/x64/Release
    - platform: x64
      configuration: Release
      cmake_args: -D CMAKE_INSTALL_PREFIX=install
      platform_name: Windows

    # UWP/x64/Debug
    - platform: x64
      configuration: Debug
      cmake_args: -D CMAKE_INSTALL_PREFIX=install -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0
      platform_name: UWP

    # UWP/x64/Release
    - platform: x64
      configuration: Release
      cmake_args: -D CMAKE_INSTALL_PREFIX=install -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0
      platform_name: UWP

    # Win32/x86/Release
    - platform: Win32
      configuration: Release
      cmake_args: -D CMAKE_INSTALL_PREFIX=install
      platform_name: Windows

    # UWP/x86/Release
    - platform: Win32
      configuration: Release
      cmake_args: -D CMAKE_INSTALL_PREFIX=install -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0
      platform_name: UWP

    # Win32-8.1SDK/x64/Release
    - platform: x64
      configuration: Release
      cmake_args: -D CMAKE_INSTALL_PREFIX=install -D CMAKE_SYSTEM_VERSION=8.1
      platform_name: Windows8.1

# clone directory
clone_folder: c:\projects\DiligentCore

install:
  # clone submodules
  - git submodule update --init --recursive

  # Install a recent CMake
  - set CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-win64-x64.zip"
  - appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip
  - 7z x cmake.zip -oC:\projects\deps > nul
  - move C:\projects\deps\cmake-* C:\projects\deps\cmake # Move to a version-agnostic directory
  - set PATH=C:\projects\deps\cmake\bin;C:\Python37;%PATH%
  - cmake --version
  - python --version
  - echo %PLATFORM%
  - if "%PLATFORM%"=="x64" ( set generator_arch=x64 ) else ( set generator_arch=Win32 )

before_build:
  - cd c:\projects\DiligentCore
  - echo %generator_arch%
  - echo %cmake_args%
  - cmake %cmake_args% -S . -B ./cmk_build -G "Visual Studio 15 2017" -A %generator_arch%

build:
  project: c:\projects\DiligentCore\cmk_build\INSTALL.vcxproj
  verbosity: minimal
  parallel: true

after_test:
  - cd install
  - 7z a DiligentCore-"%platform_name%"-"%PLATFORM%"-"%CONFIGURATION%".zip
    DiligentCore\*

artifacts:
  - path: install\*.zip
    name: artifacts-zip
