version: 0.8.3.{build}
image: Visual Studio 2022
configuration: Release
platform: x64
install:
- cmd: >-
    call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

    appveyor DownloadFile "https://github.com/joedrago/nasm_mirror/raw/master/nasm-2.15.05-win64.zip" -FileName "nasm.zip"

    7z x "nasm.zip"

    move nasm-* NASM

    set PATH=%PATH%;%CD%\NASM;

    nasm -v

    cd ext\libavif\ext\libyuv

    mkdir build

    cd build

    cmake -G "NMake Makefiles" -DBUILD_SHARED_LIBS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..

    nmake yuv

    copy yuv.lib libyuv.a

    cd ..\..\libwebp

    mkdir build

    cd build

    cmake -G "NMake Makefiles" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DWEBP_LINK_STATIC=ON -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_LIBWEBPMUX=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF ..

    nmake sharpyuv

    copy libsharpyuv.lib libsharpyuv.a

    cd ..\..\dav1d

    mkdir build

    cd build

    meson setup --default-library=static --buildtype release -Denable_tools=false -Denable_tests=false ..

    ninja

    cd ..\..\aom

    mkdir build.libavif

    cd build.libavif

    cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCONFIG_AV1_DECODER=0 -DCONFIG_AV1_ENCODER=1 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DCONFIG_PIC=1 -DCONFIG_WEBM_IO=0 ..

    ninja

    copy aom.lib libaom.a

    cd ..\..\..\..\libavif

    mkdir build

    cd build

    cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON -DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_AOM_ENCODE=ON -DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON -DAVIF_LOCAL_LIBYUV=ON ..

    ninja

    copy avif.lib libavif.a

    cd ..

    mkdir build-ro

    cd build-ro

    cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON -DAVIF_LOCAL_LIBYUV=ON ..

    ninja

    copy avif.lib libavif.a

    cd ..\..\..
build_script:
- cmd: >-
    C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe qt-avif-image-plugin_local-libavif.pro

    nmake.exe

    cd qtbuild_5.15.2-ro

    C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe qt-avif-image-plugin_local_alternative-libavif-ro.pro

    nmake.exe

    cd ..\qtbuild_6.2.4

    C:\Qt\6.2.4\msvc2019_64\bin\qmake.exe qt-avif-image-plugin_local_alternative-libavif.pro

    nmake.exe

    cd ..\qtbuild_6.5.3

    C:\Qt\6.5.3\msvc2019_64\bin\qmake.exe qt-avif-image-plugin_local_alternative-libavif.pro

    nmake.exe

    cd ..\qtbuild_6.5.3-ro

    C:\Qt\6.5.3\msvc2019_64\bin\qmake.exe qt-avif-image-plugin_local_alternative-libavif-ro.pro

    nmake.exe

artifacts:
- path: plugins\imageformats\*.dll
- path: qtbuild_5.15.2-ro\plugins\imageformats\*.dll
- path: qtbuild_6.2.4\*.dll
- path: qtbuild_6.5.3\*.dll
- path: qtbuild_6.5.3-ro\*.dll
