Skip to content

Commit 2aea318

Browse files
committed
meson: fix cross build setup, report unknown systems
1 parent 02bb160 commit 2aea318

File tree

2 files changed

+42
-37
lines changed

2 files changed

+42
-37
lines changed

meson.build

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,36 @@ subdir('src')
2525

2626
subdir('tools/install')
2727

28-
if meson.is_cross_build() and host_machine.system() == 'android'
29-
30-
library(
31-
'oopetris',
32-
main_files,
33-
dependencies: [liboopetris_graphics_dep, graphic_application_deps],
34-
override_options: {
35-
'warning_level': '3',
36-
'werror': true,
37-
},
38-
)
39-
40-
elif meson.is_cross_build() and host_machine.system() == 'switch'
41-
switch_options = [
42-
app_name,
43-
main_files,
44-
[liboopetris_graphics_dep, graphic_application_deps],
45-
]
46-
subdir('platforms/switch')
47-
elif meson.is_cross_build() and host_machine.system() == '3ds'
48-
_3ds_options = [
49-
app_name,
50-
main_files,
51-
[liboopetris_graphics_dep, graphic_application_deps],
52-
]
53-
subdir('platforms/3ds')
28+
if meson.is_cross_build()
29+
if host_machine.system() == 'android'
30+
31+
library(
32+
'oopetris',
33+
main_files,
34+
dependencies: [liboopetris_graphics_dep, graphic_application_deps],
35+
override_options: {
36+
'warning_level': '3',
37+
'werror': true,
38+
},
39+
)
40+
41+
elif host_machine.system() == 'switch'
42+
switch_options = [
43+
app_name,
44+
main_files,
45+
[liboopetris_graphics_dep, graphic_application_deps],
46+
]
47+
subdir('platforms/switch')
48+
elif host_machine.system() == '3ds'
49+
_3ds_options = [
50+
app_name,
51+
main_files,
52+
[liboopetris_graphics_dep, graphic_application_deps],
53+
]
54+
subdir('platforms/3ds')
55+
else
56+
error('not supported platform: ' + host_machine.system())
57+
endif
5458
else
5559

5660
if host_machine.system() == 'windows'
@@ -86,7 +90,9 @@ else
8690

8791
makensis = find_program('makensis')
8892

89-
nsis_script = meson.project_source_root() / 'tools' / 'installer' / 'setup.nsi'
93+
nsis_script = (
94+
meson.project_source_root() / 'tools' / 'installer' / 'setup.nsi'
95+
)
9096

9197
run_target(
9298
'windows_installer',

tools/dependencies/meson.build

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ fmt_use_header_only = false
116116

117117
if (
118118
meson.is_cross_build()
119-
and (host_machine.system() == 'switch' or host_machine.system() == '3ds')
119+
and (host_machine.system() == 'switch'
120+
or host_machine.system() == '3ds')
120121
)
121122
fmt_use_header_only = true
122123
# clang with libc++ creates some really long and confusing linker errors, so just use the header only library
@@ -147,6 +148,7 @@ graphics_lib += {
147148
'deps': [graphics_lib.get('deps'), spdlog_dep],
148149
}
149150

151+
# on the 3ds there is no thread local storage (TLS)
150152
if (meson.is_cross_build() and host_machine.system() == '3ds')
151153
graphics_lib += {
152154
'compile_args': [graphics_lib.get('compile_args'), '-DSPDLOG_NO_TLS'],
@@ -220,7 +222,8 @@ online_multiplayer_supported = true
220222

221223
if (
222224
meson.is_cross_build()
223-
and (host_machine.system() == 'switch' or host_machine.system() == '3ds')
225+
and (host_machine.system() == 'switch'
226+
or host_machine.system() == '3ds')
224227
)
225228
online_multiplayer_supported = false
226229

@@ -261,8 +264,8 @@ is_flatpak_build = false
261264
if build_installer
262265
if get_option('buildtype') != 'release'
263266
error(
264-
'buildtype needs to be \'release\', when building the installer, but was: '
265-
+ get_option('buildtype'),
267+
'buildtype needs to be \'release\', when building the installer, but was: ' +
268+
get_option('buildtype'),
266269
)
267270
endif
268271

@@ -278,8 +281,7 @@ if build_installer
278281
message('Adding a windows installer target: \'windows_installer\'')
279282
else
280283
error(
281-
'unsuported system for building the installer: '
282-
+ host_machine.system(),
284+
'unsuported system for building the installer: ' + host_machine.system(),
283285
)
284286

285287
endif
@@ -296,10 +298,7 @@ endif
296298
if is_flatpak_build
297299
app_name = 'com.github.mgerhold.OOPetris'
298300
core_lib += {
299-
'compile_args': [
300-
core_lib.get('compile_args'),
301-
'-DFLATPAK_BUILD'
302-
],
301+
'compile_args': [core_lib.get('compile_args'), '-DFLATPAK_BUILD'],
303302
}
304303
endif
305304

0 commit comments

Comments
 (0)