Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let other MSVC locations be found even if vswhere exists #796

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Let other MSVC locations be found even if vswhere exists
vswhere.exe may exist even if VS 2017 is not installed, or it's installed but the c++ tools are not. If this is the case, we should keep looking for an alternative install that works.
  • Loading branch information
justin-espedal committed May 21, 2019
commit a64bc6a1fac67727088bac624f72eaa3685f1ee5
9 changes: 7 additions & 2 deletions toolchain/msvc-setup.bat
Original file line number Diff line number Diff line change
@@ -3,22 +3,27 @@ setlocal enabledelayedexpansion
@call "%HXCPP_MSVC%\vcvars32.bat"
@echo HXCPP_VARS
@set
exit
) else if exist "%HXCPP_MSVC%\vsvars32.bat" (
@call "%HXCPP_MSVC%\vsvars32.bat"
@echo HXCPP_VARS
@set
) else if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
exit
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
@set InstallDir=%%i
)
@if exist "!InstallDir!\Common7\Tools\VsDevCmd.bat" (
@call "!InstallDir!\Common7\Tools\VsDevCmd.bat" -arch=x86 -app_platform=Desktop -no_logo
@echo HXCPP_VARS
@set
exit
) else (
echo Warning: Could not find Visual Studio 2017 VsDevCmd
)
) else if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" (
)
@if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" (
@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=x86 -app_platform=Desktop -no_logo
@echo HXCPP_VARS
@set
10 changes: 7 additions & 3 deletions toolchain/msvc64-setup.bat
Original file line number Diff line number Diff line change
@@ -8,18 +8,22 @@ setlocal enabledelayedexpansion
@echo HXCPP_VARS
@set
)
) else if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
exit
)
@if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
@set InstallDir=%%i
)
@if exist "!InstallDir!\Common7\Tools\VsDevCmd.bat" (
@call "!InstallDir!\Common7\Tools\VsDevCmd.bat" -arch=amd64 -app_platform=Desktop -no_logo
@echo HXCPP_VARS
@set
exit
) else (
echo Warning: Could not find Visual Studio 2017 VsDevCmd
)
) else if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" (
)
@if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" (
@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -app_platform=Desktop -no_logo
@echo HXCPP_VARS
@set
@@ -41,4 +45,4 @@ setlocal enabledelayedexpansion
@set
) else (
echo Error: 64bit is not automatically supported for this version of VC. Set HXCPP_MSVC_CUSTOM and manually configure the executable, library and include paths
)
)