From c3430cb583ff05722e33195e4818c88a59bb2fee Mon Sep 17 00:00:00 2001 From: "K.Takata" Date: Wed, 21 Sep 2022 11:56:41 +0100 Subject: patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions Problem: MS-Windows: no batch files for more recent MSVC versions. Solution: Add batch files for 2017, 2019 and 2022. (Ken Takata, closes #11184) --- Filelist | 4 +++ src/INSTALLpc.txt | 7 +++++- src/msvc-latest.bat | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/msvc2017.bat | 13 ++++++++++ src/msvc2019.bat | 13 ++++++++++ src/msvc2022.bat | 13 ++++++++++ src/version.c | 2 ++ 7 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 src/msvc-latest.bat create mode 100644 src/msvc2017.bat create mode 100644 src/msvc2019.bat create mode 100644 src/msvc2022.bat diff --git a/Filelist b/Filelist index 014a801374..ac936e1b24 100644 --- a/Filelist +++ b/Filelist @@ -538,7 +538,11 @@ SRC_DOS = \ tools/rename.bat \ src/bigvim.bat \ src/bigvim64.bat \ + src/msvc-latest.bat \ src/msvc2015.bat \ + src/msvc2017.bat \ + src/msvc2019.bat \ + src/msvc2022.bat \ src/msys32.bat \ src/msys64.bat \ src/dlldata.c \ diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index a73f718946..9a286447c2 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -70,10 +70,15 @@ Visual Studio Building with Visual Studio (VS2015, VS2017, VS2019 and VS2022) is straightforward. Older versions probably don't work. -Visual Studio installed a batch file called vcvars32.bat, which you must +Visual Studio installed a batch file called vcvarsall.bat, which you must run to set up paths for nmake and MSVC. We provide a batch file "msvc2015.bat" for this. You may need to edit it if you didn't instal Visual Studio in the standard location. +If you use VS2017 or later, you can use "msvc-latest.bat" (or "msvc2017.bat" +and so on for the specific version). You must specify the architecture (e.g. +"x86", "x64", etc.) as the first argument when you use this. If you use VS2017 +Express, you must use "x86_amd64" instead of "x64" for targeting the x64 +platform. To build Vim from the command line with MSVC, use Make_mvc.mak. diff --git a/src/msvc-latest.bat b/src/msvc-latest.bat new file mode 100644 index 0000000000..4529fa02eb --- /dev/null +++ b/src/msvc-latest.bat @@ -0,0 +1,72 @@ +@echo off +rem To be used on MS-Windows for Visual C++ 2017 or later. +rem See INSTALLpc.txt for information. +rem +rem Usage: +rem For x86 builds run this with "x86" option: +rem msvc-latest x86 +rem For x64 builds run this with "x86_amd64" option or "x64" option: +rem msvc-latest x86_amd64 +rem msvc-latest x64 +rem +rem Optional environment variables: +rem VSWHERE: +rem Full path to vswhere.exe. +rem VSVEROPT: +rem Option to search specific version of Visual Studio. +rem Default: -latest +rem To search VS2017: +rem set "VSVEROPT=-version [15.0^,16.0^)" +rem To search VS2019: +rem set "VSVEROPT=-version [16.0^,17.0^)" +rem To search VS2022: +rem set "VSVEROPT=-version [17.0^,18.0^)" + +if "%VSWHERE%"=="" ( + set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" + set VSWHERE_SET=yes +) +if not exist "%VSWHERE%" ( + echo Error: vswhere not found. + set VSWHERE= + set VSWHERE_SET= + exit /b 1 +) + +if "%VSVEROPT%"=="" ( + set VSVEROPT=-latest + set VSVEROPT_SET=yes +) + +rem Search Visual Studio Community, Professional or above. +for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( + set InstallDir=%%i +) +if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" ( + call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %* + goto done +) + +rem Search Visual Studio 2017 Express. +rem (Visual Studio 2017 Express uses different component IDs.) +for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products Microsoft.VisualStudio.Product.WDExpress -property installationPath`) do ( + set InstallDir=%%i +) +if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" ( + call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %* +) else ( + echo Error: vcvarsall.bat not found. + rem Set ERRORLEVEL to 1. + call +) + +:done +if "%VSWHERE_SET%"=="yes" ( + set VSWHERE= + set VSWHERE_SET= +) +if "%VSVEROPT_SET%"=="yes" ( + set VSVEROPT= + set VSVEROPT_SET= +) +set InstallDir= diff --git a/src/msvc2017.bat b/src/msvc2017.bat new file mode 100644 index 0000000000..c7731c92c9 --- /dev/null +++ b/src/msvc2017.bat @@ -0,0 +1,13 @@ +@echo off +rem To be used on MS-Windows for Visual C++ 2017. +rem See INSTALLpc.txt for information. +rem +rem Usage: +rem For x86 builds run this with "x86" option: +rem msvc2017 x86 +rem For x64 builds run this with "x86_amd64" option: +rem msvc2017 x86_amd64 + +set "VSVEROPT=-version [15.0^,16.0^)" +call "%~dp0msvc-latest.bat" %* +set VSVEROPT= diff --git a/src/msvc2019.bat b/src/msvc2019.bat new file mode 100644 index 0000000000..a45ef2c564 --- /dev/null +++ b/src/msvc2019.bat @@ -0,0 +1,13 @@ +@echo off +rem To be used on MS-Windows for Visual C++ 2019. +rem See INSTALLpc.txt for information. +rem +rem Usage: +rem For x86 builds run this with "x86" option: +rem msvc2019 x86 +rem For x64 builds run this with "x64" option: +rem msvc2019 x64 + +set "VSVEROPT=-version [16.0^,17.0^)" +call "%~dp0msvc-latest.bat" %* +set VSVEROPT= diff --git a/src/msvc2022.bat b/src/msvc2022.bat new file mode 100644 index 0000000000..b707410070 --- /dev/null +++ b/src/msvc2022.bat @@ -0,0 +1,13 @@ +@echo off +rem To be used on MS-Windows for Visual C++ 2022. +rem See INSTALLpc.txt for information. +rem +rem Usage: +rem For x86 builds run this with "x86" option: +rem msvc2022 x86 +rem For x64 builds run this with "x64" option: +rem msvc2022 x64 + +set "VSVEROPT=-version [17.0^,18.0^)" +call "%~dp0msvc-latest.bat" %* +set VSVEROPT= diff --git a/src/version.c b/src/version.c index 21ff87dc3b..ddb9431f0b 100644 --- a/src/version.c +++ b/src/version.c @@ -699,6 +699,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 528, /**/ 527, /**/ -- cgit v1.2.3