Skip to content

Commit 59328f5

Browse files
committed
Enable loguru stack traces
Loguru's autodetect logic for enabling stack traces is not very robust, so add logic to meson.build that checks for the headers included by loguru.cpp if LOGURU_STACKTRACES=1.
1 parent 8d79a43 commit 59328f5

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

src/config.h.in

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,4 @@
246246
// XDG_DATA_HOME or XDG_DATA_DIRS to include the --datadir.
247247
#mesondefine CUSTOM_DATADIR
248248

249-
/* Loguru-related defines
250-
*/
251-
252-
// Prevent loguru from parsing command-line arguments with
253-
// with the hosts's locale-applied, because this can foul up
254-
// ncurses. (DOSBox also doesn't have foreign-language arguments).
255-
//
256-
#define LOGURU_USE_LOCALE 0
257-
258-
// Redefine “assert” to call Loguru version (!NDEBUG only).
259-
#define LOGURU_REDEFINE_ASSERT 1
260-
261249
#endif

src/libs/loguru/meson.build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
# Enable Loguru stack traces if supported
2+
stacktrace_headers = ['cxxabi.h', 'dlfcn.h', 'execinfo.h']
3+
4+
all_stacktrace_headers_found = true
5+
6+
foreach header : stacktrace_headers
7+
if not cxx.has_header(header)
8+
all_stacktrace_headers_found = false
9+
endif
10+
endforeach
11+
12+
if all_stacktrace_headers_found
13+
add_project_arguments('-DLOGURU_STACKTRACES=1', language: 'cpp')
14+
endif
15+
16+
# Prevent loguru from parsing command-line arguments with
17+
# the hosts's locale-applied, because this can foul up
18+
# ncurses. (DOSBox also doesn't have foreign-language arguments).
19+
add_project_arguments('-DLOGURU_USE_LOCALE=0', language: 'cpp')
20+
121
libloguru = static_library(
222
'loguru',
323
'loguru.cpp',

src/platform/visualc/config.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,3 @@
122122
// On Windows, this path is not customizeable, so it's left blank here.
123123
//
124124
#define CUSTOM_DATADIR ""
125-
126-
/* Loguru-related defines
127-
*/
128-
129-
// Prevent loguru from parsing command-line arguments with
130-
// with the hosts's locale-applied, because this can foul up
131-
// ncurses. (DOSBox also doesn't have foreign-language arguments).
132-
//
133-
#define LOGURU_USE_LOCALE 0
134-
135-
// Redefine “assert” to call Loguru version (!NDEBUG only).
136-
#define LOGURU_REDEFINE_ASSERT 1

0 commit comments

Comments
 (0)