Change the branch criteria to not having a tag

This commit is contained in:
Pepe20129 2024-04-12 20:57:34 +02:00
parent 31db01be19
commit 7c79fbd41f
5 changed files with 19 additions and 4 deletions

View File

@ -27,6 +27,19 @@ execute_process(
set(CMAKE_PROJECT_GIT_COMMIT_HASH "${GIT_COMMIT_HASH}" CACHE STRING "Git commit hash" FORCE)
execute_process(
COMMAND git describe --tags --abbrev=0 --exact-match HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_COMMIT_TAG)
set(GIT_COMMIT_TAG "" CACHE STRING "Git commit tag" FORCE)
endif()
set(CMAKE_PROJECT_GIT_COMMIT_TAG "${GIT_COMMIT_TAG}" CACHE STRING "Git commit tag" FORCE)
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>)

View File

@ -51,6 +51,7 @@ extern "C"
extern u16 gBuildVersionPatch;
extern u8 gGitBranch[];
extern u8 gGitCommitHash[];
extern u8 gGitCommitTag[];
extern u8 gBuildTeam[];
extern u8 gBuildDate[];
extern u8 gBuildMakeOption[];

View File

@ -437,8 +437,8 @@ void DrawGameplayStatsHeader() {
ImGui::BeginTable("gameplayStatsHeader", 1, ImGuiTableFlags_BordersOuter);
ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
GameplayStatsRow("Build Version:", (char*)gBuildVersion);
//if branch doesn't start with "develop"
if (strncmp((char*)gGitBranch, "develop", strlen("develop")) != 0) {
//if tag is empty (not a release build)
if (gGitCommitTag[0] == 0) {
GameplayStatsRow("Git Branch:", (char*)gGitBranch);
}
if (CVarGetInteger("gGameplayStats.ShowDebugInfo", 0)) {

View File

@ -6,6 +6,7 @@ const u16 gBuildVersionMinor = @CMAKE_PROJECT_VERSION_MINOR@;
const u16 gBuildVersionPatch = @CMAKE_PROJECT_VERSION_PATCH@;
const char gGitBranch[] = "@CMAKE_PROJECT_GIT_BRANCH@";
const char gGitCommitHash[] = "@CMAKE_PROJECT_GIT_COMMIT_HASH@";
const char gGitCommitTag[] = "@CMAKE_PROJECT_GIT_COMMIT_TAG@";
const char gBuildTeam[] = "@PROJECT_TEAM@";
const char gBuildDate[] = __DATE__ " " __TIME__;
const char gBuildMakeOption[] = "";

View File

@ -31,8 +31,8 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
GfxPrint_Open(&printer, g);
GfxPrint_SetColor(&printer, 131, 154, 255, 255);
//if branch doesn't start with "develop"
bool showGitBranch = strncmp((char*)gGitBranch, "develop", strlen("develop")) != 0;
//if tag is empty (not a release build)
bool showGitBranch = gGitCommitTag[0] == 0;
bool showGitCommit = CVarGetInteger("gDebugEnabled", 0);
GfxPrint_SetPos(&printer, 1, showGitBranch ? (showGitCommit ? 23 : 24) : (showGitCommit ? 24 : 25));