[PATCH] meson: skip SDL2 detection if --disable-system

Paolo Bonzini posted 1 patch 3 years, 8 months ago
Test docker-quick@centos7 failed
Test docker-mingw@fedora failed
Test checkpatch failed
Test FreeBSD failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200826070245.12051-1-pbonzini@redhat.com
meson.build | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
[PATCH] meson: skip SDL2 detection if --disable-system
Posted by Paolo Bonzini 3 years, 8 months ago
SDL is only used for system emulation; avoid spurious warnings for
static --disable-system emulation by skipping the detection of
the library if there are no system emulation targets.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/meson.build b/meson.build
index 57c2fe2b65..19d4d42512 100644
--- a/meson.build
+++ b/meson.build
@@ -21,6 +21,16 @@ qemu_datadir = get_option('datadir') + get_option('confsuffix')
 config_host_data = configuration_data()
 genh = []
 
+target_dirs = config_host['TARGET_DIRS'].split()
+have_user = false
+have_system = false
+foreach target : target_dirs
+  have_user = have_user or target.endswith('-user')
+  have_system = have_system or target.endswith('-softmmu')
+endforeach
+have_tools = 'CONFIG_TOOLS' in config_host
+have_block = have_system or have_tools
+
 add_project_arguments(config_host['QEMU_CFLAGS'].split(),
                       native: false, language: ['c', 'objc'])
 add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
@@ -225,9 +235,12 @@ if 'CONFIG_BRLAPI' in config_host
   brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
 endif
 
-sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static,
-                 include_type: 'system')
-sdl_image = not_found
+sdl = not_found
+if have_system
+  sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static,
+                   include_type: 'system')
+  sdl_image = not_found
+endif
 if sdl.found()
   # work around 2.0.8 bug
   sdl = declare_dependency(compile_args: '-Wno-undef',
@@ -423,9 +436,6 @@ endforeach
 genh += configure_file(output: 'config-host.h', configuration: config_host_data)
 
 minikconf = find_program('scripts/minikconf.py')
-target_dirs = config_host['TARGET_DIRS'].split()
-have_user = false
-have_system = false
 config_devices_mak_list = []
 config_devices_h = {}
 config_target_h = {}
@@ -446,7 +456,6 @@ kconfig_external_symbols = [
 ]
 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
 foreach target : target_dirs
-  have_user = have_user or target.endswith('-user')
   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
 
   config_target_data = configuration_data()
@@ -469,8 +478,6 @@ foreach target : target_dirs
                                                configuration: config_target_data)}
 
   if target.endswith('-softmmu')
-    have_system = true
-
     base_kconfig = []
     foreach sym : kconfig_external_symbols
       if sym in config_target or sym in config_host
@@ -500,8 +507,6 @@ foreach target : target_dirs
   endif
   config_target_mak += {target: config_target}
 endforeach
-have_tools = 'CONFIG_TOOLS' in config_host
-have_block = have_system or have_tools
 
 grepy = find_program('scripts/grepy.sh')
 # This configuration is used to build files that are shared by
-- 
2.26.2


Re: [PATCH] meson: skip SDL2 detection if --disable-system
Posted by Marc-André Lureau 3 years, 8 months ago
On Wed, Aug 26, 2020 at 11:03 AM Paolo Bonzini <pbonzini@redhat.com> wrote:

> SDL is only used for system emulation; avoid spurious warnings for
> static --disable-system emulation by skipping the detection of
> the library if there are no system emulation targets.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  meson.build | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 57c2fe2b65..19d4d42512 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -21,6 +21,16 @@ qemu_datadir = get_option('datadir') +
> get_option('confsuffix')
>  config_host_data = configuration_data()
>  genh = []
>
> +target_dirs = config_host['TARGET_DIRS'].split()
> +have_user = false
> +have_system = false
> +foreach target : target_dirs
> +  have_user = have_user or target.endswith('-user')
> +  have_system = have_system or target.endswith('-softmmu')
> +endforeach
> +have_tools = 'CONFIG_TOOLS' in config_host
> +have_block = have_system or have_tools
> +
>  add_project_arguments(config_host['QEMU_CFLAGS'].split(),
>                        native: false, language: ['c', 'objc'])
>  add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
> @@ -225,9 +235,12 @@ if 'CONFIG_BRLAPI' in config_host
>    brlapi = declare_dependency(link_args:
> config_host['BRLAPI_LIBS'].split())
>  endif
>
> -sdl = dependency('sdl2', required: get_option('sdl'), static:
> enable_static,
> -                 include_type: 'system')
> -sdl_image = not_found
> +sdl = not_found
> +if have_system
> +  sdl = dependency('sdl2', required: get_option('sdl'), static:
> enable_static,
> +                   include_type: 'system')
> +  sdl_image = not_found
> +endif
>  if sdl.found()
>    # work around 2.0.8 bug
>    sdl = declare_dependency(compile_args: '-Wno-undef',
> @@ -423,9 +436,6 @@ endforeach
>  genh += configure_file(output: 'config-host.h', configuration:
> config_host_data)
>
>  minikconf = find_program('scripts/minikconf.py')
> -target_dirs = config_host['TARGET_DIRS'].split()
> -have_user = false
> -have_system = false
>  config_devices_mak_list = []
>  config_devices_h = {}
>  config_target_h = {}
> @@ -446,7 +456,6 @@ kconfig_external_symbols = [
>  ]
>  ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
>  foreach target : target_dirs
> -  have_user = have_user or target.endswith('-user')
>    config_target = keyval.load(meson.current_build_dir() / target /
> 'config-target.mak')
>
>    config_target_data = configuration_data()
> @@ -469,8 +478,6 @@ foreach target : target_dirs
>                                                 configuration:
> config_target_data)}
>
>    if target.endswith('-softmmu')
> -    have_system = true
> -
>      base_kconfig = []
>      foreach sym : kconfig_external_symbols
>        if sym in config_target or sym in config_host
> @@ -500,8 +507,6 @@ foreach target : target_dirs
>    endif
>    config_target_mak += {target: config_target}
>  endforeach
> -have_tools = 'CONFIG_TOOLS' in config_host
> -have_block = have_system or have_tools
>
>  grepy = find_program('scripts/grepy.sh')
>  # This configuration is used to build files that are shared by
> --
> 2.26.2
>
>
>

-- 
Marc-André Lureau