• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:: Copyright 2020 - Rene Ferdinand Rivera Morell
2:: Copyright 2017 - Refael Ackermann
3:: Copyright 2019 - Thomas Kent
4:: Distributed under MIT style license
5:: See accompanying file LICENSE at https://github.com/node4good/windows-autoconf
6:: Forked from version: 1.15.4
7
8@if not defined DEBUG_HELPER @ECHO OFF
9setlocal
10set "InstallerPath=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
11if not exist "%InstallerPath%" set "InstallerPath=%ProgramFiles%\Microsoft Visual Studio\Installer"
12if not exist "%InstallerPath%" goto :no-vswhere
13:: Manipulate %Path% for easier " handeling
14set Path=%Path%;%InstallerPath%
15where vswhere 2> nul > nul
16if errorlevel 1 goto :no-vswhere
17set VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
18set VSWHERE_PRP=-property installationPath
19
20REM Visual Studio Unknown Version, Beyond 2019
21set VSWHERE_LMT=-version "[17.0,18.0)"
22set VSWHERE_PRERELEASE=-prerelease
23SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT% %VSWHERE_PRERELEASE%
24for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
25    endlocal
26	echo Found with vswhere %%i
27    @rem comment out setting VCINSTALLDIR for Boost.build
28    @rem set "VCINSTALLDIR=%%i\VC\"
29    set "VSUNKCOMNTOOLS=%%i\Common7\Tools\"
30    exit /B 0
31)
32
33REM Visual Studio 2019 (16.X, toolset 14.2)
34set VSWHERE_LMT=-version "[16.0,17.0)"
35SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT%
36for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
37    endlocal
38	echo Found with vswhere %%i
39    @rem comment out setting VCINSTALLDIR for Boost.build
40    @rem set "VCINSTALLDIR=%%i\VC\"
41    set "VS160COMNTOOLS=%%i\Common7\Tools\"
42    exit /B 0
43)
44
45REM Visual Studio 2017 (15.X, toolset 14.1)
46set VSWHERE_LMT=-version "[15.0,16.0)"
47SET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT%
48for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
49    endlocal
50	echo Found with vswhere %%i
51    @rem comment out setting VCINSTALLDIR for Boost.build
52    @rem set "VCINSTALLDIR=%%i\VC\"
53    set "VS150COMNTOOLS=%%i\Common7\Tools\"
54    exit /B 0
55)
56
57:no-vswhere
58endlocal
59echo could not find "vswhere"
60exit /B 1