version: 1.6.x-{build}

branches:
  except:
    - /libpng[0-1][0-7]/

image:
  - Visual Studio 2022

shallow_clone: true

environment:
  matrix:
    - TOOLCHAIN: vstudio
      AUTOMATION: cmake
      ARCH: x86
    - TOOLCHAIN: vstudio
      AUTOMATION: cmake
      ARCH: x64
    - TOOLCHAIN: vstudio
      AUTOMATION: cmake
      ARCH: arm64
      CI_NO_TEST: 1
    - TOOLCHAIN: msys2
      AUTOMATION: cmake
      ARCH: i686
    - TOOLCHAIN: msys2
      AUTOMATION: cmake
      ARCH: x86_64
    - TOOLCHAIN: msys2
      AUTOMATION: autotools
      ARCH: i686
    - TOOLCHAIN: msys2
      AUTOMATION: autotools
      ARCH: x86_64
    - TOOLCHAIN: msys2
      AUTOMATION: legacy
      ARCH: i686
    - TOOLCHAIN: msys2
      AUTOMATION: legacy
      ARCH: x86_64

install:
  - 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
  - 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe integrate install'

before_build:
  - 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_VARS=-DCMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
  - 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_GENERATOR=Visual Studio 17 2022'
  - 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x86" set CI_CMAKE_GENERATOR_PLATFORM=Win32'
  - 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x64" set CI_CMAKE_GENERATOR_PLATFORM=x64'
  - 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_GENERATOR_PLATFORM=ARM64'
  - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" set CI_CMAKE_GENERATOR=Unix Makefiles'
  - 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="i686" set PATH=C:\msys64\mingw32\bin;%PATH%'
  - 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="x86_64" set PATH=C:\msys64\mingw64\bin;%PATH%'
  - 'if "%TOOLCHAIN%"=="msys2" set CI_CC=%ARCH%-w64-mingw32-gcc'
  - 'set CI_CMAKE_BUILD_FLAGS=--parallel 2'
  - 'set CI_CTEST_FLAGS=--parallel 2'
  - 'set CI_MAKE_FLAGS=-j2'
  - 'set CI_LEGACY_MAKEFILES=scripts/makefile.gcc scripts/makefile.msys scripts/makefile.std'

build_script:
  - 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"'
  - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"'
  - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="autotools" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_autotools.sh"'
  - 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="legacy" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_legacy.sh"'

cache:
  - C:\tools\vcpkg\installed
