• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:: Copyright 2017 - Refael Ackermann
2:: Distributed under MIT style license
3:: See accompanying file LICENSE at https://github.com/node4good/windows-autoconf
4:: version: 2.0.0
5
6@if not defined DEBUG_HELPER @ECHO OFF
7setlocal
8if "%~3"=="prerelease" set VSWHERE_WITH_PRERELEASE=1
9set "InstallerPath=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
10if not exist "%InstallerPath%" set "InstallerPath=%ProgramFiles%\Microsoft Visual Studio\Installer"
11if not exist "%InstallerPath%" goto :no-vswhere
12:: Manipulate %Path% for easier " handeling
13set "Path=%Path%;%InstallerPath%"
14where vswhere 2> nul > nul
15if errorlevel 1 goto :no-vswhere
16if "%2"=="arm64" (
17    set VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.ARM64
18) else (
19    set VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
20)
21set VSWHERE_PRP=-property installationPath
22set VSWHERE_LMT=-version %1
23vswhere -prerelease > nul
24if not errorlevel 1 if "%VSWHERE_WITH_PRERELEASE%"=="1" set "VSWHERE_LMT=%VSWHERE_LMT% -prerelease"
25SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT%
26for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
27    endlocal
28    set "VCINSTALLDIR=%%i\VC\"
29    set "VS150COMNTOOLS=%%i\Common7\Tools\"
30    exit /B 0
31)
32
33:no-vswhere
34endlocal
35exit /B 1
36