Build: Fix out-of-tree CMake scmversion extraction on Windows

This commit is contained in:
Stenzek 2024-12-08 02:57:32 +10:00
parent b6eb41e2cf
commit 1adf36ccb2
No known key found for this signature in database
1 changed files with 2 additions and 0 deletions

View File

@ -1,10 +1,12 @@
@echo off @echo off
SET VERSIONFILE="scmversion.cpp" SET VERSIONFILE="scmversion.cpp"
PUSHD %~dp0
FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse HEAD`) do (SET "HASH=%%g") FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse HEAD`) do (SET "HASH=%%g")
FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse --abbrev-ref HEAD`) do (SET "BRANCH=%%g") FOR /F "tokens=* USEBACKQ" %%g IN (`git rev-parse --abbrev-ref HEAD`) do (SET "BRANCH=%%g")
FOR /F "tokens=* USEBACKQ" %%g IN (`git describe --dirty`) do (SET "TAG=%%g") FOR /F "tokens=* USEBACKQ" %%g IN (`git describe --dirty`) do (SET "TAG=%%g")
FOR /F "tokens=* USEBACKQ" %%g IN (`git log -1 --date=iso8601-strict "--format=%%cd"`) do (SET "CDATE=%%g") FOR /F "tokens=* USEBACKQ" %%g IN (`git log -1 --date=iso8601-strict "--format=%%cd"`) do (SET "CDATE=%%g")
POPD
SET SIGNATURELINE=// %HASH% %BRANCH% %TAG% %CDATE% SET SIGNATURELINE=// %HASH% %BRANCH% %TAG% %CDATE%
SET /P EXISTINGLINE=< %VERSIONFILE% SET /P EXISTINGLINE=< %VERSIONFILE%