11cb0ef41Sopenharmony_ci:: Copyright 2017 - Refael Ackermann
21cb0ef41Sopenharmony_ci:: Distributed under MIT style license or the libuv license
31cb0ef41Sopenharmony_ci:: See accompanying file LICENSE at https://github.com/node4good/windows-autoconf
41cb0ef41Sopenharmony_ci:: or libuv LICENSE file at https://github.com/libuv/libuv
51cb0ef41Sopenharmony_ci:: version: 2.0.0
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci@if not defined DEBUG_HELPER @ECHO OFF
81cb0ef41Sopenharmony_cisetlocal
91cb0ef41Sopenharmony_ciif "%~1"=="prerelease" set VSWHERE_WITH_PRERELEASE=1
101cb0ef41Sopenharmony_ciset "InstallerPath=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
111cb0ef41Sopenharmony_ciif not exist "%InstallerPath%" set "InstallerPath=%ProgramFiles%\Microsoft Visual Studio\Installer"
121cb0ef41Sopenharmony_ciif not exist "%InstallerPath%" goto :no-vswhere
131cb0ef41Sopenharmony_ci:: Manipulate %Path% for easier " handeling
141cb0ef41Sopenharmony_ciset "Path=%Path%;%InstallerPath%"
151cb0ef41Sopenharmony_ciwhere vswhere 2> nul > nul
161cb0ef41Sopenharmony_ciif errorlevel 1 goto :no-vswhere
171cb0ef41Sopenharmony_ciset VSWHERE_REQ=-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
181cb0ef41Sopenharmony_ciset VSWHERE_PRP=-property installationPath
191cb0ef41Sopenharmony_ciset VSWHERE_LMT=-version "[15.0,16.0)"
201cb0ef41Sopenharmony_civswhere -prerelease > nul
211cb0ef41Sopenharmony_ciif not errorlevel 1 if "%VSWHERE_WITH_PRERELEASE%"=="1" set "VSWHERE_LMT=%VSWHERE_LMT% -prerelease"
221cb0ef41Sopenharmony_ciSET VSWHERE_ARGS=-latest -products * %VSWHERE_REQ% %VSWHERE_PRP% %VSWHERE_LMT%
231cb0ef41Sopenharmony_cifor /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
241cb0ef41Sopenharmony_ci    endlocal
251cb0ef41Sopenharmony_ci    set "VCINSTALLDIR=%%i\VC\"
261cb0ef41Sopenharmony_ci    set "VS150COMNTOOLS=%%i\Common7\Tools\"
271cb0ef41Sopenharmony_ci    exit /B 0
281cb0ef41Sopenharmony_ci)
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci:no-vswhere
311cb0ef41Sopenharmony_ciendlocal
321cb0ef41Sopenharmony_ciecho could not find "vswhere"
331cb0ef41Sopenharmony_ciexit /B 1