Skip to content

Commit 81345e2

Browse files
committed
fix: fix 3ds compilation, by correctly disabling TLS in spdlog
1 parent f3e50e0 commit 81345e2

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/meson.build b/meson.build
2+
index 1bb306c..dbc08b3 100644
3+
--- a/meson.build
4+
+++ b/meson.build
5+
@@ -32,6 +32,10 @@ else
6+
spdlog_compile_args += '-DSPDLOG_FMT_EXTERNAL'
7+
endif
8+
9+
+if get_option('no_tls')
10+
+spdlog_compile_args += '-DSPDLOG_NO_TLS'
11+
+endif
12+
+
13+
if get_option('compile_library')
14+
spdlog_compile_args += '-DSPDLOG_COMPILED_LIB'
15+
if get_option('default_library') != 'static'
16+
diff --git a/meson_options.txt b/meson_options.txt
17+
index 33dc985..08e844d 100644
18+
--- a/meson_options.txt
19+
+++ b/meson_options.txt
20+
@@ -15,3 +15,9 @@ option(
21+
type: 'feature',
22+
description: 'Use std::format instead of internal fmt lib',
23+
)
24+
+option(
25+
+ 'no_tls',
26+
+ type: 'boolean',
27+
+ value: false,
28+
+ description: 'prevent spdlog from using thread local storage',
29+
+)

subprojects/spdlog.wrap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.15.2-3/get_patch
88
patch_hash = d5ab078661f571ef5113a8e4bc5c4121e16c044e7772a24b44b1ca8f3ee7c6cb
99
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.15.2-3/spdlog-1.15.2.tar.gz
1010
wrapdb_version = 1.15.2-3
11-
diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff,spdlog_1.15.2_linker_errors_msvc.diff
11+
diff_files = spdlog_1.15.2_fmt_11.2.0_compatibility.diff,spdlog_1.15.2_linker_errors_msvc.diff,spdlog_1.15.2_no_tls_option.diff
1212

1313
[provide]
1414
spdlog = spdlog_dep

tools/dependencies/meson.build

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,23 +373,24 @@ if build_application
373373
'compile_args': [graphics_lib.get('compile_args'), sdl2_mixer_defines],
374374
}
375375

376+
spdlog_no_tls = false
377+
378+
if (meson.is_cross_build() and host_machine.system() == '3ds')
379+
spdlog_no_tls = true
380+
endif
381+
376382
spdlog_dep = dependency(
377383
'spdlog',
378384
required: true,
379385
default_options: {
380386
'tests': 'disabled',
387+
'no_tls': spdlog_no_tls,
381388
},
382389
)
383390
graphics_lib += {
384391
'deps': [graphics_lib.get('deps'), spdlog_dep],
385392
}
386393

387-
if (meson.is_cross_build() and host_machine.system() == '3ds')
388-
graphics_lib += {
389-
'compile_args': [graphics_lib.get('compile_args'), '-DSPDLOG_NO_TLS'],
390-
}
391-
endif
392-
393394
cpp_httlib_dep = dependency(
394395
'cpp-httplib',
395396
required: false,

0 commit comments

Comments
 (0)