22
33only_allow_native_libs = false
44if meson .is_cross_build()
5- if host_machine .system() == ' switch'
6- # we do not link to code that was compiled with gcc 10.1, the code we link with is all compiled with gcc 13.2
5+ if host_machine .system() == ' switch' or host_machine .system() == ' 3ds '
6+ # we do not link to code that was compiled with gcc 10.1 / gcc 7.1 , the code we link with is all compiled with gcc 13.2
77 core_lib += {
88 ' compile_args' : [core_lib.get(' compile_args' ), ' -Wno-psabi' ],
99 }
1414
1515
1616
17-
1817sdl2_dep = dependency (
1918 ' sdl2' ,
2019 ' SDL2' ,
@@ -77,7 +76,7 @@ if mpg123_dep.found()
7776 sdl2_mixer_flags += {' mpg123' : ' enabled' }
7877 sdl2_mixer_defines += ' -DAUDIO_WITH_MP3_SUPPORT'
7978else
80- mpg123_dep = cpp.find_library (' mpg123' , required : only_allow_native_libs )
79+ mpg123_dep = cpp.find_library (' mpg123' , required : false )
8180 if mpg123_dep.found()
8281 sdl2_mixer_flags += {' mpg123' : ' enabled' }
8382 sdl2_mixer_defines += ' -DAUDIO_WITH_MP3_SUPPORT'
8786endif
8887
8988
90-
9189sdl2_mixer_dep = dependency (
9290 ' sdl2_mixer' ,
9391 ' SDL2_mixer' ,
@@ -100,58 +98,49 @@ graphics_lib += {
10098 ' compile_args' : [graphics_lib.get(' compile_args' ), sdl2_mixer_defines],
10199}
102100
103- if (meson .is_cross_build() and host_machine .system() == ' switch' )
104-
105- fmt_lib = dependency (
106- ' fmt' ,
107- required : false ,
108- allow_fallback : false ,
109- )
110-
111- if fmt_lib.found()
112- core_lib += {' deps' : [core_lib.get(' deps' ), fmt_lib]}
113- else
114-
115- fmt_header_only_dep = dependency (
116- ' fmt_header_only' ,
117- required : true ,
118- allow_fallback : true ,
119- default_options : {' default_library' : ' static' },
120- )
101+ fmt_use_header_only = false
121102
122- meson .override_dependency(' fmt' , fmt_header_only_dep)
103+ if (
104+ meson .is_cross_build()
105+ and (host_machine .system() == ' switch'
106+ or host_machine .system() == ' 3ds' )
107+ )
108+ fmt_use_header_only = true
109+ # clang with libc++ creates some really long and confusing linker errors, so just use the header only library
110+ elif cpp.get_id() == ' clang' and build_with_libcpp
111+ fmt_use_header_only = true
112+ endif
123113
124- core_lib += {' deps' : [core_lib.get(' deps' ), fmt_header_only_dep]}
125- endif
126114
115+ if fmt_use_header_only
116+ fmt_header_only_dep = dependency (
117+ ' fmt_header_only' ,
118+ required : true ,
119+ allow_fallback : true ,
120+ )
121+ meson .override_dependency(' fmt' , fmt_header_only_dep)
122+ fmt_dep = fmt_header_only_dep
127123else
124+ fmt_dep = dependency (' fmt' , required : true , allow_fallback : true )
125+ endif
128126
129- # clang with libc++ creates some really long and confusing linker errors, so just use the header only library
130- if cpp.get_id() == ' clang' and build_with_libcpp
131- fmt_dep = dependency (
132- ' fmt_header_only' ,
133- required : true ,
134- allow_fallback : true ,
135- default_options : {' default_library' : ' static' },
136- )
137- meson .override_dependency(' fmt' , fmt_dep)
138- else
139- fmt_dep = dependency (
140- ' fmt' ,
141- required : true ,
142- )
143- endif
144-
127+ core_lib += {' deps' : [core_lib.get(' deps' ), fmt_dep]}
145128
146- core_lib += {' deps' : [core_lib.get(' deps' ), fmt_dep]}
147- endif
148129
149130spdlog_dep = dependency (
150131 ' spdlog' ,
151132 required : true ,
152133 default_options : {' tests' : ' disabled' },
153134)
154- graphics_lib += {' deps' : [graphics_lib.get(' deps' ), spdlog_dep]}
135+ graphics_lib += {
136+ ' deps' : [graphics_lib.get(' deps' ), spdlog_dep],
137+ }
138+
139+ if (meson .is_cross_build() and host_machine .system() == ' 3ds' )
140+ graphics_lib += {
141+ ' compile_args' : [graphics_lib.get(' compile_args' ), ' -DSPDLOG_NO_TLS' ],
142+ }
143+ endif
155144
156145nlohmann_json_dep = dependency (
157146 ' nlohmann_json' ,
@@ -221,7 +210,11 @@ core_lib += {'deps': [core_lib.get('deps'), argparse_dep]}
221210online_multiplayer_supported = true
222211
223212
224- if meson .is_cross_build() and host_machine .system() == ' switch'
213+ if (
214+ meson .is_cross_build()
215+ and (host_machine .system() == ' switch'
216+ or host_machine .system() == ' 3ds' )
217+ )
225218 online_multiplayer_supported = false
226219 core_lib += {
227220 ' compile_args' : [
@@ -275,7 +268,6 @@ endif
275268discord_sdk_dep = dependency (
276269 ' discord-game-sdk' ,
277270 required : not meson .is_cross_build(),
278- default_options : {' clang_libcpp' : ' disabled' },
279271)
280272if discord_sdk_dep.found()
281273 have_discord_sdk = true
0 commit comments