configure | 17 +++++++---------- meson.build | 10 ++++++++-- meson_options.txt | 2 ++ ui/meson.build | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-)
While detection of the framework was already there, moving
the option allows for better error reporting.
Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 17 +++++++----------
meson.build | 10 ++++++++--
meson_options.txt | 2 ++
ui/meson.build | 2 +-
4 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/configure b/configure
index d6fbadad27..b4c0e0d07c 100755
--- a/configure
+++ b/configure
@@ -448,7 +448,7 @@ bsd="no"
linux="no"
solaris="no"
profiler="no"
-cocoa="no"
+cocoa="auto"
softmmu="yes"
linux_user="no"
bsd_user="no"
@@ -868,7 +868,7 @@ Darwin)
QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS"
fi
- cocoa="yes"
+ cocoa="enabled"
audio_drv_list="coreaudio try-sdl"
audio_possible_drivers="coreaudio sdl"
QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS"
@@ -1240,10 +1240,10 @@ for opt do
;;
--enable-profiler) profiler="yes"
;;
- --disable-cocoa) cocoa="no"
+ --disable-cocoa) cocoa="disabled"
;;
--enable-cocoa)
- cocoa="yes" ;
+ cocoa="enabled" ;
audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
;;
--disable-system) softmmu="no"
@@ -2388,8 +2388,8 @@ fi
# cocoa implies not SDL or GTK
# (the cocoa UI code currently assumes it is always the active UI
# and doesn't interact well with other UI frontend code)
-if test "$cocoa" = "yes"; then
- if test "$sdl" = "yes"; then
+if test "$cocoa" = "enabled"; then
+ if test "$sdl" = "enabled"; then
error_exit "Cocoa and SDL UIs cannot both be enabled at once"
fi
if test "$gtk" = "yes"; then
@@ -6622,9 +6622,6 @@ if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
echo "X11_LIBS=$x11_libs" >> $config_host_mak
fi
-if test "$cocoa" = "yes" ; then
- echo "CONFIG_COCOA=y" >> $config_host_mak
-fi
if test "$iconv" = "yes" ; then
echo "CONFIG_ICONV=y" >> $config_host_mak
echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak
@@ -7937,7 +7934,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim \
- -Dsdl=$sdl -Dsdl_image=$sdl_image \
+ -Dcocoa=$cocoa -Dsdl=$sdl -Dsdl_image=$sdl_image \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\
$cross_arg \
diff --git a/meson.build b/meson.build
index d3b1e5c34c..c94e92d774 100644
--- a/meson.build
+++ b/meson.build
@@ -88,7 +88,7 @@ socket = []
version_res = []
coref = []
iokit = []
-cocoa = []
+cocoa = not_found
hvf = []
if targetos == 'windows'
socket = cc.find_library('ws2_32')
@@ -101,7 +101,7 @@ if targetos == 'windows'
elif targetos == 'darwin'
coref = dependency('appleframeworks', modules: 'CoreFoundation')
iokit = dependency('appleframeworks', modules: 'IOKit')
- cocoa = dependency('appleframeworks', modules: 'Cocoa')
+ cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
hvf = dependency('appleframeworks', modules: 'Hypervisor')
elif targetos == 'sunos'
socket = [cc.find_library('socket'),
@@ -112,6 +112,11 @@ elif targetos == 'haiku'
cc.find_library('network'),
cc.find_library('bsd')]
endif
+
+if not cocoa.found() and get_option('cocoa').enabled()
+ error('Cocoa not available on this platform')
+endif
+
# The path to glib.h is added to all compilation commands. This was
# grandfathered in from the QEMU Makefiles.
add_project_arguments(config_host['GLIB_CFLAGS'].split(),
@@ -461,6 +466,7 @@ endif
# Create config-host.h
+config_host_data.set('CONFIG_COCOA', cocoa.found())
config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
config_host_data.set('CONFIG_VNC', vnc.found())
diff --git a/meson_options.txt b/meson_options.txt
index 894e006799..599af8485f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,6 +11,8 @@ option('malloc_trim', type : 'feature', value : 'auto',
option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
value: 'system', description: 'choose memory allocator to use')
+option('cocoa', type : 'feature', value : 'auto',
+ description: 'Cocoa user interface (macOS only)')
option('sdl', type : 'feature', value : 'auto',
description: 'SDL user interface')
option('sdl_image', type : 'feature', value : 'auto',
diff --git a/ui/meson.build b/ui/meson.build
index dd6c110136..8a080c38e3 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -15,7 +15,7 @@ softmmu_ss.add(files(
softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('input-linux.c'))
softmmu_ss.add(when: 'CONFIG_SPICE', if_true: files('spice-core.c', 'spice-input.c', 'spice-display.c'))
-softmmu_ss.add(when: [cocoa, 'CONFIG_COCOA'], if_true: files('cocoa.m'))
+softmmu_ss.add(when: cocoa, if_true: files('cocoa.m'))
vnc_ss = ss.source_set()
vnc_ss.add(files(
--
2.26.2
On 9/16/20 1:11 AM, Paolo Bonzini wrote: > --enable-cocoa) > - cocoa="yes" ; > + cocoa="enabled" ; Lose the stray ; at the same time? > @@ -101,7 +101,7 @@ if targetos == 'windows' > elif targetos == 'darwin' > coref = dependency('appleframeworks', modules: 'CoreFoundation') > iokit = dependency('appleframeworks', modules: 'IOKit') > - cocoa = dependency('appleframeworks', modules: 'Cocoa') > + cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) > hvf = dependency('appleframeworks', modules: 'Hypervisor') > elif targetos == 'sunos' > socket = [cc.find_library('socket'), > @@ -112,6 +112,11 @@ elif targetos == 'haiku' > cc.find_library('network'), > cc.find_library('bsd')] > endif > + > +if not cocoa.found() and get_option('cocoa').enabled() > + error('Cocoa not available on this platform') > +endif Isn't the error redundant with the required above? r~
On 9/16/20 8:30 AM, Richard Henderson wrote: > Isn't the error redundant with the required above? Nevermind. Obviously the required: is buried under the targetos check. ENOCOFFEE. r~
On Wed, Sep 16, 2020 at 04:11:30AM -0400, Paolo Bonzini wrote: > While detection of the framework was already there, moving > the option allows for better error reporting. > > Reported-by: Christophe de Dinechin <dinechin@redhat.com> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > configure | 17 +++++++---------- > meson.build | 10 ++++++++-- > meson_options.txt | 2 ++ > ui/meson.build | 2 +- > 4 files changed, 18 insertions(+), 13 deletions(-) > > diff --git a/configure b/configure > index d6fbadad27..b4c0e0d07c 100755 > --- a/configure > +++ b/configure > @@ -448,7 +448,7 @@ bsd="no" > linux="no" > solaris="no" > profiler="no" > -cocoa="no" > +cocoa="auto" > softmmu="yes" > linux_user="no" > bsd_user="no" > @@ -868,7 +868,7 @@ Darwin) > QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" > QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS" > fi > - cocoa="yes" > + cocoa="enabled" > audio_drv_list="coreaudio try-sdl" > audio_possible_drivers="coreaudio sdl" > QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS" > @@ -1240,10 +1240,10 @@ for opt do > ;; > --enable-profiler) profiler="yes" > ;; > - --disable-cocoa) cocoa="no" > + --disable-cocoa) cocoa="disabled" > ;; > --enable-cocoa) > - cocoa="yes" ; > + cocoa="enabled" ; > audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" > ;; > --disable-system) softmmu="no" > @@ -2388,8 +2388,8 @@ fi > # cocoa implies not SDL or GTK > # (the cocoa UI code currently assumes it is always the active UI > # and doesn't interact well with other UI frontend code) > -if test "$cocoa" = "yes"; then > - if test "$sdl" = "yes"; then > +if test "$cocoa" = "enabled"; then > + if test "$sdl" = "enabled"; then > error_exit "Cocoa and SDL UIs cannot both be enabled at once" > fi > if test "$gtk" = "yes"; then > @@ -6622,9 +6622,6 @@ if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then > echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak > echo "X11_LIBS=$x11_libs" >> $config_host_mak > fi > -if test "$cocoa" = "yes" ; then > - echo "CONFIG_COCOA=y" >> $config_host_mak > -fi > if test "$iconv" = "yes" ; then > echo "CONFIG_ICONV=y" >> $config_host_mak > echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak > @@ -7937,7 +7934,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \ > -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ > -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ > -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim \ > - -Dsdl=$sdl -Dsdl_image=$sdl_image \ > + -Dcocoa=$cocoa -Dsdl=$sdl -Dsdl_image=$sdl_image \ > -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ > -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\ > $cross_arg \ > diff --git a/meson.build b/meson.build > index d3b1e5c34c..c94e92d774 100644 > --- a/meson.build > +++ b/meson.build > @@ -88,7 +88,7 @@ socket = [] > version_res = [] > coref = [] > iokit = [] > -cocoa = [] > +cocoa = not_found > hvf = [] > if targetos == 'windows' > socket = cc.find_library('ws2_32') > @@ -101,7 +101,7 @@ if targetos == 'windows' > elif targetos == 'darwin' > coref = dependency('appleframeworks', modules: 'CoreFoundation') > iokit = dependency('appleframeworks', modules: 'IOKit') > - cocoa = dependency('appleframeworks', modules: 'Cocoa') > + cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) > hvf = dependency('appleframeworks', modules: 'Hypervisor') > elif targetos == 'sunos' > socket = [cc.find_library('socket'), > @@ -112,6 +112,11 @@ elif targetos == 'haiku' > cc.find_library('network'), > cc.find_library('bsd')] > endif > + > +if not cocoa.found() and get_option('cocoa').enabled() > + error('Cocoa not available on this platform') > +endif > + > # The path to glib.h is added to all compilation commands. This was > # grandfathered in from the QEMU Makefiles. > add_project_arguments(config_host['GLIB_CFLAGS'].split(), > @@ -461,6 +466,7 @@ endif > > # Create config-host.h > > +config_host_data.set('CONFIG_COCOA', cocoa.found()) > config_host_data.set('CONFIG_SDL', sdl.found()) > config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) > config_host_data.set('CONFIG_VNC', vnc.found()) > diff --git a/meson_options.txt b/meson_options.txt > index 894e006799..599af8485f 100644 > --- a/meson_options.txt > +++ b/meson_options.txt > @@ -11,6 +11,8 @@ option('malloc_trim', type : 'feature', value : 'auto', > option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'], > value: 'system', description: 'choose memory allocator to use') > > +option('cocoa', type : 'feature', value : 'auto', > + description: 'Cocoa user interface (macOS only)') > option('sdl', type : 'feature', value : 'auto', > description: 'SDL user interface') > option('sdl_image', type : 'feature', value : 'auto', > diff --git a/ui/meson.build b/ui/meson.build > index dd6c110136..8a080c38e3 100644 > --- a/ui/meson.build > +++ b/ui/meson.build > @@ -15,7 +15,7 @@ softmmu_ss.add(files( > > softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('input-linux.c')) > softmmu_ss.add(when: 'CONFIG_SPICE', if_true: files('spice-core.c', 'spice-input.c', 'spice-display.c')) > -softmmu_ss.add(when: [cocoa, 'CONFIG_COCOA'], if_true: files('cocoa.m')) > +softmmu_ss.add(when: cocoa, if_true: files('cocoa.m')) > > vnc_ss = ss.source_set() > vnc_ss.add(files( > -- > 2.26.2 > Hi Paolo, The patch looks good but can't be applied to yesterday's evening master: Applying: configure: move cocoa option to Meson error: patch failed: configure:7937 error: configure: patch does not apply error: patch failed: meson_options.txt:11 error: meson_options.txt: patch does not apply Patch failed at 0001 configure: move cocoa option to Meson Regards, Roman
© 2016 - 2024 Red Hat, Inc.