mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
add git commit hash to file version and log
This commit is contained in:
parent
7a8db6c189
commit
b5eea287d5
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
inc/version_tmp.h
|
||||||
|
|
||||||
# C++ Builder
|
# C++ Builder
|
||||||
|
|
||||||
__astcache/
|
__astcache/
|
||||||
|
@ -230,6 +230,12 @@ if NOT "$(LocalDebuggerWorkingDirectory)" == "$(ProjectDir)" if exist "$(LocalDe
|
|||||||
)
|
)
|
||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>echo | set /p dummyName=#define GIT_COMMIT > inc/version_tmp.h
|
||||||
|
"$(DevEnvDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin\git" rev-parse --short HEAD >> inc/version_tmp.h || git rev-parse --verify HEAD >> inc/version_tmp.h || echo UNKNOWN >> inc/version_tmp.h
|
||||||
|
|
||||||
|
SET ERRORLEVEL = 0</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -257,6 +263,12 @@ if NOT "$(LocalDebuggerWorkingDirectory)" == "$(ProjectDir)" if exist "$(LocalDe
|
|||||||
)
|
)
|
||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>echo | set /p dummyName=#define GIT_COMMIT > inc/version_tmp.h
|
||||||
|
"$(DevEnvDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin\git" rev-parse --short HEAD >> inc/version_tmp.h || git rev-parse --verify HEAD >> inc/version_tmp.h || echo UNKNOWN >> inc/version_tmp.h
|
||||||
|
|
||||||
|
SET ERRORLEVEL = 0</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -284,6 +296,12 @@ if NOT "$(LocalDebuggerWorkingDirectory)" == "$(ProjectDir)" if exist "$(LocalDe
|
|||||||
)
|
)
|
||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>echo | set /p dummyName=#define GIT_COMMIT > inc/version_tmp.h
|
||||||
|
"$(DevEnvDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin\git" rev-parse --short HEAD >> inc/version_tmp.h || git rev-parse --verify HEAD >> inc/version_tmp.h || echo UNKNOWN >> inc/version_tmp.h
|
||||||
|
|
||||||
|
SET ERRORLEVEL = 0</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugLogXP|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugLogXP|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -311,6 +329,12 @@ if NOT "$(LocalDebuggerWorkingDirectory)" == "$(ProjectDir)" if exist "$(LocalDe
|
|||||||
)
|
)
|
||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>echo | set /p dummyName=#define GIT_COMMIT > inc/version_tmp.h
|
||||||
|
"$(DevEnvDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin\git" rev-parse --short HEAD >> inc/version_tmp.h || git rev-parse --verify HEAD >> inc/version_tmp.h || echo UNKNOWN >> inc/version_tmp.h
|
||||||
|
|
||||||
|
SET ERRORLEVEL = 0</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugLogMiniXP|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugLogMiniXP|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -338,6 +362,12 @@ if NOT "$(LocalDebuggerWorkingDirectory)" == "$(ProjectDir)" if exist "$(LocalDe
|
|||||||
)
|
)
|
||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent>
|
||||||
|
<Command>echo | set /p dummyName=#define GIT_COMMIT > inc/version_tmp.h
|
||||||
|
"$(DevEnvDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin\git" rev-parse --short HEAD >> inc/version_tmp.h || git rev-parse --verify HEAD >> inc/version_tmp.h || echo UNKNOWN >> inc/version_tmp.h
|
||||||
|
|
||||||
|
SET ERRORLEVEL = 0</Command>
|
||||||
|
</PreBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets" />
|
<ImportGroup Label="ExtensionTargets" />
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#define str(s) #s
|
#define str(s) #s
|
||||||
#define ver_str(a,b,c,d) str(a) "." str(b) "." str(c) "." str(d)
|
#define ver_str(a,b,c,d) str(a) "." str(b) "." str(c) "." str(d)
|
||||||
|
#define git_str(a) str(a)
|
||||||
|
|
||||||
#define VERSION_MAJOR 6
|
#define VERSION_MAJOR 6
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
|
12
res.rc
12
res.rc
@ -1,5 +1,13 @@
|
|||||||
#include "inc/version.h"
|
#include "inc/version.h"
|
||||||
|
|
||||||
|
#ifndef __GNUC__
|
||||||
|
#include "inc/version_tmp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GIT_COMMIT
|
||||||
|
#define GIT_COMMIT UNKNOWN
|
||||||
|
#endif
|
||||||
|
|
||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
FILEVERSION VERSION
|
FILEVERSION VERSION
|
||||||
PRODUCTVERSION VERSION
|
PRODUCTVERSION VERSION
|
||||||
@ -10,13 +18,13 @@ PRODUCTVERSION VERSION
|
|||||||
{
|
{
|
||||||
VALUE "CompanyName", "github.com/FunkyFr3sh"
|
VALUE "CompanyName", "github.com/FunkyFr3sh"
|
||||||
VALUE "FileDescription", "DirectDraw replacement"
|
VALUE "FileDescription", "DirectDraw replacement"
|
||||||
VALUE "FileVersion", VERSION_STRING
|
VALUE "FileVersion", VERSION_STRING " (git~" git_str(GIT_COMMIT) ")"
|
||||||
VALUE "InternalName", "ddraw"
|
VALUE "InternalName", "ddraw"
|
||||||
VALUE "LegalCopyright", "Copyright (c) 2010-2024"
|
VALUE "LegalCopyright", "Copyright (c) 2010-2024"
|
||||||
VALUE "LegalTrademarks", ""
|
VALUE "LegalTrademarks", ""
|
||||||
VALUE "OriginalFileName", "ddraw.dll"
|
VALUE "OriginalFileName", "ddraw.dll"
|
||||||
VALUE "ProductName", "cnc-ddraw"
|
VALUE "ProductName", "cnc-ddraw"
|
||||||
VALUE "ProductVersion", VERSION_STRING
|
VALUE "ProductVersion", VERSION_STRING " (git~" git_str(GIT_COMMIT) ")"
|
||||||
VALUE "Comments", "https://github.com/FunkyFr3sh/cnc-ddraw"
|
VALUE "Comments", "https://github.com/FunkyFr3sh/cnc-ddraw"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
src/debug.c
16
src/debug.c
@ -10,6 +10,14 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "versionhelpers.h"
|
#include "versionhelpers.h"
|
||||||
|
|
||||||
|
#ifndef __GNUC__
|
||||||
|
#include "version_tmp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GIT_COMMIT
|
||||||
|
#define GIT_COMMIT UNKNOWN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
double g_dbg_frame_time = 0;
|
double g_dbg_frame_time = 0;
|
||||||
DWORD g_dbg_frame_count = 0;
|
DWORD g_dbg_frame_count = 0;
|
||||||
@ -151,7 +159,13 @@ void dbg_init()
|
|||||||
setvbuf(g_dbg_log_file, NULL, _IOLBF, 1024);
|
setvbuf(g_dbg_log_file, NULL, _IOLBF, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("cnc-ddraw version = %d.%d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION);
|
TRACE(
|
||||||
|
"cnc-ddraw version = %d.%d.%d.%d (git~%s)\n",
|
||||||
|
VERSION_MAJOR,
|
||||||
|
VERSION_MINOR,
|
||||||
|
VERSION_BUILD,
|
||||||
|
VERSION_REVISION,
|
||||||
|
git_str(GIT_COMMIT));
|
||||||
|
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
LONG status =
|
LONG status =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user