From a64bc6a1fac67727088bac624f72eaa3685f1ee5 Mon Sep 17 00:00:00 2001 From: Justin Espedal Date: Mon, 20 May 2019 22:17:55 -0700 Subject: [PATCH] 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. --- toolchain/msvc-setup.bat | 9 +++++++-- toolchain/msvc64-setup.bat | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/toolchain/msvc-setup.bat b/toolchain/msvc-setup.bat index 5a6ee978c..9a6dd2a1a 100644 --- a/toolchain/msvc-setup.bat +++ b/toolchain/msvc-setup.bat @@ -3,11 +3,14 @@ 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 ) @@ -15,10 +18,12 @@ setlocal enabledelayedexpansion @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 diff --git a/toolchain/msvc64-setup.bat b/toolchain/msvc64-setup.bat index 181fb9961..0244981b7 100644 --- a/toolchain/msvc64-setup.bat +++ b/toolchain/msvc64-setup.bat @@ -8,7 +8,9 @@ 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 ) @@ -16,10 +18,12 @@ setlocal enabledelayedexpansion @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 -) +) \ No newline at end of file