meson: fix build with missing libudev-devel

This commit is contained in:
Wim Taymans 2024-01-26 13:28:07 +01:00
parent cb2b7af8fd
commit b4c7973d49
7 changed files with 28 additions and 9 deletions

View file

@ -106,7 +106,8 @@ if get_option('spa-plugins').allowed()
cdata.set('HAVE_ALSA_COMPRESS_OFFLOAD', compress_offload_option.allowed())
# common dependencies
libudev_dep = dependency('libudev', required: alsa_dep.found() or get_option('udev').enabled() or get_option('v4l2').enabled())
libudev_dep = dependency('libudev', required: get_option('udev').enabled())
cdata.set('HAVE_LIBUDEV', libudev_dep.found())
summary({'Udev': libudev_dep.found()}, bool_yn: true, section: 'Backend')
subdir('plugins')

View file

@ -40,8 +40,13 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
*factory = &spa_alsa_sink_factory;
break;
case 2:
#ifdef HAVE_LIBUDEV
*factory = &spa_alsa_udev_factory;
break;
#else
(*index)++;
SPA_FALLTHROUGH;
#endif
case 3:
*factory = &spa_alsa_pcm_device_factory;
break;

View file

@ -1,11 +1,10 @@
subdir('acp')
subdir('mixer')
spa_alsa_dependencies = [ spa_dep, alsa_dep, libudev_dep, mathlib, epoll_shim_dep, libinotify_dep ]
spa_alsa_dependencies = [ spa_dep, alsa_dep, mathlib, epoll_shim_dep, libinotify_dep ]
spa_alsa_sources = ['alsa.c',
'alsa.h',
'alsa-udev.c',
'alsa-acp-device.c',
'alsa-pcm-device.c',
'alsa-pcm-sink.c',
@ -14,6 +13,11 @@ spa_alsa_sources = ['alsa.c',
'alsa-seq-bridge.c',
'alsa-seq.c']
if libudev_dep.found()
spa_alsa_sources += [ 'alsa-udev.c' ]
spa_alsa_dependencies += [ libudev_dep ]
endif
if compress_offload_option.allowed()
spa_alsa_sources += ['alsa-compress-offload-sink.c',
'alsa-compress-offload-device.c',

View file

@ -8,6 +8,6 @@ libcamera_sources = [
libcameralib = shared_library('spa-libcamera',
libcamera_sources,
include_directories : [ configinc ],
dependencies : [ spa_dep, libudev_dep, libcamera_dep, pthread_lib ],
dependencies : [ spa_dep, libcamera_dep, pthread_lib ],
install : true,
install_dir : spa_plugindir / 'libcamera')

View file

@ -45,10 +45,9 @@ if have_vulkan
endif
v4l2_header_found = cc.has_header('linux/videodev2.h', required: get_option('v4l2'))
v4l2_supported = libudev_dep.found() and v4l2_header_found
summary({'V4L2 kernel header': v4l2_header_found}, bool_yn: true, section: 'Backend')
summary({'V4L2 enabled': v4l2_supported}, bool_yn: true, section: 'Backend')
if v4l2_supported
summary({'V4L2 enabled': v4l2_header_found}, bool_yn: true, section: 'Backend')
if v4l2_header_found
subdir('v4l2')
endif
if libcamera_dep.found()

View file

@ -1,10 +1,15 @@
v4l2_sources = ['v4l2.c',
'v4l2-device.c',
'v4l2-udev.c',
'v4l2-source.c']
v4l2_dependencies = [ spa_dep, libinotify_dep ]
if libudev_dep.found()
v4l2_sources += [ 'v4l2-udev.c' ]
v4l2_dependencies += [ libudev_dep ]
endif
v4l2lib = shared_library('spa-v4l2',
v4l2_sources,
dependencies : [ spa_dep, libudev_dep, libinotify_dep ],
dependencies : v4l2_dependencies,
install : true,
install_dir : spa_plugindir / 'v4l2')

View file

@ -29,8 +29,13 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory,
*factory = &spa_v4l2_source_factory;
break;
case 1:
#ifdef HAVE_LIBUDEV
*factory = &spa_v4l2_udev_factory;
break;
#else
(*index)++;
SPA_FALLTHROUGH;
#endif
case 2:
*factory = &spa_v4l2_device_factory;
break;