Skip to content

Commit 9a13d0e

Browse files
committed
Pull windows deps on update in meson buildconfig
1 parent c36a71a commit 9a13d0e

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

meson.build

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,38 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
9494
# yes, this is a bit ugly and hardcoded but it is what it is
9595
# TODO (middle-term goal) - Should migrate away from this
9696
# consider meson wraps? Hopefully can also get the same build path as below
97+
sdl_ver = (sdl_api == 3) ? '3.2.10' : '2.32.8'
98+
sdl_image_ver = (sdl_api == 3) ? '3.2.4' : '2.8.8'
99+
sdl_mixer_ver = '2.8.1'
100+
sdl_ttf_ver = (sdl_api == 3) ? '3.2.2' : '2.24.0'
101+
97102
arch_suffix = 'x' + host_machine.cpu_family().substring(-2)
98103
base_dir = meson.current_source_dir()
99104
prebuilt_dir = base_dir / 'prebuilt-' + arch_suffix
100105

101-
# download prebuilts (uses legacy builconfig code)
102-
if not fs.is_dir(prebuilt_dir)
106+
sdl_dir = prebuilt_dir / '@0@-@1@'.format(sdl, sdl_ver)
107+
sdl_image_dir = prebuilt_dir / '@0@-@1@'.format(sdl_image, sdl_image_ver)
108+
sdl_mixer_dir = prebuilt_dir / '@0@-@1@'.format(sdl_mixer, sdl_mixer_ver)
109+
sdl_ttf_dir = prebuilt_dir / '@0@-@1@'.format(sdl_ttf, sdl_ttf_ver)
110+
common_lib_dir = prebuilt_dir / 'lib'
111+
112+
# download prebuilts (uses legacy buildconfig code)
113+
required_dirs = [
114+
prebuilt_dir,
115+
sdl_dir,
116+
sdl_image_dir,
117+
sdl_mixer_dir,
118+
sdl_ttf_dir,
119+
common_lib_dir,
120+
]
121+
any_missing = false
122+
foreach d : required_dirs
123+
if not fs.is_dir(d)
124+
any_missing = true
125+
break
126+
endif
127+
endforeach
128+
if any_missing
103129
run_command(
104130
[
105131
find_program('python3', 'python'),
@@ -109,23 +135,16 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
109135
)
110136
endif
111137

112-
sdl_ver = (sdl_api == 3) ? '3.2.10' : '2.32.8'
113-
sdl_image_ver = (sdl_api == 3) ? '3.2.4' : '2.8.8'
114-
sdl_mixer_ver = '2.8.1'
115-
sdl_ttf_ver = (sdl_api == 3) ? '3.2.2' : '2.24.0'
116-
117138
dlls = []
118139

119140
# SDL
120-
sdl_dir = prebuilt_dir / '@0@-@1@'.format(sdl, sdl_ver)
121141
sdl_lib_dir = sdl_dir / 'lib' / arch_suffix
122142
pg_inc_dirs += fs.relative_to(sdl_dir / 'include', base_dir)
123143
pg_lib_dirs += sdl_lib_dir
124144
dlls += sdl_lib_dir / '@0@.dll'.format(sdl)
125145

126146
# SDL_image
127147
if get_option('image').enabled()
128-
sdl_image_dir = prebuilt_dir / '@0@-@1@'.format(sdl_image, sdl_image_ver)
129148
sdl_image_lib_dir = sdl_image_dir / 'lib' / arch_suffix
130149
pg_inc_dirs += fs.relative_to(sdl_image_dir / 'include', base_dir)
131150
pg_lib_dirs += sdl_image_lib_dir
@@ -147,7 +166,6 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
147166

148167
# SDL_mixer
149168
if get_option('mixer').enabled()
150-
sdl_mixer_dir = prebuilt_dir / '@0@-@1@'.format(sdl_mixer, sdl_mixer_ver)
151169
sdl_mixer_lib_dir = sdl_mixer_dir / 'lib' / arch_suffix
152170
pg_inc_dirs += fs.relative_to(sdl_mixer_dir / 'include', base_dir)
153171
pg_lib_dirs += sdl_mixer_lib_dir
@@ -163,7 +181,6 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
163181

164182
# SDL_ttf
165183
if get_option('font').enabled()
166-
sdl_ttf_dir = prebuilt_dir / '@0@-@1@'.format(sdl_ttf, sdl_ttf_ver)
167184
sdl_ttf_lib_dir = sdl_ttf_dir / 'lib' / arch_suffix
168185
pg_inc_dirs += fs.relative_to(sdl_ttf_dir / 'include', base_dir)
169186
pg_lib_dirs += sdl_ttf_lib_dir
@@ -172,7 +189,6 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
172189

173190
# freetype, portmidi and porttime
174191
if get_option('freetype').enabled() and get_option('midi').enabled()
175-
common_lib_dir = prebuilt_dir / 'lib'
176192
pg_inc_dirs += fs.relative_to(prebuilt_dir / 'include', base_dir)
177193
pg_lib_dirs += common_lib_dir
178194
dlls += [common_lib_dir / 'freetype.dll', common_lib_dir / 'portmidi.dll']

0 commit comments

Comments
 (0)