From 822ffba31366170ef8e1b86d5ce4639ca3996b2c Mon Sep 17 00:00:00 2001 From: Ali Almohaya Date: Sat, 8 Aug 2026 09:16:49 +0300 Subject: [PATCH] feat: identify build provenance in the crash log report (#196) * feat: identify build provenance in the crash log report * cmake: reuse git version dependency target --------- Co-authored-by: nmzik --- src/common/CMakeLists.txt | 1 + src/common/assert.cpp | 3 ++- src/graphics/presentation/window/window.cpp | 9 +-------- src/kytyGitVersion.h.in | 11 +++++++++++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index fc1efc753..a42798a00 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(common Tracy::TracyClient PRIVATE cpuinfo + kyty_git_version spdlog::spdlog ) diff --git a/src/common/assert.cpp b/src/common/assert.cpp index 4016f8d5e..8d466f858 100644 --- a/src/common/assert.cpp +++ b/src/common/assert.cpp @@ -3,6 +3,7 @@ #include "common/debug.h" #include "common/logging/log.h" #include "common/subsystems.h" +#include "kytyGitVersion.h" #include #include @@ -23,7 +24,7 @@ static std::string BuildFatalReport(const char* title, std::string_view text, co DebugStack stack; DebugStack::Trace(&stack); - std::string report = "--- Stack Trace ---\n"; + std::string report = "--- Build ---\n" KYTY_BUILD_LABEL "\n--- Stack Trace ---\n"; for (int i = PRINT_STACK_FROM; i < stack.depth; i++) { report += fmt::format("[{}] {:016x}\n", i - PRINT_STACK_FROM, static_cast(stack.GetAddr(i))); diff --git a/src/graphics/presentation/window/window.cpp b/src/graphics/presentation/window/window.cpp index fcffa0dc8..a6332b185 100644 --- a/src/graphics/presentation/window/window.cpp +++ b/src/graphics/presentation/window/window.cpp @@ -938,13 +938,6 @@ void WindowContext::UpdateTitle() { static constexpr auto build_type = "Unknown"; #endif -#if defined(KYTY_OFFICIAL_BUILD) - static constexpr auto build_label = "Official build " KYTY_RELEASE_TAG; -#elif defined(KYTY_FORK_BUILD) - static constexpr auto build_label = "Fork build " KYTY_BUILD_REPOSITORY " " KYTY_GIT_HASH; -#else - static constexpr auto build_label = "Source build " KYTY_GIT_HASH; -#endif const auto now = Common::Timer::QueryPerformanceCounter(); const auto frequency = Common::Timer::QueryPerformanceFrequency(); @@ -957,7 +950,7 @@ void WindowContext::UpdateTitle() { fps_frames = 0; } - auto fps = fmt::format("[{} | {}] {}{}{}{}{}{}[{}] [{}], frame: {}, fps: {:f}", build_label, + auto fps = fmt::format("[{} | {}] {}{}{}{}{}{}[{}] [{}], frame: {}, fps: {:f}", KYTY_BUILD_LABEL, build_type, (has_title ? title : ""), (has_title ? ", " : ""), (has_title_id ? title_id : ""), (has_title_id ? ", " : ""), (has_app_ver ? app_ver : ""), (has_app_ver ? " " : ""), device_name, diff --git a/src/kytyGitVersion.h.in b/src/kytyGitVersion.h.in index 75f315acb..23ae2fbf3 100644 --- a/src/kytyGitVersion.h.in +++ b/src/kytyGitVersion.h.in @@ -1,2 +1,13 @@ +#include "cmake_config.h" + #define KYTY_GIT_VERSION "@KYTY_GIT_VERSION@" #define KYTY_GIT_HASH "@KYTY_GIT_HASH@" + +/* Build provenance, shown in the window title and in crash reports. */ +#if defined(KYTY_OFFICIAL_BUILD) +#define KYTY_BUILD_LABEL "Official build " KYTY_RELEASE_TAG +#elif defined(KYTY_FORK_BUILD) +#define KYTY_BUILD_LABEL "Fork build " KYTY_BUILD_REPOSITORY " " KYTY_GIT_HASH +#else +#define KYTY_BUILD_LABEL "Source build " KYTY_GIT_HASH +#endif