Skip to content

Commit 93eff0d

Browse files
committed
3ds: update build definitions
1 parent 52c3e82 commit 93eff0d

File tree

2 files changed

+33
-49
lines changed

2 files changed

+33
-49
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if meson.is_cross_build()
4747
]
4848
subdir('platforms/switch')
4949
elif host_machine.system() == '3ds'
50-
_3ds_options = [
50+
nintendo_options = [
5151
app_name,
5252
main_files,
5353
[liboopetris_graphics_dep, graphic_application_deps],

platforms/3ds/meson.build

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
21
## get the options object and "unpack" it
32

4-
_3ds_exe_name = _3ds_options[0]
5-
_3ds_src_files = _3ds_options[1]
6-
_3ds_deps = _3ds_options[2]
7-
3+
exe_name = nintendo_options[0]
4+
src_files = nintendo_options[1]
5+
deps = nintendo_options[2]
86

97
# libraries
108

11-
_3ds_dependencies = [
9+
dependencies = [
1210
'flac',
1311
'freetype2',
1412
'ogg',
@@ -19,7 +17,7 @@ _3ds_dependencies = [
1917
'zlib',
2018
]
2119

22-
_3ds_dependencies_native = [
20+
dependencies_native = [
2321
'bz2',
2422
'ctru',
2523
'mad',
@@ -29,14 +27,13 @@ _3ds_dependencies_native = [
2927
'SDL2main',
3028
]
3129

32-
33-
_3ds_library_dirs = meson.get_external_property('library_dirs', [''])
34-
if _3ds_library_dirs.length() == 0
30+
library_dirs = meson.get_external_property('library_dirs', [''])
31+
if library_dirs.length() == 0
3532
error('property \'library_dirs\' has to be set!')
3633
endif
3734

38-
foreach dep : _3ds_dependencies
39-
_3ds_deps += dependency(
35+
foreach dep : dependencies
36+
deps += dependency(
4037
dep,
4138
required: true,
4239
allow_fallback: false,
@@ -45,21 +42,20 @@ foreach dep : _3ds_dependencies
4542
endforeach
4643

4744
c = meson.get_compiler('c')
48-
foreach dep : _3ds_dependencies_native
49-
_3ds_deps += c.find_library(
45+
foreach dep : dependencies_native
46+
deps += c.find_library(
5047
dep,
5148
required: true,
52-
dirs: _3ds_library_dirs,
49+
dirs: library_dirs,
5350
)
5451
endforeach
5552

56-
5753
## compilation
5854

59-
_3ds_elf_file = build_target(
60-
_3ds_exe_name + '.elf',
61-
_3ds_src_files,
62-
dependencies: _3ds_deps,
55+
elf_file = build_target(
56+
exe_name + '.elf',
57+
src_files,
58+
dependencies: deps,
6359
override_options: {
6460
'warning_level': '3',
6561
'werror': true,
@@ -72,11 +68,10 @@ use_smdh = ['true', 'True', '1', true].contains(
7268
meson.get_external_property('USE_SMDH', ''),
7369
)
7470

75-
7671
_3dsxtool = find_program('3dsxtool')
7772

78-
_3DSX_FLAGS = [_3dsxtool, _3ds_elf_file.full_path(), _3ds_exe_name + '.3dsx']
79-
_3DSX_DEPS = [_3ds_elf_file]
73+
_3DSX_FLAGS = [_3dsxtool, elf_file.full_path(), exe_name + '.3dsx']
74+
_3DSX_DEPS = [elf_file]
8075
SMDH_DEPS = _3DSX_DEPS
8176

8277
fs = import('fs')
@@ -86,8 +81,7 @@ if use_smdh
8681
smdhtool = find_program('smdhtool')
8782
SMDH_FLAGS = [
8883
smdhtool,
89-
'--create',
90-
oopetris_name,
84+
'--create', oopetris_name,
9185
oopetris_desc,
9286
oopetris_author,
9387
]
@@ -97,27 +91,21 @@ if use_smdh
9791
error('property \'libctru\' has to be set!')
9892
endif
9993

100-
_3ds_default_icon = LIBCTRU / 'default_icon.png'
94+
default_icon = LIBCTRU / 'default_icon.png'
10195

102-
APP_ICON = meson.get_external_property('APP_ICON', _3ds_default_icon)
96+
APP_ICON = meson.get_external_property('APP_ICON', default_icon)
10397

10498
if not fs.is_absolute(APP_ICON)
10599
APP_ICON = meson.project_source_root() / APP_ICON
106100
endif
107101

108-
109102
if not fs.exists(APP_ICON)
110103
error('APP_ICON should exist, but doesn\'t: \'' + APP_ICON + '\'')
111104
endif
112105

113106
SMDH_FLAGS += APP_ICON
114107

115-
116-
SMDH_FLAGS += (
117-
_3ds_exe_name + '.smdh' # outfile
118-
)
119-
120-
108+
SMDH_FLAGS += (exe_name + '.smdh')
121109

122110
APP_SMALL_ICON = meson.get_external_property('APP_SMALL_ICON', '')
123111

@@ -126,33 +114,29 @@ if use_smdh
126114
APP_SMALL_ICON = meson.project_source_root() / APP_SMALL_ICON
127115
endif
128116

129-
130117
if not fs.exists(APP_SMALL_ICON)
131118
error(
132-
'APP_SMALL_ICON should exist, but doesn\'t: \'' + APP_SMALL_ICON +
133-
'\'',
119+
'APP_SMALL_ICON should exist, but doesn\'t: \''
120+
+ APP_SMALL_ICON
121+
+ '\'',
134122
)
135123
endif
136124

137125
SMDH_FLAGS += APP_SMALL_ICON
138126
endif
139127

140-
141-
142-
# smdhtool --create <name> <long description> <author> <icon.png> <_3ds_exe_name>.smdh [<smallicon.png>]
128+
# smdhtool --create <name> <long description> <author> <icon.png> <exe_name>.smdh [<smallicon.png>]
143129
smdh_file = custom_target(
144-
_3ds_exe_name + '.smdh',
130+
exe_name + '.smdh',
145131
command: SMDH_FLAGS,
146-
output: [_3ds_exe_name + '.smdh'],
132+
output: [exe_name + '.smdh'],
147133
depends: SMDH_DEPS,
148134
)
149-
_3DSX_FLAGS += '--smdh=' + _3ds_exe_name + '.smdh'
135+
_3DSX_FLAGS += '--smdh=' + exe_name + '.smdh'
150136
_3DSX_DEPS += smdh_file
151137

152138
endif
153139

154-
155-
156140
APP_ROMFS = meson.get_external_property('APP_ROMFS', '')
157141

158142
if APP_ROMFS != ''
@@ -169,11 +153,11 @@ if APP_ROMFS != ''
169153

170154
endif
171155

172-
# 3dsxtool <_3ds_exe_name>.elf <_3ds_exe_name>.3dsx <_3DSX_FLAGS>
156+
# 3dsxtool <exe_name>.elf <exe_name>.3dsx <_3DSX_FLAGS>
173157
custom_target(
174-
_3ds_exe_name + '.3dsx',
158+
exe_name + '.3dsx',
175159
command: _3DSX_FLAGS,
176160
depends: _3DSX_DEPS,
177-
output: [_3ds_exe_name + '.3dsx'],
161+
output: [exe_name + '.3dsx'],
178162
build_by_default: true,
179163
)

0 commit comments

Comments
 (0)