meson-wrap-subprojects wip

This commit is contained in:
Romain Vimont
2025-10-24 19:31:28 +02:00
parent f3d4fde15b
commit 9521b2f22a
3 changed files with 93 additions and 1 deletions

View File

@@ -112,13 +112,19 @@ cc = meson.get_compiler('c')
static = get_option('static')
sdl2_proj = subproject('sdl2')
sdl2_dep = sdl2_proj.get_variable('sdl2_dep')
meson.override_dependency('sdl2', sdl2_dep)
dependencies = [
dependency('libavformat', version: '>= 57.33', static: static),
dependency('libavcodec', version: '>= 57.37', static: static),
dependency('libavutil', static: static),
dependency('libswresample', static: static),
dependency('sdl2', version: '>= 2.0.5', static: static),
dependency('sdl2', static: static),
]
#dependency('sdl2', version: '>= 2.0.5', static: static),
if v4l2_support
dependencies += dependency('libavdevice', static: static)

View File

@@ -0,0 +1,77 @@
project('sdl2', 'c')
prefix = get_option('prefix')
link_type = get_option('default_library')
make_prog = find_program('make', required: true)
configure_command = []
configure_args = [
'./configure',
'--prefix=' + prefix,
]
if host_machine.system() == 'linux'
configure_args += [
'--enable-video-wayland',
'--enable-video-x11',
]
endif
if link_type == 'static'
configure_args += [
'--enable-static',
'--disable-shared',
]
else
configure_args += [
'--disable-static',
'--enable-shared',
]
endif
if meson.is_cross_build()
configure_args += [
'--host=' + host_machine.cpu_family() + '-w64-mingw32',
]
endif
configure_env = environment()
configure_env.set('CFLAGS', '-O2')
configure_env.set('CXXFLAGS', '-O2')
configure_target = custom_target('sdl2_configure',
output: 'config.h',
command: configure_args,
env: configure_env,
console: true
)
if host_machine.system() == 'windows' and link_type == 'shared'
build_output = ['SDL2.dll']
elif link_type == 'shared'
build_output = ['libSDL2.so']
else
build_output = ['libSDL2.a']
endif
sdl2_build = custom_target('sdl2_build',
depends: configure_target,
output: build_output,
command: [make_prog, '-j'],
console: true,
build_by_default: true
)
sdl2_install = custom_target('sdl2_install',
depends: sdl2_build,
output: 'install_done',
command: [make_prog, 'install', '&&', 'touch', '@OUTPUT@'],
console: true,
build_by_default: true,
install: false
)
sdl2_dep = declare_dependency(sources: sdl2_install)

9
subprojects/sdl2.wrap Normal file
View File

@@ -0,0 +1,9 @@
[wrap-file]
directory = SDL-release-2.32.8
source_url = https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.8.tar.gz
source_filename = libsdl2-2.32.8.tar.gz
source_hash = dd35e05644ae527848d02433bec24dd0ea65db59faecf1a0e5d1880c533dac2c
patch_directory = sdl2
[provide]
sdl2 = sdl2_dep