From c4ca31313f8155e8c531f61d576c13eb07a8fd51 Mon Sep 17 00:00:00 2001
From: LoneWolfHT <lonewolf04361@gmail.com>
Date: Thu, 7 Jul 2022 12:44:48 -0700
Subject: [PATCH] Add MSVC CI build (#26)

---
 .github/workflows/build.yml | 59 +++++++++++++++++++++++++++++++++++++
 .gitignore                  |  4 +++
 2 files changed, 63 insertions(+)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5feea3e4..b45988dc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -118,3 +118,62 @@ jobs:
       - name: Test (headless)
         run: |
           ./bin/OSX/AutomatedTest null
+
+  msvc:
+    name: VS 2019 ${{ matrix.config.arch }}
+    runs-on: windows-2019
+    env:
+      VCPKG_VERSION: 14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44
+        # 2022.05.10
+      vcpkg_packages: zlib libpng libjpeg-turbo opengl-registry
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          -
+            arch: x86
+            generator: "-G'Visual Studio 16 2019' -A Win32"
+            vcpkg_triplet: x86-windows
+          -
+            arch: x64
+            generator: "-G'Visual Studio 16 2019' -A x64"
+            vcpkg_triplet: x64-windows
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Restore from cache and run vcpkg
+        uses: lukka/run-vcpkg@v7
+        with:
+          vcpkgArguments: ${{env.vcpkg_packages}}
+          vcpkgDirectory: '${{ github.workspace }}\vcpkg'
+          appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
+          vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
+          vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
+
+      - name: CMake
+        run: |
+            cmake ${{matrix.config.generator}}  `
+            -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake"  `
+            -DCMAKE_BUILD_TYPE=Release .
+
+      - name: Build
+        run: cmake --build . --config Release
+
+      - name: Create artifact folder
+        run: |
+          mkdir artifact/
+          mkdir artifact/lib/
+
+      - name: Move dlls into artifact folder
+        run: move bin\Win32-VisualStudio\Release\* artifact\lib\
+
+      - name: Move includes into artifact folder
+        run: move include artifact/
+
+      - name: Upload Artifact
+        uses: actions/upload-artifact@v2
+        with:
+          name: msvc-${{ matrix.config.arch }}
+          path: artifact/
diff --git a/.gitignore b/.gitignore
index 901d81ce..09bcdd59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,7 @@ bin/Linux
 scripts/gl2ext.h
 scripts/glcorearb.h
 scripts/glext.h
+*.vcxproj*
+*.dir/
+*.sln
+*visualstudio/