# HG changeset patch # User Bram Moolenaar # Date 1663758003 -7200 # Node ID 54dda39c5bb3471f80fdf4052548f266b9067b60 # Parent 841afbdd1981f013c2cc5d4ff73e8c01731fc883 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions Commit: https://github.com/vim/vim/commit/c3430cb583ff05722e33195e4818c88a59bb2fee Author: K.Takata Date: Wed Sep 21 11:56:41 2022 +0100 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) diff --git a/Filelist b/Filelist --- 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 --- 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 --- /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 --- /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 --- /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 --- /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 --- a/src/version.c +++ b/src/version.c @@ -700,6 +700,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 528, +/**/ 527, /**/ 526,