-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathmeson.build
More file actions
834 lines (756 loc) · 24.2 KB
/
meson.build
File metadata and controls
834 lines (756 loc) · 24.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
project('gst-plugins-rs',
'rust',
'c',
version: '0.16.0-alpha',
meson_version : '>= 1.1')
# dependencies.py needs a toml parsing module
api_version = '1.0'
python = import('python').find_installation(modules: ['tomllib'], required: false)
if not python.found()
python = import('python').find_installation(modules: ['tomli'])
endif
fs = import('fs')
host_system = host_machine.system()
if get_option('debug')
target = 'debug'
else
target = 'release'
endif
cargo = find_program('cargo', version:'>=1.40')
cargo_wrapper = find_program('cargo_wrapper.py')
cargo_c = find_program('cargo-cbuild', version:'>=0.9.21', required: false)
rustc = meson.get_compiler('rust')
if not cargo_c.found()
error('cargo-c missing, install it with: \'cargo install cargo-c\'')
endif
system = host_machine.system()
exe_suffix = ''
if system == 'windows'
exe_suffix = '.exe'
ext_dynamic = 'dll'
ext_static = 'lib'
elif system == 'darwin'
ext_dynamic = 'dylib'
ext_static = 'a'
else
ext_dynamic = 'so'
ext_static = 'a'
endif
# Extra env to pass to cargo
extra_env = {}
# Used to not lookup the same dependency multiple times which clutters logs
deps_cache = {}
# Need to depends on all gstreamer-rs deps to ensure they are built
# before gstreamer-rs when building with gst-build.
# Custom targets can't depend on dependency() objects so we have to depend
# on the library variable from the subproject instead.
glib_req = '>=2.62'
gst_req = '>=1.20.0'
depends = []
# kept in the same order as the `members` list in Cargo.toml
plugins = {
'analytics': {
'library': 'libgstrsanalytics',
'features': ['gst-rtp/v1_24', 'gst-base/v1_24', 'gst-video/v1_24'],
},
'audiofx': {
'library': 'libgstrsaudiofx',
'examples': ['hrtfrender'],
},
'audioparsers': {
'library': 'libgstrsaudioparsers',
},
'burn': {'library': 'libgstburn'},
'claxon': {'library': 'libgstclaxon'},
# csound has a non-trivial external dependency, see below
'csound': {},
'demucs': {'library': 'libgstdemucs'},
'lewton': {'library': 'libgstlewton'},
'spotify': {'library': 'libgstspotify'},
'file': {'library': 'libgstrsfile'},
'compress': {'library': 'libgstcompress'},
'originalbuffer': {'library': 'libgstoriginalbuffer'},
# sodium can have an external dependency, see below
'sodium': {},
'threadshare': {
'library': 'libgstthreadshare',
'examples': [
'ts-benchmark',
'udpsrc-benchmark-sender',
'tcpclientsrc-benchmark-sender',
'ts-standalone',
],
},
'inter': {'library': 'libgstrsinter'},
'streamgrouper': {'library': 'libgststreamgrouper'},
'isobmff': {
'library': 'libgstisobmff',
'examples': [
'dash_vod',
'hls_live',
'hls_vod',
],
},
'aws': {
'library': 'libgstaws',
'extra-deps': {'openssl': ['>=1.1']},
},
'deepgram': {'library': 'libgstdeepgram'},
'mpegtslive': {'library': 'libgstmpegtslive'},
'dashsink2': {'library': 'libgstdashsink2'},
'hlsmultivariantsink': {'library': 'libgsthlsmultivariantsink'},
'hlssink3': {'library': 'libgsthlssink3'},
'icecast': {'library': 'libgsticecast'},
'ndi': {'library': 'libgstndi'},
'onvif': {
'library': 'libgstrsonvif',
'extra-deps': {'pangocairo': []},
},
'raptorq': {'library': 'libgstraptorq'},
'reqwest': {'library': 'libgstreqwest'},
'rtsp': {'library': 'libgstrsrtsp'},
'rtp': {'library': 'libgstrsrtp'},
'udp': {'library': 'libgstrsudp'},
'webrtchttp': {'library': 'libgstwebrtchttp'},
'webrtc': {
'library': 'libgstrswebrtc',
'examples': ['webrtcsink-stats-server'],
'option-features': ['aws', 'livekit']
},
'textaccumulate': {'library': 'libgsttextaccumulate'},
'textahead': {'library': 'libgsttextahead'},
'json': {'library': 'libgstjson'},
'regex': {'library': 'libgstregex'},
'textwrap': {'library': 'libgsttextwrap'},
'fallbackswitch': { }, # fallbackswitch can have gtk4 examples, see below
'livesync': { }, # livesync can have gtk4 examples, see below
'debugseimetainserter': {
'library': 'libgstdebugseimetainserter',
'features': ['gst-video/v1_22'],
},
'togglerecord': { }, # togglerecord can have gtk4 examples, see below
'tracers': {'library': 'libgstrstracers'},
'uriplaylistbin': {
'library': 'libgsturiplaylistbin',
'examples': ['playlist'],
'features': ['clap'],
'gst-version': '>=1.23.90',
},
'cdg': {'library': 'libgstcdg'},
'closedcaption': {
'library': 'libgstrsclosedcaption',
'extra-deps': {
'pango': [],
'pangocairo': [],
'cairo-gobject': [],
}
},
'dav1d': {
'library': 'libgstdav1d',
'extra-deps': {'dav1d': ['>=1.3']},
'features': ['gst/v1_18', 'gst-base/v1_18', 'gst-video/v1_18'],
},
'elevenlabs': {'library': 'libgstelevenlabs'},
'ffv1': {'library': 'libgstffv1'},
'flavors': {'library': 'libgstrsflv'},
'gif': {
'library': 'libgstgif',
'examples': ['testvideosrc2gif'],
},
# gtk4 is re added below
'gtk4': {},
'hsv': {'library': 'libgsthsv'},
'png': {
'library': 'libgstrspng',
'examples': ['pngenc'],
},
'rav1e': {'library': 'libgstrav1e'},
'videofx': {
'library': 'libgstrsvideofx',
'extra-deps': {'cairo-gobject': []},
},
'viuer': {
'library': 'libgstviuer',
},
'gopbuffer': {'library': 'libgstgopbuffer'},
'quinn': {
'library': 'libgstquinn',
'examples': [
'quic_mux',
'quic_roq',
],
},
'skia': {}, # skia can have external dependencies, see below
'validate': {}, # Only used to handle the validate feature option
'speechmatics': {'library': 'libgstspeechmatics'},
'vvdec': {
'library': 'libgstvvdec',
'extra-deps': {'libvvdec': ['>= 3.0']}
},
'webp': {}, # webp has external dependencies, see below
'whisper': {'library': 'libgstwhisper'},
}
# Convert auto options to use auto_plugin_features for plugin-related options
# so that we can change the auto behavior in one place
auto_plugin_features = get_option('auto_plugin_features')
foreach option_name: plugins.keys()
opt = get_option(option_name)
if opt.auto()
opt = auto_plugin_features
endif
set_variable(f'@option_name@_option', opt)
endforeach
rtp_option = rtp_option.enable_if(webrtc_option.enabled(), error_message: 'webrtc option needs rtp')
rtp_option = rtp_option.enable_if(rtsp_option.enabled(), error_message: 'rtsp option needs rtp')
deps = [
# name, subproject name, subproject dep, library object
['gstreamer-1.0', 'gstreamer', 'gst_dep', 'libgst'],
['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-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'],
]
if threadshare_option.allowed() \
or onvif_option.allowed() \
or raptorq_option.allowed() \
or rtp_option.allowed() \
or webrtc_option.allowed()
req = threadshare_option.enabled() or onvif_option.enabled() \
or raptorq_option.enabled() or rtp_option.enabled() or webrtc_option.enabled()
deps += [['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp', req]]
endif
if webrtc_option.allowed() \
or webrtchttp_option.allowed()
req = webrtc_option.enabled() or webrtchttp_option.enabled()
deps += [['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc', req]]
deps += [['gstreamer-sdp-1.0', 'gst-plugins-base', 'sdp_dep', 'gstsdp', req]]
endif
if get_option('tests').allowed()
deps += [['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check', get_option('tests')]]
endif
if gtk4_option.allowed()
deps += [['gstreamer-gl-1.0', 'gst-plugins-base', 'gstgl_dep', 'gstgl', gtk4_option]]
endif
if threadshare_option.allowed() or rtsp_option.allowed()
req = threadshare_option.enabled() or rtsp_option.enabled()
deps += [['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net', req]]
endif
if analytics_option.allowed()
deps += [['gstreamer-analytics-1.0', 'gst-plugins-bad', 'gstanalytics_dep', 'gstanalytics', analytics_option]]
endif
glib_dep = dependency('glib-2.0', version: glib_req)
deps_cache += {'glib-2.0': glib_dep}
foreach d: deps
dep = dependency(d[0], version: gst_req,
fallback : [d[1], d[2]], required: d.get(4, true))
set_variable(d[2], dep)
deps_cache += {d[0]: dep}
if dep.type_name() == 'internal'
lib = subproject(d[1]).get_variable(d[3])
depends += lib
endif
endforeach
# The splitter/combiner requires 1.28+
if analytics_option.allowed()
gst_analytics_dep = deps_cache['gstreamer-analytics-1.0']
if gst_analytics_dep.found() and gst_analytics_dep.version().version_compare('>= 1.28')
plugins_analytics = plugins['analytics']
plugins_analytics += {
'features': plugins_analytics['features'] + ['v1_28'],
}
plugins += {
'analytics': plugins_analytics
}
endif
endif
# Won't build on platforms where it bundles the sources because of:
# https://github.com/qnighy/libwebp-sys2-rs/issues/12
# the fix is:
# https://github.com/qnighy/libwebp-sys2-rs/pull/13
if host_system not in ['windows', 'darwin']
# FIXME: libwebp-sys2 will build its bundled version on msvc and apple platforms
# https://github.com/qnighy/libwebp-sys2-rs/issues/4
plugins += {'webp': {
'library': 'libgstrswebp',
'extra-deps': {'libwebpdemux': []},
}}
endif
if sodium_option.allowed()
sodium_plugin = {'sodium': {
'library': 'libgstsodium',
'examples': ['generate-keys', 'encrypt-example', 'decrypt-example'],
'features': ['serde', 'serde_json', 'clap'],
}}
if get_option('sodium-source') == 'system'
sodium_dep = dependency('libsodium', required: sodium_option.enabled())
extra_env += {'SODIUM_USE_PKG_CONFIG': '1'}
if sodium_dep.found()
plugins += sodium_plugin
endif
else
plugins += sodium_plugin
endif
endif
cc = meson.get_compiler('c')
if csound_option.allowed()
# if csound isn't distributed with pkg-config then user needs to define CSOUND_LIB_DIR with its location
res = run_command(python, '-c', 'import os; print(os.environ["CSOUND_LIB_DIR"])', check: false)
if res.returncode() == 0
csound_libdir = res.stdout().strip()
csound_dep = cc.find_library('csound64', dirs: csound_libdir, required: false)
if csound_dep.found()
plugins += {'csound': {
'library': 'libgstcsound',
'examples': ['csound-effect'],
}}
extra_env += {'CSOUND_LIB_DIR': csound_libdir}
elif csound_option.enabled()
error('csound option is enabled, but csound64 library could not be found and CSOUND_LIB_DIR was not set')
endif
endif
endif
if gtk4_option.allowed()
gtk4_features = []
gl_winsys = gstgl_dep.get_variable('gl_winsys').split()
gl_platforms = gstgl_dep.get_variable('gl_platforms').split()
if 'wayland' in gl_winsys
gtk4_features += 'waylandegl'
endif
if 'x11' in gl_winsys
if 'egl' in gl_platforms
gtk4_features += 'x11egl'
endif
if 'glx' in gl_platforms
gtk4_features += 'x11glx'
endif
elif host_system == 'windows'
if 'egl' in gl_platforms
gtk4_features += 'winegl'
endif
endif
gst_allocators_dep = dependency('gstreamer-allocators-1.0', version: '>=1.24', required: false)
gtk_dep = dependency('gtk4', version: '>=4.6', required: gtk4_option)
if gtk_dep.found()
if host_system == 'linux' and gtk_dep.version().version_compare('>=4.14') and \
gst_allocators_dep.found() and 'waylandegl' in gtk4_features
gtk4_features += 'dmabuf'
endif
plugins += {
'gtk4': {
'library': 'libgstgtk4',
'examples': ['gtksink'],
'extra-deps': {'gtk4': ['>=4.6']},
'features': gtk4_features,
},
}
endif
endif
examples_opt = get_option('examples')
if examples_opt.allowed() and gtk4_option.allowed() and gtk_dep.found()
plugins += {
'fallbackswitch': {
'library': 'libgstfallbackswitch',
'examples_features': {
'gtk-fallbackswitch': ['gtk', 'gio', 'gst-plugin-gtk4'],
},
},
'livesync': {
'library': 'libgstlivesync',
'examples_features': {
'gtk-livesync': ['gtk', 'gio', 'gst-plugin-gtk4'],
}
},
'togglerecord': {
'library': 'libgsttogglerecord',
'examples_features': {
'gtk-recording': ['gtk', 'gio', 'gst-plugin-gtk4'],
}
},
}
else
plugins += {
'fallbackswitch': { 'library': 'libgstfallbackswitch'},
'livesync': { 'library': 'libgstlivesync'},
'togglerecord': { 'library': 'libgsttogglerecord'},
}
endif
if skia_option.allowed()
# Add harfbuzz and freetype dependencies for skia plugin on Linux
if host_system == 'linux'
skia_extra_deps = {'harfbuzz': [], 'freetype2': [], 'fontconfig': []}
else
skia_extra_deps = {}
endif
plugins += {
'skia': {
'library': 'libgstskia',
'extra-deps': skia_extra_deps,
},
}
endif
# Process plugins list
default_library = get_option('default_library')
library_suffixes = []
if default_library in ['shared', 'both']
library_suffixes += [ext_dynamic]
endif
if default_library in ['static', 'both']
library_suffixes += [ext_static]
endif
# cargo packages (plugins) to build
packages = []
# cargo features
features = []
# examples to build
examples = []
# Add the plugin library and .pc files as output
output = []
# List of directories to install output files into ([plugin_install_dir,
# pkgconfig_install_dir, ...])
install_dirs = []
# List of features from meson dependencies
found_features = {}
# List of dependencies for each plugin from Cargo.toml
feature_deps = {}
# List of dependencies that are actually enabled
required_feature_deps = []
glib_versions = ['2.74','2.72','2.70','2.68','2.66','2.64','2.62','2.60','2.58']
foreach glib_version : glib_versions
if glib_dep.version().version_compare(f'>=@glib_version@')
found_features += {'glib': 'glib/v' + glib_version.underscorify()}
found_features += {'gio': 'gio/v' + glib_version.underscorify()}
break
endif
endforeach
if gtk4_option.allowed() and gtk_dep.found()
gtk4_versions = ['4.20','4.18','4.16','4.14','4.12','4.10']
foreach gtk4_version : gtk4_versions
if gtk_dep.version().version_compare(f'>=@gtk4_version@')
found_features += {'gtk': 'gtk_v' + gtk4_version.underscorify()}
break
endif
endforeach
endif
p = run_command('dependencies.py', meson.current_source_dir(), '--feature-deps', capture: true, check: true)
foreach line : p.stdout().split('\n')
if ':' in line
tmp = line.split(':')
library_name = 'lib' + tmp[0].strip()
feature_deps += {library_name: tmp[1].strip().split(',')}
endif
endforeach
if rav1e_option.allowed()
nasm = find_program('nasm', required: false)
if nasm.found()
features += 'gst-plugin-rav1e/asm'
extra_env += {'NASM': nasm.full_path()}
endif
endif
if tracers_option.allowed()
protoc = find_program('protoc', required: false)
if protoc.found()
features += 'gst-plugin-tracers/perfetto'
extra_env += {'PROTOC': protoc.full_path()}
endif
endif
if get_option('default_library') == 'static'
extra_env += {
# Tell the pkg-config crate to think of all libraries as static
'PKG_CONFIG_ALL_STATIC': '1',
# Tell the system-deps crate to process linker flag for static deps
'SYSTEM_DEPS_LINK': 'static'
}
endif
plugins_install_dir = get_option('libdir') / 'gstreamer-1.0'
pkgconfig_install_dir = plugins_install_dir / 'pkgconfig'
disable_pc_generation = get_option('default_library') == 'shared'
foreach plugin_name, details: plugins
if details == {}
# Some plugins (e.g., csound, sodium, gtk4, fallbackswitch, livesync, togglerecord)
# are initially defined with empty {} and only get their full details added later
# if their external dependencies (like gtk4, csound library, etc.) are found.
# Skip plugins that haven't been filled in yet.
continue
endif
plugin_opt = get_variable(f'@plugin_name@_option')
if not plugin_opt.allowed()
debug(f'@plugin_name@ is disabled')
continue
endif
plugin_deps_found = true
# Check whether we have all needed deps
foreach dep_name, dep_ver: details.get('extra-deps', {})
if dep_ver.length() != 0
dep = dependency(dep_name, version: dep_ver, required: plugin_opt)
else
dep = dependency(dep_name, required: plugin_opt)
endif
deps_cache += {dep_name: dep}
if not dep.found()
if dep_ver.length() != 0
dep_ver_msg = ' '.join(dep_ver)
debug(f'@plugin_name@ dependency @dep_name@ @dep_ver_msg@ not found, skipping')
else
debug(f'@plugin_name@ dependency @dep_name@ not found, skipping')
endif
plugin_deps_found = false
break
endif
endforeach
if not plugin_deps_found
continue
endif
# Build list of required features
library_name = details.get('library', [])
if feature_deps.has_key(library_name)
foreach d : feature_deps.get(library_name)
if d not in required_feature_deps
required_feature_deps += d
endif
endforeach
endif
# Validate gst-plugin features
plugin_features = details.get('features', [])
foreach feature: plugin_features
if feature.startswith('gst-plugin') and not packages.contains(feature)
msg = f'@plugin_name@ required feature @feature@ not found'
if plugin_opt.enabled()
error(msg)
endif
message(msg + ', skipping')
plugin_deps_found = false
break
endif
endforeach
if not plugin_deps_found
continue
endif
option_features = []
foreach feature : details.get('option-features', [])
if get_option(f'@plugin_name@-@feature@').allowed()
message(f'Enabling @feature@ for @plugin_name@')
features += [feature]
endif
endforeach
# Check if we have the required GStreamer version
if details.has_key('gst-version') and not \
deps_cache['gstreamer-1.0'].version().version_compare(details['gst-version'])
msg = '@0@ requires gstreamer version @1@'.format(plugin_name, details['gst-version'])
if plugin_opt.enabled()
error(msg)
endif
message(msg + ', skipping')
continue
endif
# Parse and enable examples
plugin_examples = details.get('examples', [])
foreach example: plugin_examples
examples += example
endforeach
plugin_examples_features = details.get('examples_features', {})
foreach example, examples_features: plugin_examples_features
example_deps_found = true
foreach feature: examples_features
if feature.startswith('gst-plugin') and not packages.contains(feature)
msg = f'@plugin_name@ example @example@ required feature @feature@ not found'
if plugin_opt.enabled() and examples_opt.enabled()
error(msg)
endif
message(msg + ', skipping')
example_deps_found = false
break
endif
endforeach
if example_deps_found
features += examples_features
examples += example
endif
endforeach
packages += f'gst-plugin-@plugin_name@'
features += plugin_features
extra_features = run_command('dependencies.py', meson.current_source_dir(), plugin_name,
'--features', '--gst-version', gst_dep.version(), capture: true, check: true).stdout().strip()
if extra_features != ''
features += extra_features.split(',')
endif
lib = details.get('library')
libname = lib.substring(3)
# No 'lib' suffix with MSVC
if cc.get_argument_syntax() == 'msvc'
lib = libname
endif
if default_library in ['shared', 'both']
output += [lib + '.' + ext_dynamic]
install_dirs += [plugins_install_dir]
endif
if default_library in ['static', 'both']
output += [lib + '.' + ext_static]
install_dirs += [plugins_install_dir]
endif
if not disable_pc_generation
output += [libname + '.pc']
install_dirs += [pkgconfig_install_dir]
endif
endforeach
# Add required features
foreach feat : required_feature_deps
if found_features.has_key(feat)
features += found_features[feat]
endif
endforeach
feature_args = []
if features.length() > 0
feature_args += ['--features', features]
endif
extra_args = []
if get_option('doc').disabled()
extra_args += ['--disable-doc']
endif
# 'pkgconfig' is the entry in the machine file, if specified
pkg_config = find_program('pkgconfig', 'pkg-config')
if pkg_config.found()
extra_env += {'PKG_CONFIG': pkg_config.full_path()}
endif
pathsep = ':'
if host_system == 'windows'
pathsep = ';'
endif
pkg_config_path = get_option('pkg_config_path')
if pkg_config_path.length() > 0
extra_env += {'PKG_CONFIG_PATH': pathsep.join(pkg_config_path)}
endif
# get cmdline for rust
extra_env += {'RUSTC': ' '.join(rustc.cmd_array())}
# Build plugins in the plugins subdirectory
subdir('plugins')
# Build validate plugins in separate directory
subdir('validate-plugins')
# This is used by GStreamer to static link Rust plugins into gst-full
gst_plugins = []
plugin_names = []
foreach plugin : plugins
plugin_name = fs.stem(plugin.full_path())
# skip the 'lib' prefix from plugin path when not building with MSVC
if cc.get_argument_syntax() != 'msvc'
plugin_name = plugin_name.substring(3)
endif
plugin_display_name = plugin_name
if plugin_name.startswith('gst')
plugin_display_name = plugin_name.substring(3)
endif
if plugin_display_name in plugin_names
# When default_library=both plugins are duplicated.
continue
endif
plugin_names += plugin_display_name
option_name = plugin_name.substring(3)
if option_name.startswith('rs')
option_name = option_name.substring(2)
endif
if option_name == 'flv'
option_name = 'flavors'
endif
if not get_option(option_name).allowed()
continue
endif
# Extract plugin dependencies from their Cargo.toml file
plugin_deps = []
p = run_command('dependencies.py', meson.current_source_dir(), plugin_name,
capture: true,
check: true)
foreach dep_name : p.stdout().strip().split(',')
dep_name_version = dep_name.split('|')
dep_name = dep_name_version.get(0).strip()
if dep_name_version.length() > 1
extras = {'version': dep_name_version.get(1).strip()}
else
extras = {}
endif
if deps_cache.has_key(dep_name)
plugin_deps += deps_cache[dep_name]
else
dep = dependency(dep_name, required: false, kwargs: extras)
plugin_deps += dep
deps_cache += {dep_name: dep}
endif
endforeach
dep = declare_dependency(
link_with: plugin,
dependencies: plugin_deps,
variables: {'full_path': plugin.full_path()},
)
meson.override_dependency(plugin_name, dep)
if default_library == 'static' and plugin_name in ['gstcsound', 'gstthreadshare', 'gstgtk4']
warning('Static plugin @0@ is known to fail. It will not be included in libgstreamer-full.'.format(plugin_name))
else
gst_plugins += dep
endif
endforeach
subdir('docs')
if webrtc_option.allowed()
custom_target('gst-webrtc-signalling-server',
build_by_default: true,
output: 'gst-webrtc-signalling-server' + exe_suffix,
console: true,
install: true,
install_dir: get_option('bindir'),
depfile: 'gst-webrtc-signalling-server.dep',
env: extra_env,
command: [cargo_wrapper,
'build',
meson.current_build_dir(),
meson.current_source_dir(),
meson.global_build_root(),
target,
get_option('prefix'),
get_option('libdir'),
'--depfile', '@DEPFILE@',
'--bin', 'gst-webrtc-signalling-server',
'--exe-suffix', exe_suffix,
])
endif
if get_option('examples').allowed() and examples.length() > 0
outputs = []
foreach example: examples
outputs += [example + exe_suffix]
endforeach
custom_target('gst-plugins-rs-examples',
build_by_default: true,
output: outputs,
console: true,
install: false,
depfile: 'gst-plugins-rs-examples.dep',
env: extra_env,
command: [cargo_wrapper,
'build',
meson.current_build_dir(),
meson.current_source_dir(),
meson.global_build_root(),
target,
get_option('prefix'),
get_option('libdir'),
'--depfile', '@DEPFILE@',
'--packages', packages,
'--examples', examples,
'--exe-suffix', exe_suffix,
] + feature_args)
endif
if get_option('tests').allowed()
foreach package: packages
test(package.replace('gst-plugin-', ''),
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', package],
timeout: 600)
endforeach
endif
summary({
'Plugins': plugin_names,
}, list_sep: ', ')