meson: Cleanup plugin build script

This commit is contained in:
Rafał Dzięgiel
2022-05-08 18:47:13 +02:00
parent b7b99c20cf
commit 4b93d4d132
4 changed files with 52 additions and 37 deletions

4
lib/gst/meson.build vendored
View File

@@ -2,6 +2,4 @@ if get_option('lib')
subdir('clapper') subdir('clapper')
endif endif
if not get_option('gst-plugin').disabled() subdir('plugin')
subdir('plugin')
endif

View File

@@ -1,23 +1,38 @@
gst_clapper_gl_base_importer_dep = dependency('', required: false) gst_clapper_gl_base_importer_dep = dependency('', required: false)
plugin_needs_gl_base = ( all_importers = [
'glimporter',
'gluploader',
'rawimporter',
]
build_glbase = (
not get_option('glimporter').disabled() not get_option('glimporter').disabled()
or not get_option('gluploader').disabled() or not get_option('gluploader').disabled()
) )
plugin_gl_support_required = ( gl_support_required = (
get_option('glimporter').enabled() get_option('glimporter').enabled()
or get_option('gluploader').enabled() or get_option('gluploader').enabled()
) )
gst_plugin_gl_deps = [gstgl_dep, gstglproto_dep] # We cannot build any importers without sink that they depend on
if not gst_clapper_sink_dep.found()
foreach imp : all_importers
if get_option(imp).enabled()
error('"@0@" option was enabled, but it requires building gstreamer plugin'.format(imp))
endif
endforeach
endif
gst_plugin_gl_base_deps = [gst_clapper_sink_dep, gstgl_dep, gstglproto_dep]
have_gtk_gl_windowing = false have_gtk_gl_windowing = false
if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_glx) if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_glx)
gtk_x11_dep = dependency('gtk4-x11', required: false) gtk_x11_dep = dependency('gtk4-x11', required: false)
if gtk_x11_dep.found() if gtk_x11_dep.found()
gst_plugin_gl_deps += gtk_x11_dep gst_plugin_gl_base_deps += gtk_x11_dep
if gst_gl_have_platform_glx if gst_gl_have_platform_glx
gst_plugin_gl_deps += gstglx11_dep gst_plugin_gl_base_deps += gstglx11_dep
endif endif
have_gtk_gl_windowing = true have_gtk_gl_windowing = true
endif endif
@@ -26,44 +41,40 @@ endif
if gst_gl_have_window_wayland and gst_gl_have_platform_egl if gst_gl_have_window_wayland and gst_gl_have_platform_egl
gtk_wayland_dep = dependency('gtk4-wayland', required: false) gtk_wayland_dep = dependency('gtk4-wayland', required: false)
if gtk_wayland_dep.found() if gtk_wayland_dep.found()
gst_plugin_gl_deps += [gtk_wayland_dep, gstglwayland_dep] gst_plugin_gl_base_deps += [gtk_wayland_dep, gstglwayland_dep]
have_gtk_gl_windowing = true have_gtk_gl_windowing = true
endif endif
endif endif
if plugin_gl_support_required and not have_gtk_gl_windowing if gl_support_required and not have_gtk_gl_windowing
error('GL-based importer was enabled, but support for current GL windowing is missing') error('GL-based importer was enabled, but support for current GL windowing is missing')
endif endif
if gst_gl_have_platform_egl if gst_gl_have_platform_egl
gst_plugin_gl_deps += gstglegl_dep gst_plugin_gl_base_deps += gstglegl_dep
endif endif
gst_clapper_gl_base_importer_deps = [ foreach dep : gst_plugin_gl_base_deps
gst_clapper_sink_dep
] + gst_plugin_gl_deps
foreach dep : gst_clapper_gl_base_importer_deps
if not dep.found() if not dep.found()
if plugin_gl_support_required if gl_support_required
error('GL-based importer was enabled, but required dependencies were not found') error('GL-based importer was enabled, but required dependencies were not found')
endif endif
plugin_needs_gl_base = false build_glbase = false
endif endif
endforeach endforeach
if plugin_needs_gl_base if build_glbase
gst_clapper_gl_base_importer_dep = declare_dependency( gst_clapper_gl_base_importer_dep = declare_dependency(
link_with: library('gstclapperglbaseimporter', link_with: library('gstclapperglbaseimporter',
'gstclapperglbaseimporter.c', 'gstclapperglbaseimporter.c',
c_args: gst_clapper_plugin_args, c_args: gst_clapper_plugin_args,
include_directories: configinc, include_directories: configinc,
dependencies: gst_clapper_gl_base_importer_deps, dependencies: gst_plugin_gl_base_deps,
version: libversion, version: libversion,
install: true, install: true,
), ),
include_directories: configinc, include_directories: configinc,
dependencies: gst_clapper_gl_base_importer_deps, dependencies: gst_plugin_gl_base_deps,
) )
endif endif
@@ -105,6 +116,7 @@ endif
build_rawimporter = ( build_rawimporter = (
not get_option('rawimporter').disabled() not get_option('rawimporter').disabled()
and (not build_gluploader or get_option('rawimporter').enabled()) and (not build_gluploader or get_option('rawimporter').enabled())
and gst_clapper_sink_dep.found()
) )
if build_rawimporter if build_rawimporter

View File

@@ -4,6 +4,8 @@ gst_clapper_plugin_args = [
'-DHAVE_CONFIG_H', '-DHAVE_CONFIG_H',
'-DGST_USE_UNSTABLE_API', '-DGST_USE_UNSTABLE_API',
] ]
gst_clapper_sink_dep = dependency('', required: false)
gtk4_dep = dependency('gtk4', version: '>=4.6.0', required: false) gtk4_dep = dependency('gtk4', version: '>=4.6.0', required: false)
gmodule_dep = dependency('gmodule-2.0', gmodule_dep = dependency('gmodule-2.0',
@@ -20,12 +22,13 @@ gst_clapper_plugin_deps = [
gmodule_dep, gmodule_dep,
] ]
build_gst_plugin = not get_option('gst-plugin').disabled()
foreach dep : gst_clapper_plugin_deps foreach dep : gst_clapper_plugin_deps
if not dep.found() if not dep.found()
if get_option('gst-plugin').enabled() if get_option('gst-plugin').enabled()
error('GStreamer plugin was enabled, but required dependencies were not found') error('GStreamer plugin was enabled, but required dependencies were not found')
endif endif
subdir_done() build_gst_plugin = false
endif endif
endforeach endforeach
@@ -42,17 +45,19 @@ gst_clapper_plugin_sources = [
'gstclapperimporterloader.c', 'gstclapperimporterloader.c',
] ]
gst_clapper_sink_dep = declare_dependency( if build_gst_plugin
link_with: library('gstclapper', gst_clapper_sink_dep = declare_dependency(
gst_clapper_plugin_sources, link_with: library('gstclapper',
c_args: gst_clapper_plugin_args, gst_clapper_plugin_sources,
c_args: gst_clapper_plugin_args,
include_directories: configinc,
dependencies: gst_clapper_plugin_deps,
install: true,
install_dir: gst_plugins_libdir,
),
include_directories: configinc, include_directories: configinc,
dependencies: gst_clapper_plugin_deps, dependencies: gst_clapper_plugin_deps,
install: true, )
install_dir: gst_plugins_libdir, endif
),
include_directories: configinc,
dependencies: gst_clapper_plugin_deps,
)
subdir('importers') subdir('importers')

View File

@@ -14,11 +14,6 @@ option('gst-plugin',
description: 'Build GStreamer plugin (includes GTK video sink element)' description: 'Build GStreamer plugin (includes GTK video sink element)'
) )
option('rawimporter',
type: 'feature',
value: 'auto',
description: 'Build RAW system memory importer for clappersink'
)
option('glimporter', option('glimporter',
type: 'feature', type: 'feature',
value: 'auto', value: 'auto',
@@ -29,6 +24,11 @@ option('gluploader',
value: 'auto', value: 'auto',
description: 'Build GL uploader for clappersink' description: 'Build GL uploader for clappersink'
) )
option('rawimporter',
type: 'feature',
value: 'auto',
description: 'Build RAW system memory importer for clappersink'
)
option('devel-checks', option('devel-checks',
type: 'boolean', type: 'boolean',