From 7f2a9f680664d6d3d6659611f88b6dd921c98c87 Mon Sep 17 00:00:00 2001 From: TheLastRar Date: Tue, 18 Jan 2022 21:41:47 +0000 Subject: [PATCH] Build: Use git tag for file version on windows --- common/vsprops/preBuild.cmd | 7 +++++++ pcsx2/SysForwardDefs.h | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/common/vsprops/preBuild.cmd b/common/vsprops/preBuild.cmd index a107662886..72860f430f 100644 --- a/common/vsprops/preBuild.cmd +++ b/common/vsprops/preBuild.cmd @@ -55,6 +55,13 @@ if %ERRORLEVEL% NEQ 0 ( echo #define SVN_REV 0ll >> "%CD%\svnrev.h" echo #define GIT_REV "" >> "%CD%\svnrev.h" echo #define GIT_TAG "%GIT_TAG%" >> "%CD%\svnrev.h" + + for /F "tokens=1,2,3 delims=v." %%a in ("%GIT_TAG%") do ( + echo #define GIT_TAG_HI %%a >> "%CD%\svnrev.h" + echo #define GIT_TAG_MID %%b >> "%CD%\svnrev.h" + echo #define GIT_TAG_LO %%c >> "%CD%\svnrev.h" + ) + echo #define GIT_TAGGED_COMMIT 1 >> "%CD%\svnrev.h" ) else ( echo #define SVN_REV %REV%ll > "%CD%\svnrev.h" diff --git a/pcsx2/SysForwardDefs.h b/pcsx2/SysForwardDefs.h index 48f8ef18c3..d3b048e792 100644 --- a/pcsx2/SysForwardDefs.h +++ b/pcsx2/SysForwardDefs.h @@ -14,10 +14,19 @@ */ #pragma once +#include "svnrev.h" -#define PCSX2_VersionHi 1 -#define PCSX2_VersionMid 7 -#define PCSX2_VersionLo 0 +#define PCSX2_isReleaseVersion false + +#if PCSX2_isReleaseVersion == false && GIT_TAGGED_COMMIT +#define PCSX2_VersionHi GIT_TAG_HI +#define PCSX2_VersionMid GIT_TAG_MID +#define PCSX2_VersionLo GIT_TAG_LO +#else +#define PCSX2_VersionHi 1 +#define PCSX2_VersionMid 7 +#define PCSX2_VersionLo 0 +#endif #define STRINGIZE2(s) #s #define STRINGIZE(s) STRINGIZE2(s) @@ -36,8 +45,6 @@ #define VER_INTERNAL_NAME_STR VER_ORIGINAL_FILENAME_STR #define VER_COPYRIGHT_STR "Copyright (C) 2021" -static const bool PCSX2_isReleaseVersion = 0; - class SysCoreThread; class CpuInitializerSet;