patch 9.1.0657: MS-Windows: MSVC build time can be optimized Commit: https://github.com/vim/vim/commit/87d63d34b6f25611db9cc7c7a13d785574e8ec43 Author: Ken Takata <ken...@csc.jp> Date: Sat Aug 3 14:40:35 2024 +0200
patch 9.1.0657: MS-Windows: MSVC build time can be optimized Problem: MS-Windows: MSVC build time can be optimized Solution: Stop using Powershell, show detected version, read _MSC_VER and _MSC_FULL_VER in a single cl execution. (Ken Takata) closes: #15421 Signed-off-by: Ken Takata <ken...@csc.jp> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 65efe306a..65a8798a9 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -163,14 +163,14 @@ # nmake -f Make_mvc.mvc "DEFINES=-DEMACS_TAGS" RM = del /f /q -PS = powershell.exe -PSFLAGS = -NoLogo -NoProfile -Command +# Read MAJOR and MINOR from version.h. +!IF ![for /f "tokens=2,3" %I in (version.h) do \ + @if "%I"=="VIM_VERSION_MAJOR" ( echo MAJOR=%J>.\major.tmp ) \ + else if "%I"=="VIM_VERSION_MINOR" ( echo MINOR=%J>.\minor.tmp )] +!ENDIF -!IF ![$(PS) $(PSFLAGS) try{Out-File -FilePath '.\major.tmp' -InputObject \ - \"MAJOR=$$(((Select-String -Pattern 'VIM_VERSION_MAJOR\s+\d{1,2}' \ - -Path '. ersion.h').Line[-2..-1^]-join '').Trim())\"} \ - catch{exit 1}] +!IF EXIST(.\major.tmp) ! INCLUDE .\major.tmp ! IF [$(RM) .\major.tmp] ! ENDIF @@ -179,10 +179,7 @@ PSFLAGS = -NoLogo -NoProfile -Command MAJOR = 9 !ENDIF -!IF ![$(PS) $(PSFLAGS) try{Out-File -FilePath '.\minor.tmp' -InputObject \ - \"MINOR=$$(((Select-String -Pattern 'VIM_VERSION_MINOR\s+\d{1,2}' \ - -Path '. ersion.h').Line[-2..-1^]-join '').Trim())\"} \ - catch{exit 1}] +!IF EXIST(.\minor.tmp) ! INCLUDE .\minor.tmp ! IF [$(RM) .\minor.tmp] ! ENDIF @@ -191,24 +188,23 @@ MAJOR = 9 MINOR = 1 !ENDIF -!IF .LineNumber+3))[-1^]).Trim().TrimEnd(','))\"} \ - catch{exit 1}] +# Read PATCHLEVEL from version.c. +!IF ![cmd.exe /V:ON /C "echo off && set LINE=0&& set FIND=0&& \ + for /f "tokens=1,3 delims=,[ " %I in (version.c) do \ + ( set /A LINE+=1 > NUL && \ + if "%J"=="included_patches" ( set /A FIND=LINE+3 > NUL ) \ + else if "!LINE!"=="!FIND!" ( echo PATCHLEVEL=%I>.\patchlvl.tmp && exit ) )"] +!ENDIF +!IF EXIST(.\patchlvl.tmp) ! INCLUDE .\patchlvl.tmp ! IF [$(RM) .\patchlvl.tmp] ! ENDIF !ENDIF - -# Build on Windows NT/XP - -TARGETOS = WINNT - !IFDEF PATCHLEVEL RCFLAGS = -DVIM_VERSION_PATCHLEVEL=$(PATCHLEVEL) !ENDIF +!message Vim version: $(MAJOR).$(MINOR).$(PATCHLEVEL) !if "$(VIMDLL)" == "yes" @@ -299,7 +295,9 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes LINK = link # Check VC version. -!if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul] +!if [echo MSVCVER=_MSC_VER> msvcver.c && \ + echo MSVC_FULL=_MSC_FULL_VER>> msvcver.c && \ + $(CC) /EP msvcver.c > msvcver.~ 2> nul] ! message *** ERROR ! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. ! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. @@ -320,19 +318,6 @@ LINK = link MSVC_MAJOR = ($(MSVCVER) / 100 - 5) MSVCRT_VER = ($(MSVCVER) / 100 * 10 - 50) -# Calculate MSVC_FULL. -!if [echo MSVC_FULL=_MSC_FULL_VER> msvcfullver.c && $(CC) /EP msvcfullver.c > msvcfullver.~ 2> nul] -! message *** ERROR -! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. -! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. -! error Make aborted. -!else -! include msvcfullver.~ -! if [del msvcfullver.c msvcfullver.~] -! endif -!endif - - # Calculate MSVCRT_VER !if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0 ! include msvcrtver.~ @@ -340,6 +325,11 @@ MSVCRT_VER = ($(MSVCVER) / 100 * 10 - 50) ! endif !endif +# Show the versions (for debugging). +#!message _MSC_VER=$(MSVCVER) +#!message _MSC_FULL_VER=$(MSVC_FULL) +#!message MSVCRT_VER=$(MSVCRT_VER) + # Base name of the msvcrXX.dll (vcruntimeXXX.dll) MSVCRT_NAME = vcruntime$(MSVCRT_VER) diff --git a/src/version.c b/src/version.c index 4a985b910..c36aa5119 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 657, /**/ 656, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1saE8F-00CM8A-7k%40256bit.org.