image: Visual Studio 2022

version: '{build}'

environment:
  matrix:
  - MSYSTEM: MINGW64
    CPU: x86_64
    MSVC: amd64
    CONFIG_FLAGS: --enable-debug
  - MSYSTEM: MINGW64
    CPU: x86_64
    CONFIG_FLAGS: --enable-debug
    EXTRA_CFLAGS: "-fcommon"
  - MSYSTEM: MINGW32
    CPU: i686
    MSVC: x86
    CONFIG_FLAGS: --enable-debug
  - MSYSTEM: MINGW32
    CPU: i686
    CONFIG_FLAGS: --enable-debug
    EXTRA_CFLAGS: "-fcommon"
  - MSYSTEM: MINGW64
    CPU: x86_64
    MSVC: amd64
    CONFIG_FLAGS:
  - MSYSTEM: MINGW64
    CPU: x86_64
    CONFIG_FLAGS:
    EXTRA_CFLAGS: "-fcommon"
  - MSYSTEM: MINGW32
    CPU: i686
    MSVC: x86
    CONFIG_FLAGS:
  - MSYSTEM: MINGW32
    CPU: i686
    CONFIG_FLAGS:
    EXTRA_CFLAGS: "-fcommon"

install:
  - set PATH=c:\msys64\%MSYSTEM%\bin;c:\msys64\usr\bin;%PATH%
  - if "%MSVC%"=="amd64" call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
  - if "%MSVC%"=="x86"   call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat"
  - if defined MSVC pacman --noconfirm -Rsc mingw-w64-%CPU%-gcc gcc
  - pacman --noconfirm -Syuu
  - pacman --noconfirm -S autoconf

build_script:
  - bash -c "autoconf"
  - bash -c "./configure $CONFIG_FLAGS"
  - mingw32-make
  - file lib/jemalloc.dll
  - mingw32-make tests
  - mingw32-make -k check
