meson: Use feature options everywhere it makes sense

This commit is contained in:
Thibault Saunier 2021-03-10 15:36:27 -03:00 committed by Wim Taymans
parent 98bedb3895
commit 485bae5eb0
20 changed files with 211 additions and 224 deletions

View file

@ -6,7 +6,7 @@ if sdl_dep.found()
install : installed_tests_enabled,
install_dir : join_paths(installed_tests_execdir, 'examples', 'spa'))
if get_option('libcamera') and libcamera_dep.found()
if libcamera_dep.found()
executable('local-libcamera', 'local-libcamera.c',
include_directories : [configinc, spa_inc],
c_args : ['-D_GNU_SOURCE'],

View file

@ -9,7 +9,7 @@ spa_inc = include_directories('include')
subdir('include')
if get_option('spa-plugins')
if not get_option('spa-plugins').disabled()
udevrulesdir = get_option('udevrulesdir')
if udevrulesdir == ''
# absolute path, otherwise meson prepends the prefix
@ -17,42 +17,28 @@ if get_option('spa-plugins')
endif
# common dependencies
if get_option('alsa') or get_option('v4l2')
libudev_dep = dependency('libudev')
endif
libudev_dep = dependency('libudev', required: get_option('alsa').enabled() or get_option('v4l2').enabled() or get_option('udev').enabled())
# plugin-specific dependencies
if get_option('alsa')
alsa_dep = dependency('alsa')
endif
if get_option('bluez5')
bluez_dep = dependency('bluez', version : '>= 4.101')
sbc_dep = dependency('sbc')
ldac_dep = dependency('ldacBT-enc', required : false)
ldac_abr_dep = dependency('ldacBT-abr', required : false)
aptx_dep = dependency('libopenaptx', required : false)
fdk_aac_dep = dependency('fdk-aac', required : false)
endif
if get_option('ffmpeg')
avcodec_dep = dependency('libavcodec')
avformat_dep = dependency('libavformat')
endif
if get_option('jack')
jack_dep = dependency('jack', version : '>= 1.9.10')
endif
if get_option('vulkan')
vulkan_dep = dependency('vulkan', version : '>= 1.1.69')
endif
if get_option('libcamera')
libcamera_dep = dependency('camera')
endif
alsa_dep = dependency('alsa', required: get_option('alsa'))
bluez_dep = dependency('bluez', version : '>= 4.101', required: get_option('bluez5'))
sbc_dep = dependency('sbc', required: get_option('bluez5'))
ldac_dep = dependency('ldacBT-enc', required : false)
ldac_abr_dep = dependency('ldacBT-abr', required : false)
aptx_dep = dependency('libopenaptx', required : false)
fdk_aac_dep = dependency('fdk-aac', required : false)
avcodec_dep = dependency('libavcodec', required: get_option('ffmpeg'))
avformat_dep = dependency('libavformat', required: get_option('ffmpeg'))
jack_dep = dependency('jack', version : '>= 1.9.10', required: get_option('jack'))
vulkan_dep = dependency('vulkan', version : '>= 1.1.69', required: get_option('vulkan'))
libcamera_dep = dependency('camera', required: get_option('libcamera'))
subdir('plugins')
endif
subdir('tools')
subdir('tests')
if get_option('examples')
if not get_option('examples').disabled()
subdir('examples')
endif

View file

@ -42,7 +42,7 @@ executable('test-timer',
install : false,
)
if get_option('udev') and libudev_dep.found()
if libudev_dep.found()
install_data(alsa_udevrules,
install_dir : udevrulesdir,
)

View file

@ -1,3 +1,24 @@
bluez5_deps = [ dbus_dep, sbc_dep, bluez_dep ]
foreach dep: bluez5_deps
if not dep.found()
subdir_done()
endif
endforeach
if not get_option('bluez5-backend-hsp-native').disabled()
cdata.set('HAVE_BLUEZ_5_BACKEND_HSP_NATIVE', 1)
cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE', 1)
endif
if not get_option('bluez5-backend-hfp-native').disabled()
cdata.set('HAVE_BLUEZ_5_BACKEND_HFP_NATIVE', 1)
cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE', 1)
endif
if not get_option('bluez5-backend-ofono').disabled()
cdata.set('HAVE_BLUEZ_5_BACKEND_OFONO', 1)
endif
if not get_option('bluez5-backend-hsphfpd').disabled()
cdata.set('HAVE_BLUEZ_5_BACKEND_HSPHFPD', 1)
endif
bluez5_sources = ['plugin.c',
'a2dp-codecs.c',
@ -11,7 +32,6 @@ bluez5_sources = ['plugin.c',
'bluez5-dbus.c']
bluez5_args = [ '-D_GNU_SOURCE' ]
bluez5_deps = [ dbus_dep, sbc_dep, bluez_dep ]
if ldac_dep.found()
bluez5_sources += [ 'a2dp-codec-ldac.c' ]
@ -33,15 +53,15 @@ if fdk_aac_dep.found()
bluez5_deps += fdk_aac_dep
endif
if get_option('bluez5-backend-hsp-native') or get_option('bluez5-backend-hfp-native')
if not get_option('bluez5-backend-hsp-native').disabled() or not get_option('bluez5-backend-hfp-native').disabled()
bluez5_sources += ['backend-native.c']
endif
if get_option('bluez5-backend-ofono')
if not get_option('bluez5-backend-ofono').disabled()
bluez5_sources += ['backend-ofono.c']
endif
if get_option('bluez5-backend-hsphfpd')
if not get_option('bluez5-backend-hsphfpd').disabled()
bluez5_sources += ['backend-hsphfpd.c']
endif

View file

@ -1,48 +1,46 @@
if get_option('alsa')
if alsa_dep.found()
subdir('alsa')
endif
if get_option('audioconvert')
if not get_option('audioconvert').disabled()
subdir('audioconvert')
endif
if get_option('audiomixer')
if not get_option('audiomixer').disabled()
subdir('audiomixer')
endif
if get_option('control')
if not get_option('control').disabled()
subdir('control')
endif
if get_option('audiotestsrc')
if not get_option('audiotestsrc').disabled()
subdir('audiotestsrc')
endif
if get_option('bluez5')
subdir('bluez5')
endif
if get_option('ffmpeg')
subdir('bluez5')
if avcodec_dep.found() and avformat_dep.found()
subdir('ffmpeg')
endif
if get_option('jack')
if jack_dep.found()
subdir('jack')
endif
if get_option('support')
if not get_option('support').disabled()
subdir('support')
endif
if get_option('test')
if not get_option('test').disabled()
subdir('test')
endif
if get_option('videoconvert')
if not get_option('videoconvert').disabled()
subdir('videoconvert')
endif
if get_option('videotestsrc')
if not get_option('videotestsrc').disabled()
subdir('videotestsrc')
endif
if get_option('volume')
if not get_option('volume').disabled()
subdir('volume')
endif
if get_option('vulkan')
if vulkan_dep.found()
subdir('vulkan')
endif
if get_option('v4l2')
if libudev_dep.found() and not get_option('v4l2').disabled()
subdir('v4l2')
endif
if get_option('libcamera')
if libcamera_dep.found()
subdir('libcamera')
endif

View file

@ -15,10 +15,10 @@ spa_support_lib = shared_library('spa-support',
install_dir : join_paths(spa_plugindir, 'support'))
if get_option('evl')
if not get_option('evl').disabled()
evl_inc = include_directories('/usr/evl/include')
evl_lib = cc.find_library('evl',
dirs: ['/usr/evl/lib/'])
dirs: ['/usr/evl/lib/'], required: get_option('evl'))
spa_evl_sources = ['evl-system.c',
'evl-plugin.c']
@ -42,7 +42,7 @@ spa_dbus_lib = shared_library('spa-dbus',
install_dir : join_paths(spa_plugindir, 'support'))
if get_option('systemd') and systemd_dep.found()
if systemd_dep.found()
spa_journal_sources = ['journal.c']
spa_journal_lib = shared_library('spa-journal',