Separate git commit subject line from comprevision, add SRB2_COMP_NOTE

This commit is contained in:
James R 2023-01-05 18:29:51 -08:00
parent f5b985bcc3
commit 55636fa690
7 changed files with 10 additions and 6 deletions

View file

@ -11,8 +11,9 @@ include(GitUtilities)
git_current_branch(SRB2_COMP_BRANCH)
git_working_tree_dirty(SRB2_COMP_UNCOMMITTED)
git_summary(revision)
string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_REVISION "${revision}")
git_latest_commit(SRB2_COMP_REVISION)
git_subject(subject)
string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_NOTE "${subject}")
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE None)

View file

@ -50,8 +50,8 @@ function(git_working_tree_dirty variable)
endif()
endfunction()
function(git_summary variable)
_git_easy_command(log -1 "--format=%h %s")
function(git_subject variable)
_git_easy_command(log -1 --format=%s)
endfunction()
function(get_git_dir variable)

View file

@ -11,6 +11,7 @@
#include "config.h"
const char *compbranch = SRB2_COMP_BRANCH;
const char *comprevision = SRB2_COMP_REVISION;
const char *compnote = SRB2_COMP_NOTE;
const char *comptype = CMAKE_BUILD_TYPE;
const int compoptimized = SRB2_COMP_OPTIMIZED;

View file

@ -13,6 +13,7 @@
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
#define SRB2_COMP_NOTE "${SRB2_COMP_NOTE}"
// This is done with configure_file instead of defines in order to avoid
// recompiling the whole target whenever the working directory state changes
#cmakedefine SRB2_COMP_UNCOMMITTED

View file

@ -4772,7 +4772,7 @@ static void Command_ListDoomednums_f(void)
static void Command_Version_f(void)
{
#ifdef DEVELOP
CONS_Printf("Ring Racers %s %s (%s %s)\n", compbranch, comprevision, compdate, comptime);
CONS_Printf("Ring Racers %s %s %s (%s %s)\n", compbranch, comprevision, compnote, compdate, comptime);
#else
CONS_Printf("Ring Racers %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch);
#endif

View file

@ -668,6 +668,7 @@ extern const char
*comptime,
*comprevision,
*compbranch,
*compnote,
*comptype;
extern int
compuncommitted,

View file

@ -1913,7 +1913,7 @@ void F_VersionDrawer(void)
addtext(V_ALLOWLOWERCASE|V_REDMAP, "Netgame host for testers");
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", compdate));
#elif defined(DEVELOP)
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, comprevision);
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s %s", comprevision, compnote));
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, compbranch);
#else // Regular build
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", VERSIONSTRING));