From 2e3c5ac88a434ee437bc3e68b321d5bd0bcd7cc9 Mon Sep 17 00:00:00 2001
From: callum_linden <callum@lindenlab.com>
Date: Tue, 24 Oct 2017 16:13:23 -0700
Subject: [PATCH] Add in real SL viewer name and version

---
 indra/llcommon/CMakeLists.txt | 10 +++++++++-
 indra/llcommon/llapp.cpp      | 14 +++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 50e262ae7a7..9c5481a9770 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -14,6 +14,7 @@ include(Copy3rdPartyLibs)
 include(ZLIB)
 include(URIPARSER)
 include(BUGSPLAT)
+include(BuildVersion)
 
 include_directories(
     ${EXPAT_INCLUDE_DIRS}
@@ -255,7 +256,14 @@ set(llcommon_HEADER_FILES
     )
 
 set_source_files_properties(${llcommon_HEADER_FILES}
-                            PROPERTIES HEADER_FILE_ONLY TRUE)
+                            PROPERTIES HEADER_FILE_ONLY TRUE
+							)
+
+# bring in version information for BugSplat crash reporting
+set_source_files_properties(${llcommon_SOURCE_FILES}
+                            PROPERTIES
+							COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" # see BuildVersion.cmake
+							)
 
 list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
 
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 6ea1700ea84..3e652dbdb51 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -431,9 +431,17 @@ void LLApp::setupErrorHandling(bool second_instance)
 #if BUGSPLAT_ENABLED
 	// TODOCP: populate these fields correctly
 	static const wchar_t *bugdb_name = L"second_life_callum_test";
-	static const wchar_t *app_name = L"SecondLifeViewer";
-	static const wchar_t *app_version = L"1.0.0";
-	gBugSplatSender = new MiniDmpSender((const __wchar_t *)bugdb_name, (const __wchar_t *)app_name, (const __wchar_t *)app_version, NULL);
+
+	// build (painfully) the app/channel name
+	#define stringize_inner(x) L#x
+	#define stringize_outer(x) stringize_inner(x)
+	std::wstring app_name(stringize_outer(LL_VIEWER_CHANNEL));
+
+	// build in real app version now we leveraged CMake to build in BuildVersion.cmake into LLCommon
+	wchar_t version_string[MAX_STRING];
+	wsprintf(version_string, L"%d.%d.%d.%d", LL_VIEWER_VERSION_MAJOR, LL_VIEWER_VERSION_MINOR, LL_VIEWER_VERSION_PATCH, LL_VIEWER_VERSION_BUILD);
+
+	gBugSplatSender = new MiniDmpSender((const __wchar_t *)bugdb_name, (const __wchar_t *)app_name.c_str(), (const __wchar_t *)version_string, NULL);
 
 	gBugSplatSender->setCallback(BugSplatExceptionCallback);
 #else
-- 
GitLab