add git derived version info

This commit is contained in:
mq1n
2025-09-02 20:25:54 +03:00
parent dcc6675208
commit fd1df0b328
5 changed files with 42 additions and 2 deletions

View File

@@ -2,6 +2,8 @@
add_executable(db ${DB_SOURCES})
target_compile_definitions(db PRIVATE GIT_DESCRIBE="${GIT_DESCRIBE_VERSION}")
target_link_libraries(db
common
libgame

View File

@@ -1,6 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
#ifndef GIT_DESCRIBE
#define GIT_DESCRIBE "unknown"
#endif
void WriteVersion()
{
#ifndef OS_WINDOWS
@@ -8,7 +12,7 @@ void WriteVersion()
if (NULL != fp)
{
fprintf(fp, "db revision: %s\n", __P4_VERSION__);
fprintf(fp, "db revision: %s\n", GIT_DESCRIBE);
//fprintf(fp, "%s@%s:%s\n", __USER__, __HOSTNAME__, __PWD__);
fclose(fp);
}