version: '0.0.3-{build}'

os: Visual Studio 2017
platform: x64
clone_folder: C:\rpcs3
clone_depth: 3
test: off

configuration:
# Release
 - ReleaseLLVM

before_build:
 - ps: $env:Date="$(git show -s --date=short --format='%ad')"
 - git submodule update --init 3rdparty/ffmpeg 3rdparty/pugixml asmjit 3rdparty/GSL 3rdparty/libpng Vulkan/glslang Vulkan/Vulkan-LoaderAndValidationLayers Utilities/yaml-cpp 3rdparty/cereal 3rdparty/zlib 3rdparty/hidapi 3rdparty/Optional
 - 7z x zlib.7z -aos -oC:\rpcs3\ > null
 - 7z x vulkan.7z -aos -oC:\rpcs3\Vulkan > null
 - set BRANCH=%APPVEYOR_REPO_NAME%/%APPVEYOR_REPO_BRANCH%/#%APPVEYOR_PULL_REQUEST_NUMBER%
 - if "%APPVEYOR_PULL_REQUEST_NUMBER%"=="" (set BRANCH=%APPVEYOR_REPO_NAME%/%APPVEYOR_REPO_BRANCH%)
 - set CXXFLAGS=-DBRANCH=%BRANCH%
 - if %configuration%==Release (cmake -G "Visual Studio 15 Win64" -DZLIB_ROOT=C:/rpcs3/zlib/ -DVULKAN_PREBUILT=ON)
   else (7z x llvmlibs.7z -aos -oC:\rpcs3 > null && cmake -G "Visual Studio 15 Win64" -DLLVM_DIR=C:/rpcs3/llvm_build/lib/cmake/llvm -DZLIB_ROOT=C:/rpcs3/zlib/ -DVULKAN_PREBUILT=ON)

build_script:
 - cmake --build . --config Release -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

install:
 - if not exist llvmlibs.7z appveyor DownloadFile "https://drive.google.com/uc?export=download&id=0B-BE73aaGDNxdG1PM1JPb0hNeHM" -FileName llvmlibs.7z
 - if not exist vulkan.7z appveyor DownloadFile "https://drive.google.com/uc?export=download&id=0B8A6NaxhQAGRaHYxV3VOS2d0a0U" -FileName vulkan.7z
 - if not exist zlib.7z appveyor DownloadFile "https://drive.google.com/uc?export=download&id=0B-HVE3xvheVFX05lRFdnZlh5aUU" -FileName zlib.7z
 - set QTDIR=C:\Qt\5.9.1\msvc2017_64
 - set OPENALDIR=C:\rpcs3\3rdparty\OpenAL
 - set PATH=C:\Program Files (x86)\MSBuild\15.0\Bin;%QTDIR%;%PATH%
 - set COMMIT_SHA=%APPVEYOR_REPO_COMMIT:~0,8%

artifacts:
 - path: bin
   name: 'rpcs3-v0.0.3-$(Date)-$(COMMIT_SHA)_win64'
   type: zip

cache:
 - llvmlibs.7z -> appveyor.yml
 - vulkan.7z -> appveyor.yml
 - zlib.7z -> appveyor.yml
