Skip to content

Commit

Permalink
Merge pull request HaxeFoundation#796 from Stencyl/vsdetect-fix
Browse files Browse the repository at this point in the history
Let other MSVC locations be found even if vswhere exists
  • Loading branch information
hughsando authored Apr 10, 2023
2 parents a50a031 + a64bc6a commit 54811e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions toolchain/msvc-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
Expand Down
10 changes: 7 additions & 3 deletions toolchain/msvc64-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
Expand All @@ -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
)
)

0 comments on commit 54811e4

Please sign in to comment.