diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-02-06 14:17:15 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-08-21 06:30:44 -0400 |
commit | 35be72ba729d0fcd85c929597edb692c1d0f3bdc (patch) | |
tree | 3e726ed1a4c5cbcc2fad995fee6c5dcc64163b48 /meson.build | |
parent | ffac93df19d33387645376c32a4a789d204e6fcd (diff) |
meson: move SDL and SDL-image detection to meson
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/meson.build b/meson.build index 0b03726ad3..f0374e8508 100644 --- a/meson.build +++ b/meson.build @@ -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')} |