From bef0013bf8abd2c437ac82657fdb29ac1aa07f25 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 30 Aug 2022 11:49:22 -0500 Subject: [PATCH] =?UTF-8?q?feat(core):=20set=20-DDEBUG=20for=20debug=20?= =?UTF-8?q?=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - set -DDEBUG for 'debug' meson builds - default KXPLUS_DEBUG to 1 for -DDEBUG #7136 --- core/meson.build | 5 +++++ core/src/kmx/kmx_plus.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/core/meson.build b/core/meson.build index cad35decec..1295efb33d 100644 --- a/core/meson.build +++ b/core/meson.build @@ -41,6 +41,11 @@ cc = meson.get_compiler('c') # For now, we use KMN_KBP to inject the km::kbp::kmx namespace defns = ['-DKMN_KBP'] +# #define DEBUG when we are on a debug build +if get_option('buildtype') == 'debug' + add_global_arguments('-DDEBUG', language : 'cpp') +endif + subdir('doc') subdir('include') subdir('src') diff --git a/core/src/kmx/kmx_plus.h b/core/src/kmx/kmx_plus.h index 74dfac4046..33feac07c8 100644 --- a/core/src/kmx/kmx_plus.h +++ b/core/src/kmx/kmx_plus.h @@ -15,8 +15,12 @@ * @def KMXPLUS_DEBUG Set to 1 to enable debug output */ #ifndef KMXPLUS_DEBUG +#if defined(DEBUG) +#define KMXPLUS_DEBUG 1 +#else #define KMXPLUS_DEBUG 0 #endif +#endif namespace km { namespace kbp {