Mercurial > vim
changeset 35893:34bc2c4a78c0 v9.1.0657
patch 9.1.0657: MS-Windows: MSVC build time can be optimized
Commit: https://github.com/vim/vim/commit/87d63d34b6f25611db9cc7c7a13d785574e8ec43
Author: Ken Takata <kentkt@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 <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 03 Aug 2024 14:45:11 +0200 |
parents | 1ce8e1321baa |
children | 4a886f736221 |
files | src/Make_mvc.mak src/version.c |
diffstat | 2 files changed, 27 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- 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 -!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}] +# 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 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)