# If this file isn't being read correctly by Appveyor, make sure the Github connection is correct/reset.
environment:
  P: "c:/projects/libs"

branches:
  only:
    - master
    
version: '{build}'

image:
- Visual Studio 2019

init:
  - git config --global core.autocrlf input
  - echo %APPVEYOR_BUILD_WORKER_IMAGE%
  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( set generator="Visual Studio 16 2019" )
  - echo %generator%


shallow_clone: true
clone_folder: c:\projects\SDL_gpu

install:
  - mkdir c:\projects\libs
  # Download SDL.
  - ps: Start-FileDownload 'https://www.libsdl.org/release/SDL2-devel-2.0.12-VC.zip' 'c:/projects/libs/SDL.zip'
  
  # Extract it, put it in the right place, and rename it.
  - cd c:\projects\libs && 7z x SDL.zip && ren SDL2-2.0.12 SDL2 && cd c:\projects\SDL_gpu


platform:
  - Win32
  - x64

configuration:
  - Debug
  - Release

before_build:
  - cd c:\projects\SDL_gpu
  - set /p project_version=<version.txt
  - set zip_name=SDL_gpu-%project_version%-VS-%platform%-%configuration%.zip
  - echo "Building %zip_name%"
  - echo "Platform %platform%"
  - echo "generator %generator%"
  - echo Running cmake...
  - mkdir build
  - cd build
  - if "%configuration%"=="Debug" ( set build_tests=OFF )
  - if "%configuration%"=="Debug" ( set build_demos=OFF )
  - if "%configuration%"=="Release" ( set build_tests=OFF )
  - if "%configuration%"=="Release" ( set build_demos=OFF )
  - cmd: cmake -G %generator% -A %platform% -DCMAKE_INSTALL_PREFIX=c:\projects\libs\SDL2 -DBUILD_DEMOS=%build_demos% -DBUILD_TESTS=%build_tests% -DBUILD_TOOLS=%build_demos% -DBUILD_SHARED=ON -DBUILD_STATIC=ON ..

after_build:
  - cd c:\projects\SDL_gpu\build\SDL_gpu-VS
#  - cmd: cmake -P cmake_install.cmake
  - 7z a c:\projects\SDL_gpu\%zip_name% * -tzip
  - cd c:\projects\SDL_gpu

artifacts:
  - path: "%zip_name%"
    name: "%zip_name%"

deploy_script:
  - cd c:\projects\SDL_gpu
#  - curl -T SDL_gpu.zip --user %ACCOUNT% https://www.dinomage.com/SDL_gpu.zip