meson: move SDL and SDL-image detection to meson

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-02-06 14:17:15 +01:00
parent ffac93df19
commit 35be72ba72
6 changed files with 37 additions and 146 deletions

View file

@ -11,6 +11,7 @@ cc = meson.get_compiler('c')
config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
config_all_disas = keyval.load(meson.current_build_dir() / 'config-all-disas.mak')
enable_modules = 'CONFIG_MODULES' in config_host
enable_static = 'CONFIG_STATIC' in config_host
build_docs = 'BUILD_DOCS' in config_host
config_host_data = configuration_data()
genh = []
@ -218,13 +219,24 @@ brlapi = not_found
if 'CONFIG_BRLAPI' in config_host
brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
endif
sdlwindows = false
sdl = not_found
if 'CONFIG_SDL' in config_host
sdl = declare_dependency(compile_args: config_host['SDL_CFLAGS'].split(),
link_args: config_host['SDL_LIBS'].split())
sdlwindows = config_host['SDL_LIBS'].contains('-mwindows')
sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static,
include_type: 'system')
sdl_image = not_found
if sdl.found()
# work around 2.0.8 bug
sdl = declare_dependency(compile_args: '-Wno-undef',
dependencies: sdl)
sdl_image = dependency('sdl-image', required: get_option('sdl_image'),
static: enable_static)
else
if get_option('sdl_image').enabled()
error('sdl-image required, but SDL was @0@',
get_option('sdl').disabled() ? 'disabled' : 'not found')
endif
sdl_image = not_found
endif
rbd = not_found
if 'CONFIG_RBD' in config_host
rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
@ -363,6 +375,8 @@ endif
# Create config-host.h
config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
@ -963,7 +977,7 @@ foreach target : target_dirs
'sources': files('softmmu/main.c'),
'dependencies': []
}]
if sdlwindows
if targetos == 'windows' and (sdl.found() or gtk.found())
execs += [{
'name': 'qemu-system-' + target_name + 'w',
'gui': true,
@ -1239,8 +1253,8 @@ if targetos == 'darwin'
summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
endif
# TODO: add back version
summary_info += {'SDL support': config_host.has_key('CONFIG_SDL')}
summary_info += {'SDL image support': config_host.has_key('CONFIG_SDL_IMAGE')}
summary_info += {'SDL support': sdl.found()}
summary_info += {'SDL image support': sdl_image.found()}
# TODO: add back version
summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}