Commit ea3d601f authored by Kevin Funk's avatar Kevin Funk

windows: Detect VS2017 compiler and tools

Summary:
Visual Studio 2017 defines the VS150COMNTOOLS env variable which
kdevelop-msvc.bat ignored till now. By default VS does not set the
VS150COMNTOOLS as system-wide variable so we have to do be a bit more
clever to detect the VS2017 install.

Also allow to start using VS2017 compiler, using either 32 bit or 64 bit
compilers by prompting the user.

Reviewers: Petross404, brauch

Reviewed By: brauch

Subscribers: brauch, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D16123
parent 9c46acfe
......@@ -3,7 +3,23 @@
setlocal enabledelayedexpansion
setlocal enableextensions
if DEFINED VS140COMNTOOLS (
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 :end
)
)
)
:end
set base=
if DEFINED VS150COMNTOOLS (
set "base=%VS150COMNTOOLS%"
) else ( IF DEFINED VS140COMNTOOLS (
set "base=%VS140COMNTOOLS%"
) else ( IF DEFINED VS120COMNTOOLS (
set "base=%VS120COMNTOOLS%"
......@@ -11,12 +27,34 @@ if DEFINED VS140COMNTOOLS (
set "base=%VS110COMNTOOLS%"
) else ( IF DEFINED VS100COMNTOOLS (
set "base=%VS100COMNTOOLS%"
) else (
START CMD /C "The Microsoft Visual C++ compiler was not found on your system, you might not be able to compile programs. && PAUSE"
) )))
) ))))
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"
)
set script="!base!\..\..\VC\vcvarsall.bat"
call %script%
echo Found VS Install: %base%
if DEFINED VS150COMNTOOLS (
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
echo(
echo Define which compiler for VS2017 to use. Possible architectures are:
echo x86_amd64
echo x64
echo ...
set /p "arch= Type an arch and press enter...: "
set script="!vcvarsall!" !arch!
) else ( IF DEFINED base (
set script="!base!\..\..\VC\vcvarsall.bat"
) )
if DEFINED script (
call %script%
)
for /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\Software\KDE\KDevelop" /v Install_Dir 2^>nul`) DO (
set appdir=%%A %%B
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment