diff --git a/app/windows/kdevelop-msvc.bat b/app/windows/kdevelop-msvc.bat --- a/app/windows/kdevelop-msvc.bat +++ b/app/windows/kdevelop-msvc.bat @@ -3,19 +3,35 @@ setlocal enabledelayedexpansion setlocal enableextensions -REM load Visual Studio 2017 developer command prompt if VS150COMNTOOLS isn't set. Read Windows registry in case VS is not istalled on C:\ -for /f "usebackq tokens=3*" %%a in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /s`) do ( - set vs15_path=%%a %%b - if exist "!vs15_path!Common7\Tools\VsDevCmd.bat" ( - set "VS150COMNTOOLS=!vs15_path!Common7\Tools\" - goto :end - ) - ) +IF NOT DEFINED VS160COMNTOOLS ( + REM load Visual Studio 2019 developer command prompt if VS150COMNTOOLS is not set. It's ugly and hardcoded too. + for %%n in (Enterprise Professional Community BuildTools) do ( + set "p=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\%%n\Common7\Tools\" + if exist "!p!\VsDevCmd.bat" ( + set "VS160COMNTOOLS=!p!" + goto :endvs16 + ) + ) ) -:end +:endvs16 + +REM Check for newest VS (2017) too. These variables are defined if the script is run from Developer Command Prompt +IF NOT DEFINED VS150COMNTOOLS ( + REM load Visual Studio 2017 developer command prompt if VS150COMNTOOLS is not set. It's ugly and hardcoded too. + for %%n in (Enterprise Professional Community BuildTools) do ( + set "p=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\%%n\Common7\Tools\" + if exist "!p!\VsDevCmd.bat" ( + set "VS150COMNTOOLS=!p!" + goto :endvs15 + ) + ) +) +:endvs15 set base= -if DEFINED VS150COMNTOOLS ( +if DEFINED VS160COMNTOOLS ( + set "base=%VS160COMNTOOLS%" +) else ( IF DEFINED VS150COMNTOOLS ( set "base=%VS150COMNTOOLS%" ) else ( IF DEFINED VS140COMNTOOLS ( set "base=%VS140COMNTOOLS%" @@ -25,16 +41,19 @@ set "base=%VS110COMNTOOLS%" ) else ( IF DEFINED VS100COMNTOOLS ( set "base=%VS100COMNTOOLS%" -) )))) +) ))))) if NOT DEFINED base ( START CMD /C "echo The Microsoft Visual C++ compiler was not found on your system, you might not be able to compile programs. && PAUSE" ) echo Found VS Install: %base% -if DEFINED VS150COMNTOOLS ( - REM Note: VS2017 has a different directory layout compared to previous versions +if DEFINED VS150COMNTOOLS set NEWLAYOUT=1 +if DEFINED VS160COMNTOOLS set NEWLAYOUT=1 + +if DEFINED NEWLAYOUT ( + REM Note: VS2017+ has a different directory layout compared to previous versions set "vcvarsall=%base%..\..\VC\Auxiliary\Build\vcvarsall.bat" REM Choosing architecture echo Note: Refer to !vcvarsall! for more information