1e66f31c5Sopenharmony_ci:: Copyright 2017 - Refael Ackermann
2e66f31c5Sopenharmony_ci:: Distributed under MIT style license or the libuv license
3e66f31c5Sopenharmony_ci:: See accompanying file LICENSE at https://github.com/node4good/windows-autoconf
4e66f31c5Sopenharmony_ci:: or libuv LICENSE file at https://github.com/libuv/libuv
5e66f31c5Sopenharmony_ci:: version: 2.0.0
6e66f31c5Sopenharmony_ci
7e66f31c5Sopenharmony_ci@if not defined DEBUG_HELPER @ECHO OFF
8e66f31c5Sopenharmony_cisetlocal
9e66f31c5Sopenharmony_ciif "%~1"=="prerelease" set VSWHERE_WITH_PRERELEASE=1
10e66f31c5Sopenharmony_ciset "InstallerPath=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
11e66f31c5Sopenharmony_ciif not exist "%InstallerPath%" set "InstallerPath=%ProgramFiles%\Microsoft Visual Studio\Installer"
12e66f31c5Sopenharmony_ciif not exist "%InstallerPath%" goto :no-vswhere
13e66f31c5Sopenharmony_ci:: Manipulate %Path% for easier " handeling
14e66f31c5Sopenharmony_ciset "Path=%Path%;%InstallerPath%"
15e66f31c5Sopenharmony_ciwhere vswhere 2> nul > nul
16e66f31c5Sopenharmony_ciif errorlevel 1 goto :no-vswhere
17e66f31c5Sopenharmony_ciset VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
18e66f31c5Sopenharmony_ciset VSWHERE_PRP=-property installationPath
19e66f31c5Sopenharmony_ciset VSWHERE_LMT=-version "[15.0,16.0)"
20e66f31c5Sopenharmony_civswhere -prerelease > nul
21e66f31c5Sopenharmony_ciif not errorlevel 1 if "%VSWHERE_WITH_PRERELEASE%"=="1" set "VSWHERE_LMT=%VSWHERE_LMT% -prerelease"
22e66f31c5Sopenharmony_ciSET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT%
23e66f31c5Sopenharmony_cifor /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
24e66f31c5Sopenharmony_ci    endlocal
25e66f31c5Sopenharmony_ci    set "VCINSTALLDIR=%%i\VC\"
26e66f31c5Sopenharmony_ci    set "VS150COMNTOOLS=%%i\Common7\Tools\"
27e66f31c5Sopenharmony_ci    exit /B 0
28e66f31c5Sopenharmony_ci)
29e66f31c5Sopenharmony_ci
30e66f31c5Sopenharmony_ci:no-vswhere
31e66f31c5Sopenharmony_ciendlocal
32e66f31c5Sopenharmony_ciecho could not find "vswhere"
33e66f31c5Sopenharmony_ciexit /B 1