Automatically turn on print debugging in debug builds

Mon, 19 Aug 2024 21:24:44 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 19 Aug 2024 21:24:44 -0500
changeset 42886
d9d26508be61
parent 42885
9b0cae94f406
child 42887
da9cee550b6e

Automatically turn on print debugging in debug builds

Testing Done:
Ran a default build and verified that print debugging was on by default.
Also built with `--buildtype=release` and verified that print debugging was not on by default.

Reviewed at https://reviews.imfreedom.org/r/3412/

meson.build file | annotate | diff | comparison | revisions
pidgin/pidginapplication.c file | annotate | diff | comparison | revisions
--- a/meson.build	Mon Aug 19 21:20:31 2024 -0500
+++ b/meson.build	Mon Aug 19 21:24:44 2024 -0500
@@ -59,6 +59,7 @@
 conf.set_quoted('PURPLE_BUILD_CPU', host_machine.cpu())
 conf.set_quoted('PURPLE_BUILD_ARCHITECTURE', host_machine.cpu_family())
 conf.set_quoted('PURPLE_BUILD_ENDIANNESS', host_machine.endian())
+conf.set_quoted('PURPLE_BUILD_BUILDTYPE', get_option('buildtype'))
 
 version_conf.set('PURPLE_MAJOR_VERSION', purple_major_version)
 version_conf.set('PURPLE_MINOR_VERSION', purple_minor_version)
--- a/pidgin/pidginapplication.c	Mon Aug 19 21:20:31 2024 -0500
+++ b/pidgin/pidginapplication.c	Mon Aug 19 21:24:44 2024 -0500
@@ -198,6 +198,19 @@
 	g_menu_append_section(target, NULL, model);
 }
 
+static void
+pidgin_application_setup_debug(G_GNUC_UNUSED PidginApplication *application) {
+	pidgin_debug_init_handler();
+
+	if(purple_strequal(PURPLE_BUILD_BUILDTYPE, "debug") ||
+	   purple_strequal(PURPLE_BUILD_BUILDTYPE, "debugoptimized"))
+	{
+		pidgin_debug_set_print_enabled(TRUE);
+	} else {
+		pidgin_debug_set_print_enabled(opt_debug);
+	}
+}
+
 /******************************************************************************
  * Actions
  *****************************************************************************/
@@ -708,12 +721,7 @@
 		}
 	}
 
-	pidgin_debug_init_handler();
-#ifdef DEBUG
-	pidgin_debug_set_print_enabled(TRUE);
-#else
-	pidgin_debug_set_print_enabled(opt_debug);
-#endif
+	pidgin_application_setup_debug(PIDGIN_APPLICATION(application));
 
 #ifdef _WIN32
 	winpidgin_init();

mercurial