0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

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 <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ken Takata 2024-08-03 14:40:35 +02:00 committed by Christian Brabandt
parent cdf1c7a73a
commit 87d63d34b6
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 26 additions and 34 deletions

View File

@ -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 '.\version.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 '.\version.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 ![$(PS) $(PSFLAGS) try{Out-File -FilePath '.\patchlvl.tmp' -InputObject \
\"PATCHLEVEL=$$([decimal^]((Get-Content -Path '.\version.c' \
-TotalCount ((Select-String -Pattern 'static int included_patches' \
-Path '.\version.c').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)

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
657,
/**/
656,
/**/