1@echo off
2Setlocal EnableDelayedExpansion
3
4if not defined VS set VS=15
5if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" (set VS=16)
6if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (set VS=15)
7if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (set VS=14)
8if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" (set VS=12)
9
10set ARCH=
11if %VS% LEQ 15 (
12	if not defined platform set platform=x64
13	if "!platform!" EQU "x64" (set VS=%VS% Win64)
14) else (
15	:: If -A is not specified, defaults to host arch
16	if "%platform%" EQU "x86" (set ARCH= -A Win32)
17	if "%platform%" EQU "x64" (set ARCH= -A x64)
18)
19
20cmake -H. -Bbuild -G"Visual Studio %VS%"%ARCH%
21cmake --build build --config Release
22copy build\Release\luv.dll .
23copy build\Release\luajit.exe .
24