Skip to content

Pull windows deps on update in meson buildconfig #3500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,38 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
# yes, this is a bit ugly and hardcoded but it is what it is
# TODO (middle-term goal) - Should migrate away from this
# consider meson wraps? Hopefully can also get the same build path as below
sdl_ver = (sdl_api == 3) ? '3.2.10' : '2.32.8'
sdl_image_ver = (sdl_api == 3) ? '3.2.4' : '2.8.8'
sdl_mixer_ver = '2.8.1'
sdl_ttf_ver = (sdl_api == 3) ? '3.2.2' : '2.24.0'

arch_suffix = 'x' + host_machine.cpu_family().substring(-2)
base_dir = meson.current_source_dir()
prebuilt_dir = base_dir / 'prebuilt-' + arch_suffix

# download prebuilts (uses legacy builconfig code)
if not fs.is_dir(prebuilt_dir)
sdl_dir = prebuilt_dir / '@0@-@1@'.format(sdl, sdl_ver)
sdl_image_dir = prebuilt_dir / '@0@-@1@'.format(sdl_image, sdl_image_ver)
sdl_mixer_dir = prebuilt_dir / '@0@-@1@'.format(sdl_mixer, sdl_mixer_ver)
sdl_ttf_dir = prebuilt_dir / '@0@-@1@'.format(sdl_ttf, sdl_ttf_ver)
common_lib_dir = prebuilt_dir / 'lib'

# download prebuilts (uses legacy buildconfig code)
required_dirs = [
prebuilt_dir,
sdl_dir,
sdl_image_dir,
sdl_mixer_dir,
sdl_ttf_dir,
common_lib_dir,
]
any_missing = false
foreach d : required_dirs
if not fs.is_dir(d)
any_missing = true
break
endif
endforeach
if any_missing
run_command(
[
find_program('python3', 'python'),
Expand All @@ -109,23 +135,16 @@ if plat == 'win' and host_machine.cpu_family().startswith('x86')
)
endif

sdl_ver = (sdl_api == 3) ? '3.2.10' : '2.32.8'
sdl_image_ver = (sdl_api == 3) ? '3.2.4' : '2.8.8'
sdl_mixer_ver = '2.8.1'
sdl_ttf_ver = (sdl_api == 3) ? '3.2.2' : '2.24.0'

dlls = []

# SDL
sdl_dir = prebuilt_dir / '@0@-@1@'.format(sdl, sdl_ver)
sdl_lib_dir = sdl_dir / 'lib' / arch_suffix
pg_inc_dirs += fs.relative_to(sdl_dir / 'include', base_dir)
pg_lib_dirs += sdl_lib_dir
dlls += sdl_lib_dir / '@[email protected]'.format(sdl)

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

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

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

# freetype, portmidi and porttime
if get_option('freetype').enabled() and get_option('midi').enabled()
common_lib_dir = prebuilt_dir / 'lib'
pg_inc_dirs += fs.relative_to(prebuilt_dir / 'include', base_dir)
pg_lib_dirs += common_lib_dir
dlls += [common_lib_dir / 'freetype.dll', common_lib_dir / 'portmidi.dll']
Expand Down
Loading