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