clone_depth: 50

image: Visual Studio 2019

branches:
    only:
        - master

install:
    - git submodule update --init --recursive

      # Download headers and pre-built binaries for SDL2 and SDL2_mixer
    - mkdir C:\RigelLibs
    - ps: Invoke-WebRequest -Uri https://www.libsdl.org/release/SDL2-devel-2.0.14-VC.zip -OutFile C:\RigelLibs\SDL2.zip
    - ps: Invoke-WebRequest -Uri https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip -OutFile C:\RigelLibs\SDL2_mixer.zip
    - 7z x C:\RigelLibs\SDL2.zip -oC:\RigelLibs
    - 7z x C:\RigelLibs\SDL2_mixer.zip -oC:\RigelLibs

platform: x64

configuration:
    - Debug
    - Release

before_build:
    - set SDL2DIR=C:\RigelLibs\SDL2-2.0.14
    - set SDL2MIXERDIR=C:\RigelLibs\SDL2_mixer-2.0.4

    - mkdir build
    - cd build
    - cmake .. -G "Visual Studio 16 2019" -DWARNINGS_AS_ERRORS=ON -DBUILD_BENCHMARKS=ON -DBUILD_TESTS=ON
    - cd ..

build:
    parallel: true
    project: build/RigelEngine.sln
    verbosity: minimal

before_test:
    - set PATH=%PATH%;%SDL2DIR%\lib\x64;%SDL2MIXERDIR%\lib\x64

test_script:
    - cd build
    - ctest
    - C:\projects\rigelengine\build\src\%CONFIGURATION%\RigelEngine.exe --help

after_build:
  - 7z a rigelengine_win_x64.zip C:\projects\rigelengine\build\src\%CONFIGURATION%\RigelEngine.exe %SDL2DIR%\lib\x64\SDL2.dll %SDL2MIXERDIR%\lib\x64\*.dll

artifacts:
    - path: rigelengine_win_x64.zip
      name: RigelBuild
