meson: convert audio directory to Meson

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-08-17 12:47:55 +02:00
parent a2ce7dbd91
commit 478e943f51
6 changed files with 80 additions and 38 deletions

View File

@ -63,6 +63,11 @@ common-obj-$(CONFIG_LINUX) += fsdev/
common-obj-y += accel/ common-obj-y += accel/
common-obj-y += migration/ common-obj-y += migration/
common-obj-$(CONFIG_AUDIO_ALSA) += audio-alsa$(DSOSUF)
common-obj-$(CONFIG_AUDIO_OSS) += audio-oss$(DSOSUF)
common-obj-$(CONFIG_AUDIO_PA) += audio-pa$(DSOSUF)
common-obj-$(CONFIG_AUDIO_SDL) += audio-sdl$(DSOSUF)
common-obj-$(if $(CONFIG_CURL),m) += block-curl$(DSOSUF) common-obj-$(if $(CONFIG_CURL),m) += block-curl$(DSOSUF)
common-obj-$(if $(CONFIG_GLUSTERFS),m) += block-gluster$(DSOSUF) common-obj-$(if $(CONFIG_GLUSTERFS),m) += block-gluster$(DSOSUF)
common-obj-$(if $(CONFIG_LIBISCSI),m) += block-iscsi$(DSOSUF) common-obj-$(if $(CONFIG_LIBISCSI),m) += block-iscsi$(DSOSUF)
@ -73,8 +78,6 @@ common-obj-$(if $(CONFIG_RBD),m) += block-rbd$(DSOSUF)
common-obj-$(if $(CONFIG_LZFSE),m) += block-dmg-lzfse$(DSOSUF) common-obj-$(if $(CONFIG_LZFSE),m) += block-dmg-lzfse$(DSOSUF)
common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += block-dmg-bz2$(DSOSUF) common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) += block-dmg-bz2$(DSOSUF)
common-obj-y += audio/
common-obj-m += audio/
common-obj-y += hw/ common-obj-y += hw/
common-obj-m += hw/ common-obj-m += hw/

View File

@ -166,9 +166,10 @@ LIBS := $(libs_softmmu) $(LIBS)
# Temporary until emulators are linked by Meson # Temporary until emulators are linked by Meson
LIBS := $(LIBS) @../block.syms @../qemu.syms LIBS := $(LIBS) @../block.syms @../qemu.syms
ifneq ($(CONFIG_MODULES),y) ifneq ($(CONFIG_MODULES),y)
LIBS := $(LIBS) LIBS := $(LIBS) $(ALSA_LIBS) $(OSS_LIBS) $(PULSE_LIBS) $(SDL_LIBS)
endif endif
LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS)
LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
# Hardware support # Hardware support
ifeq ($(TARGET_NAME), sparc64) ifeq ($(TARGET_NAME), sparc64)

View File

@ -1,35 +0,0 @@
common-obj-y = audio.o audio_legacy.o noaudio.o wavaudio.o mixeng.o
common-obj-$(CONFIG_SPICE) += spiceaudio.o
common-obj-$(CONFIG_AUDIO_COREAUDIO) += coreaudio.o
common-obj-$(CONFIG_AUDIO_DSOUND) += dsoundaudio.o
common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
common-obj-y += wavcapture.o
coreaudio.o-libs := $(COREAUDIO_LIBS)
dsoundaudio.o-libs := $(DSOUND_LIBS)
# alsa module
common-obj-$(CONFIG_AUDIO_ALSA) += alsa.mo
alsa.mo-objs = alsaaudio.o
alsa.mo-libs := $(ALSA_LIBS)
# oss module
common-obj-$(CONFIG_AUDIO_OSS) += oss.mo
oss.mo-objs = ossaudio.o
oss.mo-libs := $(OSS_LIBS)
# pulseaudio module
common-obj-$(CONFIG_AUDIO_PA) += pa.mo
pa.mo-objs = paaudio.o
pa.mo-libs := $(PULSE_LIBS)
# sdl module
common-obj-$(CONFIG_AUDIO_SDL) += sdl.mo
sdl.mo-objs = sdlaudio.o
sdl.mo-cflags := $(SDL_CFLAGS)
sdl.mo-libs := $(SDL_LIBS)
# jack module
common-obj-$(CONFIG_AUDIO_JACK) += jack.mo
jack.mo-objs = jackaudio.o
jack.mo-libs := $(JACK_LIBS)

30
audio/meson.build Normal file
View File

@ -0,0 +1,30 @@
softmmu_ss.add(files(
'audio.c',
'audio_legacy.c',
'mixeng.c',
'noaudio.c',
'wavaudio.c',
'wavcapture.c',
))
softmmu_ss.add(when: [spice, 'CONFIG_SPICE'], if_true: files('spiceaudio.c'))
softmmu_ss.add(when: [coreaudio, 'CONFIG_AUDIO_COREAUDIO'], if_true: files('coreaudio.c'))
softmmu_ss.add(when: [dsound, 'CONFIG_AUDIO_DSOUND'], if_true: files('dsoundaudio.c'))
softmmu_ss.add(when: ['CONFIG_AUDIO_WIN_INT'], if_true: files('audio_win_int.c'))
audio_modules = {}
foreach m : [
['CONFIG_AUDIO_ALSA', 'alsa', alsa, 'alsaaudio.c'],
['CONFIG_AUDIO_OSS', 'oss', oss, 'ossaudio.c'],
['CONFIG_AUDIO_PA', 'pa', pulse, 'paaudio.c'],
['CONFIG_AUDIO_SDL', 'sdl', sdl, 'sdlaudio.c'],
['CONFIG_AUDIO_JACK', 'jack', jack, 'jackaudio.c']
]
if config_host.has_key(m[0])
module_ss = ss.source_set()
module_ss.add(when: m[2], if_true: files(m[3]))
audio_modules += {m[1] : module_ss}
endif
endforeach
modules += {'audio': audio_modules}

16
configure vendored
View File

@ -3767,6 +3767,8 @@ for drv in $audio_drv_list; do
alsa | try-alsa) alsa | try-alsa)
if $pkg_config alsa --exists; then if $pkg_config alsa --exists; then
alsa_libs=$($pkg_config alsa --libs) alsa_libs=$($pkg_config alsa --libs)
alsa_cflags=$($pkg_config alsa --cflags)
alsa=yes
if test "$drv" = "try-alsa"; then if test "$drv" = "try-alsa"; then
audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/') audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/')
fi fi
@ -3782,7 +3784,9 @@ for drv in $audio_drv_list; do
pa | try-pa) pa | try-pa)
if $pkg_config libpulse --exists; then if $pkg_config libpulse --exists; then
libpulse=yes
pulse_libs=$($pkg_config libpulse --libs) pulse_libs=$($pkg_config libpulse --libs)
pulse_cflags=$($pkg_config libpulse --cflags)
if test "$drv" = "try-pa"; then if test "$drv" = "try-pa"; then
audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/') audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/')
fi fi
@ -3825,6 +3829,7 @@ for drv in $audio_drv_list; do
jack | try-jack) jack | try-jack)
if $pkg_config jack --exists; then if $pkg_config jack --exists; then
libjack=yes
jack_libs=$($pkg_config jack --libs) jack_libs=$($pkg_config jack --libs)
if test "$drv" = "try-jack"; then if test "$drv" = "try-jack"; then
audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/')
@ -7036,11 +7041,22 @@ for drv in $audio_drv_list; do
echo "$def=y" >> $config_host_mak ;; echo "$def=y" >> $config_host_mak ;;
esac esac
done done
if test "$alsa" = "yes" ; then
echo "CONFIG_ALSA=y" >> $config_host_mak
fi
echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
echo "ALSA_CFLAGS=$alsa_cflags" >> $config_host_mak
if test "$libpulse" = "yes" ; then
echo "CONFIG_LIBPULSE=y" >> $config_host_mak
fi
echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
echo "PULSE_CFLAGS=$pulse_cflags" >> $config_host_mak
echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
echo "OSS_LIBS=$oss_libs" >> $config_host_mak echo "OSS_LIBS=$oss_libs" >> $config_host_mak
if test "$libjack" = "yes" ; then
echo "CONFIG_LIBJACK=y" >> $config_host_mak
fi
echo "JACK_LIBS=$jack_libs" >> $config_host_mak echo "JACK_LIBS=$jack_libs" >> $config_host_mak
if test "$audio_win_int" = "yes" ; then if test "$audio_win_int" = "yes" ; then
echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak

View File

@ -147,6 +147,20 @@ if 'CONFIG_XKBCOMMON' in config_host
xkbcommon = declare_dependency(compile_args: config_host['XKBCOMMON_CFLAGS'].split(), xkbcommon = declare_dependency(compile_args: config_host['XKBCOMMON_CFLAGS'].split(),
link_args: config_host['XKBCOMMON_LIBS'].split()) link_args: config_host['XKBCOMMON_LIBS'].split())
endif endif
pulse = not_found
if 'CONFIG_LIBPULSE' in config_host
pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
link_args: config_host['PULSE_LIBS'].split())
endif
alsa = not_found
if 'CONFIG_ALSA' in config_host
alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
link_args: config_host['ALSA_LIBS'].split())
endif
jack = not_found
if 'CONFIG_LIBJACK' in config_host
jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
endif
spice = not_found spice = not_found
if 'CONFIG_SPICE' in config_host if 'CONFIG_SPICE' in config_host
spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(), spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
@ -217,6 +231,18 @@ liblzfse = not_found
if 'CONFIG_LZFSE' in config_host if 'CONFIG_LZFSE' in config_host
liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split()) liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
endif endif
oss = not_found
if 'CONFIG_AUDIO_OSS' in config_host
oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
endif
dsound = not_found
if 'CONFIG_AUDIO_DSOUND' in config_host
dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
endif
coreaudio = not_found
if 'CONFIG_AUDIO_COREAUDIO' in config_host
coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
endif
create_config = find_program('scripts/create_config') create_config = find_program('scripts/create_config')
minikconf = find_program('scripts/minikconf.py') minikconf = find_program('scripts/minikconf.py')
@ -518,6 +544,7 @@ libqemuutil = static_library('qemuutil',
qemuutil = declare_dependency(link_with: libqemuutil, qemuutil = declare_dependency(link_with: libqemuutil,
sources: genh + version_res) sources: genh + version_res)
subdir('audio')
subdir('io') subdir('io')
subdir('chardev') subdir('chardev')
subdir('fsdev') subdir('fsdev')