From 94ab1080696af60e371485a6d949e44b7f90c73b Mon Sep 17 00:00:00 2001 From: robert Date: Sun, 20 Aug 2023 17:02:24 +0000 Subject: [PATCH] meson: Fix handling of optional deps We were requiring the presence of all optional dependencies, such as gstreamer-check-1.0 and gstreamer-gl-1.0, on the system, regardless of whether the user actually requires these functionalities. Part-of: --- meson.build | 56 +++++++++++++++++++++++++++++++---------------- meson_options.txt | 2 ++ 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index f1415a65..04ea2e94 100644 --- a/meson.build +++ b/meson.build @@ -62,15 +62,31 @@ deps = [ ['gstreamer-app-1.0', 'gst-plugins-base', 'app_dep', 'gstapp'], ['gstreamer-audio-1.0', 'gst-plugins-base', 'audio_dep', 'gstaudio'], ['gstreamer-base-1.0', 'gstreamer', 'gst_base_dep', 'gst_base'], - ['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check'], - ['gstreamer-gl-1.0', 'gst-plugins-base', 'gst_gl_dep', 'gstgl'], - ['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net'], - ['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp'], - ['gstreamer-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'], - ['gstreamer-sdp-1.0', 'gst-plugins-base', 'sdp_dep', 'gstsdp'], - ['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc'], + ['gstreamer-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'] ] +if get_option('threadshare').allowed() \ + or get_option('onvif').allowed() \ + or get_option('raptorq').allowed() \ + or get_option('rtp').allowed() \ + or get_option('webrtc').allowed() + deps += [['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp']] +endif +if get_option('webrtc').allowed() \ + or get_option('webrtchttp').allowed() + deps += [['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc']] + deps += [['gstreamer-sdp-1.0', 'gst-plugins-base', 'sdp_dep', 'gstsdp']] +endif +if get_option('tests').allowed() + deps += [['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check']] +endif +if get_option('gtk4').allowed() + deps += [['gstreamer-gl-1.0', 'gst-plugins-base', 'gst_gl_dep', 'gstgl']] +endif +if get_option('threadshare').allowed() + deps += [['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net']] +endif + glib_dep = dependency('glib-2.0', version: glib_req) deps_cache += {'glib-2.0': glib_dep} @@ -557,18 +573,20 @@ if get_option('examples').allowed() and examples.length() > 0 ] + feature_args) endif -test('tests', - cargo_wrapper, - env: extra_env, - args: ['test', - meson.current_build_dir(), - meson.current_source_dir(), - meson.global_build_root(), - target, - get_option('prefix'), - get_option('libdir'), - '--packages', packages], - timeout: 600) +if get_option('tests').allowed() + test('tests', + cargo_wrapper, + env: extra_env, + args: ['test', + meson.current_build_dir(), + meson.current_source_dir(), + meson.global_build_root(), + target, + get_option('prefix'), + get_option('libdir'), + '--packages', packages], + timeout: 600) +endif summary({ 'Plugins': plugin_names, diff --git a/meson_options.txt b/meson_options.txt index 033e586c..82df6c19 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -62,3 +62,5 @@ option('doc', type: 'feature', value: 'auto', yield: true, description: 'Enable documentation') option('examples', type: 'feature', value: 'disabled', yield: true, description: 'Build examples') +option('tests', type : 'feature', value : 'auto', yield : true, + description : 'Build and enable unit tests')