aboutsummaryrefslogtreecommitdiff
path: root/build.bat
diff options
context:
space:
mode:
authorOskar Nordquist <oskar.nordquist@gmail.com>2022-11-26 11:48:09 -0500
committerOskar Nordquist <oskar.nordquist@gmail.com>2022-11-26 11:50:06 -0500
commita06f75b6fb0b6b1b3ceecc782175ab807985fe70 (patch)
tree70297a9606ae002106423f6d4a9af2878186c6f5 /build.bat
parentd6cb105d5f29506fc64abbccf8767a79539de1ae (diff)
Automatically initialize x64 environment if CL.exe is missing + make sure found CL.exe is for x64 (credit to mmozeiko)
Diffstat (limited to 'build.bat')
-rw-r--r--build.bat15
1 files changed, 15 insertions, 0 deletions
diff --git a/build.bat b/build.bat
index 06bc6c823..7391bd95f 100644
--- a/build.bat
+++ b/build.bat
@@ -2,6 +2,21 @@
setlocal EnableDelayedExpansion
+where /Q cl.exe || (
+ set __VSCMD_ARG_NO_LOGO=1
+ for /f "tokens=*" %%i in ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath') do set VS=%%i
+ if "!VS!" equ "" (
+ echo ERROR: Visual Studio installation not found
+ exit /b 1
+ )
+ call "!VS!\VC\Auxiliary\Build\vcvarsall.bat" amd64 || exit /b 1
+)
+
+if "%VSCMD_ARG_TGT_ARCH%" neq "x64" (
+ echo ERROR: please run this from MSVC x64 native tools command prompt, 32-bit target is not supported!
+ exit /b 1
+)
+
for /f "usebackq tokens=1,2 delims=,=- " %%i in (`wmic os get LocalDateTime /value`) do @if %%i==LocalDateTime (
set CURR_DATE_TIME=%%j
)