0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 16:34:05 +01:00
nodejs/tools/msvs/vswhere_usability_wrapper.cmd
Michaël Zasso 4e2d1a1433
build,tools: support building with Visual Studio 2019
Add a `vs2019` option to `vcbuild.bat` to use VS 2019 instead of VS 2017

PR-URL: https://github.com/nodejs/node/pull/28781
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com>
2019-07-27 11:48:28 +02:00

32 lines
1.2 KiB
Batchfile

:: Copyright 2017 - Refael Ackermann
:: Distributed under MIT style license
:: See accompanying file LICENSE at https://github.com/node4good/windows-autoconf
:: version: 2.0.0
@if not defined DEBUG_HELPER @ECHO OFF
setlocal
if "%~1"=="prerelease" set VSWHERE_WITH_PRERELEASE=1
set "InstallerPath=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
if not exist "%InstallerPath%" set "InstallerPath=%ProgramFiles%\Microsoft Visual Studio\Installer"
if not exist "%InstallerPath%" goto :no-vswhere
:: Manipulate %Path% for easier " handeling
set "Path=%Path%;%InstallerPath%"
where vswhere 2> nul > nul
if errorlevel 1 goto :no-vswhere
set VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
set VSWHERE_PRP=-property installationPath
set VSWHERE_LMT=-version %1
vswhere -prerelease > nul
if not errorlevel 1 if "%VSWHERE_WITH_PRERELEASE%"=="1" set "VSWHERE_LMT=%VSWHERE_LMT% -prerelease"
SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT%
for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
endlocal
set "VCINSTALLDIR=%%i\VC\"
set "VS150COMNTOOLS=%%i\Common7\Tools\"
exit /B 0
)
:no-vswhere
endlocal
exit /B 1