appveyor: Increase build coverage to all VS solutions

Using the 'for' construct allows the specification of a more complex
build matrix. This additionally simplifies the builds using MinGW and
Cygwin because the build script can be unified and does not require
checking for the 'Release' configuration.

This change also extends the MinGW builds to cover both 32-bit and
64-bit builds using GCC versions 6.3.0 and 8.1.0, respectively. The
Cygwin builds were similarly extended to include 64-bit build coverage.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
diff --git a/appveyor.yml b/appveyor.yml
index ae4704c..42279ba 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,34 +1,72 @@
 version: 1.0.{build}
-image: Visual Studio 2015
-configuration:
-- Debug
-- Release
+image:
+  - Visual Studio 2013
+  - Visual Studio 2015
+  - Visual Studio 2017
+  - Visual Studio 2019
 platform:
-- x64
-- Win32
+  - Win32
+  - x64
+configuration:
+  - Debug
+  - Release
+clone_depth: 1
 build:
-  project: msvc\libusb_2015.sln
   parallel: true
-  verbosity: detailed
-environment:
-  matrix:
-  - libusb_2015: msvc\libusb_2015.sln
-    libusb_2013: msvc\libusb_2013.sln
-install:
-- cmd: >-
-    rem Copying libusb to cygwin home directory
+for:
+  -
+    matrix:
+      only:
+        - image: Visual Studio 2013
+    build:
+      project: msvc\libusb_2013.sln
 
-    xcopy /S C:\projects\libusb C:\cygwin\home\appveyor\
+  -
+    matrix:
+      only:
+        - image: Visual Studio 2015
+          configuration: Debug
+    build:
+      project: msvc\libusb_2015.sln
 
-    rem Copying libusb to MinGW home directory
+  -
+    matrix:
+      only:
+        - image: Visual Studio 2015
+          platform: Win32
+          configuration: Release
+    install:
+      - cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\msys64\home\appveyor\libusb
+      - cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\cygwin\home\appveyor\libusb
+    build_script:
+      - cmd: msbuild "%APPVEYOR_BUILD_FOLDER%\msvc\libusb_2015.sln" /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+      - cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" MinGW
+      - cmd: C:\cygwin\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" cygwin
 
-    xcopy /S C:\projects\libusb C:\msys64\home\appveyor\
-build_script:
-- cmd: >-
-    msbuild %libusb_2015% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+  -
+    matrix:
+      only:
+        - image: Visual Studio 2015
+          platform: x64
+          configuration: Release
+    install:
+      - cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\msys64\home\appveyor\libusb
+      - cmd: xcopy /S /I "%APPVEYOR_BUILD_FOLDER%" C:\cygwin64\home\appveyor\libusb
+    build_script:
+      - cmd: msbuild "%APPVEYOR_BUILD_FOLDER%\msvc\libusb_2015.sln" /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+      - cmd: C:\msys64\usr\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" MinGW
+      - cmd: C:\cygwin64\bin\bash -l "%APPVEYOR_BUILD_FOLDER%\appveyor_build.sh" cygwin
 
-    msbuild %libusb_2013% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+  -
+    matrix:
+      only:
+        - image: Visual Studio 2017
+    build:
+      project: msvc\libusb_2017.sln
 
-    appveyor_minGW.bat
-
-    appveyor_cygwin.bat
+  -
+    matrix:
+      only:
+        - image: Visual Studio 2019
+    build:
+      project: msvc\libusb_2019.sln
diff --git a/appveyor_build.sh b/appveyor_build.sh
new file mode 100644
index 0000000..7e6bed7
--- /dev/null
+++ b/appveyor_build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -eu
+
+buildsys="${1}-${Platform}"
+
+if [ "${buildsys}" == "MinGW-Win32" ]; then
+	export PATH="/c/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin:${PATH}"
+elif [ "${buildsys}" == "MinGW-x64" ]; then
+	export PATH="/c/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin:${PATH}"
+fi
+
+set -x
+
+builddir="build-${buildsys}"
+installdir="${PWD}/libusb-${buildsys}"
+
+cd libusb
+./bootstrap.sh
+mkdir "${builddir}"
+cd "${builddir}"
+../configure --prefix="${installdir}" --enable-examples-build --enable-tests-build
+make -j4
+make install
diff --git a/appveyor_cygwin.bat b/appveyor_cygwin.bat
deleted file mode 100644
index 80c7a7e..0000000
--- a/appveyor_cygwin.bat
+++ /dev/null
@@ -1,11 +0,0 @@
-echo on
-SetLocal EnableDelayedExpansion
-
-if [%Configuration%] NEQ [Release] exit 0
-if [%Platform%] NEQ [Win32] exit 0
-
-C:\cygwin\bin\bash -e -l -c "./bootstrap.sh" || exit /B
-C:\cygwin\bin\bash -e -l -c "mkdir build-Win32-cygwin" || exit /B
-C:\cygwin\bin\bash -e -l -c "cd build-Win32-cygwin && ../configure --enable-examples-build --enable-tests-build" || exit /B
-C:\cygwin\bin\bash -e -l -c "cd build-Win32-cygwin && make -j4" || exit /B
-C:\cygwin\bin\bash -e -l -c "cd build-Win32-cygwin && make install" || exit /B
\ No newline at end of file
diff --git a/appveyor_minGW.bat b/appveyor_minGW.bat
deleted file mode 100644
index 3ed6272..0000000
--- a/appveyor_minGW.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-echo on
-SetLocal EnableDelayedExpansion
-
-if [%Configuration%] NEQ [Release] exit 0
-
-if [%Platform%] NEQ [x64] goto Win32
-C:\msys64\usr\bin\bash -e -l -c "./bootstrap.sh" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "mkdir build-x64" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "cd build-x64 && ../configure --prefix=/mingw64 --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-examples-build --enable-tests-build" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "cd build-x64 && make -j4" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "cd build-x64 && make install" || exit /B
-
-:Win32
-if [%Platform%] NEQ [Win32] exit 0
-C:\msys64\usr\bin\bash -e -l -c "./bootstrap.sh" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "mkdir build-Win32" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "cd build-Win32 && ../configure --prefix=/mingw32 --build=i686-w64-mingw32 --host=i686-w64-mingw32 --enable-examples-build --enable-tests-build" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "cd build-Win32 && make -j4" || exit /B
-C:\msys64\usr\bin\bash -e -l -c "cd build-Win32 && make install" || exit /B
\ No newline at end of file
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 09a9295..2c5b766 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11472
+#define LIBUSB_NANO 11473