1 project('gst-plugins-bad', 'c', 'cpp',
3 meson_version : '>= 0.47',
4 default_options : [ 'warning_level=1',
5 'buildtype=debugoptimized' ])
7 gst_version = meson.project_version()
8 version_arr = gst_version.split('.')
9 gst_version_major = version_arr[0].to_int()
10 gst_version_minor = version_arr[1].to_int()
11 gst_version_micro = version_arr[2].to_int()
12 if version_arr.length() == 4
13 gst_version_nano = version_arr[3].to_int()
18 glib_req = '>= 2.40.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
23 # maintaining compatibility with the previous libtool versioning
24 # current = minor * 100 + micro
25 libversion = '@0@.@1@.0'.format(soversion, gst_version_minor * 100 + gst_version_micro)
27 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
29 cc = meson.get_compiler('c')
30 cxx = meson.get_compiler('cpp')
32 if cc.get_id() == 'msvc'
33 # Ignore several spurious warnings for things gstreamer does very commonly
34 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
35 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
36 # NOTE: Only add warnings here if you are sure they're spurious
38 '/wd4018', # implicit signed/unsigned conversion
39 '/wd4146', # unary minus on unsigned (beware INT_MIN)
40 '/wd4244', # lossy type conversion (e.g. double -> int)
41 '/wd4305', # truncating type conversion (e.g. double -> float)
43 add_project_arguments(msvc_args, language : 'c')
44 add_project_arguments(msvc_args, language : 'cpp')
45 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
46 # are built with MinGW
47 noseh_link_args = ['/SAFESEH:NO']
49 if cxx.has_argument('-Wno-non-virtual-dtor')
50 add_project_arguments('-Wno-non-virtual-dtor', language: 'cpp')
56 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
57 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
61 if cc.has_argument('-fvisibility=hidden')
62 add_project_arguments('-fvisibility=hidden', language: 'c')
64 if cxx.has_argument('-fvisibility=hidden')
65 add_project_arguments('-fvisibility=hidden', language: 'cpp')
68 # Disable strict aliasing
69 if cc.has_argument('-fno-strict-aliasing')
70 add_project_arguments('-fno-strict-aliasing', language: 'c')
72 if cxx.has_argument('-fno-strict-aliasing')
73 add_project_arguments('-fno-strict-aliasing', language: 'cpp')
76 cdata = configuration_data()
78 ['HAVE_DLFCN_H', 'dlfcn.h'],
79 ['HAVE_FCNTL_H', 'fcntl.h'],
80 ['HAVE_INTTYPES_H', 'inttypes.h'],
81 ['HAVE_MEMORY_H', 'memory.h'],
82 ['HAVE_MSACM_H', 'msacm.h'],
83 ['HAVE_NETINET_IN_H', 'netinet/in.h'],
84 ['HAVE_NETINET_IP_H', 'netinet/ip.h'],
85 ['HAVE_NETINET_TCP_H', 'netinet/tcp.h'],
86 ['HAVE_PTHREAD_H', 'pthread.h'],
87 ['HAVE_STDINT_H', 'stdint.h'],
88 ['HAVE_STDLIB_H', 'stdlib.h'],
89 ['HAVE_STRINGS_H', 'strings.h'],
90 ['HAVE_STRING_H', 'string.h'],
91 ['HAVE_SYS_PARAM_H', 'sys/param.h'],
92 ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
93 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
94 ['HAVE_SYS_TIME_H', 'sys/time.h'],
95 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
96 ['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
97 ['HAVE_UNISTD_H', 'unistd.h'],
98 ['HAVE_WINDOWS_H', 'windows.h'],
99 ['HAVE_WINSOCK2_H', 'winsock2.h'],
100 ['HAVE_WS2TCPIP_H', 'ws2tcpip.h'],
103 foreach h : check_headers
104 if cc.has_header(h.get(1))
105 cdata.set(h.get(0), 1)
110 # check token HAVE_ACM
111 # check token HAVE_ANDROID_MEDIA
112 # check token HAVE_APEXSINK
113 # check token HAVE_APPLE_MEDIA
114 # check token HAVE_ASSRENDER
115 # check token HAVE_AVC
116 # check token HAVE_BLUEZ
117 # check token HAVE_BZ2
118 # check token HAVE_CFLOCALECOPYCURRENT
119 # check token HAVE_CFPREFERENCESCOPYAPPVALUE
120 # check token HAVE_CHROMAPRINT
121 # check token HAVE_CPU_ALPHA
122 # check token HAVE_CPU_ARM
123 # check token HAVE_CPU_CRIS
124 # check token HAVE_CPU_CRISV32
125 # check token HAVE_CPU_HPPA
126 # check token HAVE_CPU_I386
127 # check token HAVE_CPU_IA64
128 # check token HAVE_CPU_M68K
129 # check token HAVE_CPU_MIPS
130 # check token HAVE_CPU_PPC
131 # check token HAVE_CPU_PPC64
132 # check token HAVE_CPU_S390
133 # check token HAVE_CPU_SPARC
134 # check token HAVE_CPU_X86_64
135 # check token HAVE_CURL
136 # check token HAVE_DAALA
137 # check token HAVE_DASH
138 # check token HAVE_DC1394
139 ['HAVE_DCGETTEXT', 'dcgettext'],
140 # check token HAVE_DECKLINK
141 # check token HAVE_DIRECT3D
142 # check token HAVE_DIRECTDRAW
143 # check token HAVE_DIRECTFB
144 # check token HAVE_DIRECTSOUND
145 # check token HAVE_DOWHILE_MACROS
146 # check token HAVE_DTS
147 # check token HAVE_DVB
148 # check token HAVE_EXPERIMENTAL
149 # check token HAVE_EXTERNAL
150 # check token HAVE_FAAC
151 # check token HAVE_FAAD
152 # check token HAVE_FBDEV
153 # check token HAVE_FLITE
154 # check token HAVE_FLUIDSYNTH
155 ['HAVE_GETPAGESIZE', 'getpagesize'],
156 # check token HAVE_GETTEXT
157 # check token HAVE_GL
158 # check token HAVE_GLCHAR
159 # check token HAVE_GLEGLIMAGEOES
160 # check token HAVE_GLINTPTR
161 # check token HAVE_GLSIZEIPTR
162 # check token HAVE_GME
163 ['HAVE_GMTIME_R', 'gmtime_r'],
164 # check token HAVE_GRAPHENE
165 # check token HAVE_GSETTINGS
166 # check token HAVE_GSM
167 # check token HAVE_GUDEV
168 # check token HAVE_HLS
169 # check token HAVE_ICONV
170 # check token HAVE_JPEG
171 # check token HAVE_KATE
172 # check token HAVE_LADSPA
173 # check token HAVE_LIBGCRYPT
174 # check token HAVE_LIBGME_ACCURACY
175 # check token HAVE_LIBMMS
176 # check token HAVE_LIBNSL
177 # check token HAVE_LIBSOCKET
178 # check token HAVE_LIBUSB
179 # check token HAVE_LIBVISUAL
180 # check token HAVE_LINSYS
181 # check token HAVE_LRDF
182 # check token HAVE_LV2
183 # check token HAVE_MIMIC
184 ['HAVE_MMAP', 'mmap'],
185 # check token HAVE_MODPLUG
186 # check token HAVE_MPEG2ENC
187 # check token HAVE_MPG123
188 # check token HAVE_MPLEX
189 # check token HAVE_MUSEPACK
190 # check token HAVE_MYTHTV
191 # check token HAVE_NAS
192 # check token HAVE_NEON
193 # check token HAVE_NETTLE
194 # check token HAVE_OFA
195 # check token HAVE_OPENAL
196 # check token HAVE_OPENCV
197 # check token HAVE_OPENEXR
198 # check token HAVE_OPENJPEG
199 # check token HAVE_OPENJPEG_1
200 # check token HAVE_OPENNI2
201 # check token HAVE_OPENSLES
202 # check token HAVE_OPUS
203 # check token HAVE_ORC
204 # check token HAVE_OSX_VIDEO
205 ['HAVE_PIPE2', 'pipe2'],
206 # check token HAVE_PNG
207 # check token HAVE_PVR
208 # check token HAVE_QUICKTIME
209 # check token HAVE_RDTSC
210 # check token HAVE_RESINDVD
211 # check token HAVE_RSVG
212 # check token HAVE_RSVG_2_36_2
213 # check token HAVE_RTMP
214 # check token HAVE_SBC
215 # check token HAVE_SDL
216 # check token HAVE_SHM
217 # check token HAVE_SMOOTHSTREAMING
218 # check token HAVE_SNDFILE
219 # check token HAVE_SNDIO
220 # check token HAVE_SOUNDTOUCH
221 # check token HAVE_SOUNDTOUCH_1_4
222 # check token HAVE_SPANDSP
223 # check token HAVE_SPC
224 # check token HAVE_SRTP
225 # check token HAVE_SSH2
226 # check token HAVE_TELETEXTDEC
227 # check token HAVE_TIGER
228 # check token HAVE_TIMIDITY
229 # check token HAVE_UVCH264
230 # check token HAVE_VALGRIND
231 # check token HAVE_VCD
232 # check token HAVE_VDPAU
233 # check token HAVE_VIDEOTOOLBOX
234 # check token HAVE_VOAACENC
235 # check token HAVE_VOAMRWBENC
236 # check token HAVE_WASAPI
237 # check token HAVE_WAYLAND
238 # check token HAVE_WEBP
239 # check token HAVE_WILDMIDI
240 # check token HAVE_WIN32
241 # check token HAVE_WININET
242 # check token HAVE_WINKS
243 # check token HAVE_WINSCREENCAP
244 # check token HAVE_XVID
245 # check token HAVE_ZBAR
248 foreach f : check_functions
249 if cc.has_function(f.get(1))
250 cdata.set(f.get(0), 1)
254 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
255 cdata.set('SIZEOF_INT', cc.sizeof('int'))
256 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
257 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
258 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
260 cdata.set_quoted('VERSION', gst_version)
261 cdata.set_quoted('PACKAGE', 'gst-plugins-bad')
262 cdata.set_quoted('PACKAGE_VERSION', gst_version)
263 cdata.set_quoted('PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer')
264 cdata.set_quoted('PACKAGE_NAME', 'GStreamer Bad Plug-ins')
265 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-bad-1.0')
266 cdata.set_quoted('GST_API_VERSION', api_version)
267 cdata.set_quoted('GST_LICENSE', 'LGPL')
268 cdata.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
269 cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
272 '-Wmissing-declarations',
278 '-Wmissing-include-dirs',
286 '-Wmissing-prototypes',
287 '-Wdeclaration-after-statement',
288 '-Wold-style-definition',
292 warning_cxx_flags = [
293 '-Wformat-nonliteral',
296 foreach extra_arg : warning_c_flags
297 if cc.has_argument (extra_arg)
298 add_project_arguments([extra_arg], language: 'c')
302 foreach extra_arg : warning_cxx_flags
303 if cxx.has_argument (extra_arg)
304 add_project_arguments([extra_arg], language: 'cpp')
308 foreach extra_arg : warning_flags
309 if cc.has_argument (extra_arg)
310 add_project_arguments([extra_arg], language: 'c')
312 if cxx.has_argument (extra_arg)
313 add_project_arguments([extra_arg], language: 'cpp')
317 # GStreamer package name and origin url
318 gst_package_name = get_option('package-name')
319 if gst_package_name == ''
320 if gst_version_nano == 0
321 gst_package_name = 'GStreamer Bad Plug-ins source release'
322 elif gst_version_nano == 1
323 gst_package_name = 'GStreamer Bad Plug-ins git'
325 gst_package_name = 'GStreamer Bad Plug-ins prerelease'
328 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
329 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
331 # FIXME: This should be exposed as a configuration option
332 host_system = host_machine.system()
333 if host_system == 'linux'
334 cdata.set_quoted('DEFAULT_VIDEOSRC', 'v4l2src')
335 elif host_system == 'darwin'
336 cdata.set_quoted('DEFAULT_VIDEOSRC', 'avfvideosrc')
337 cdata.set_quoted('GST_EXTRA_MODULE_SUFFIX', '.dylib')
338 cdata.set('HAVE_OSX', 1)
340 cdata.set_quoted('DEFAULT_VIDEOSRC', 'videotestsrc')
344 gst_dep = dependency('gstreamer-1.0', version : gst_req,
345 fallback : ['gstreamer', 'gst_dep'])
346 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
347 fallback : ['gstreamer', 'gst_base_dep'])
348 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
349 fallback : ['gstreamer', 'gst_net_dep'])
350 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
351 fallback : ['gstreamer', 'gst_controller_dep'])
353 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
354 fallback : ['gst-plugins-base', 'pbutils_dep'])
355 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
356 fallback : ['gst-plugins-base', 'allocators_dep'])
357 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
358 fallback : ['gst-plugins-base', 'app_dep'])
359 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
360 fallback : ['gst-plugins-base', 'audio_dep'])
361 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
362 fallback : ['gst-plugins-base', 'fft_dep'])
363 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
364 fallback : ['gst-plugins-base', 'riff_dep'])
365 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
366 fallback : ['gst-plugins-base', 'rtp_dep'])
367 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
368 fallback : ['gst-plugins-base', 'rtsp_dep'])
369 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
370 fallback : ['gst-plugins-base', 'sdp_dep'])
371 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
372 fallback : ['gst-plugins-base', 'tag_dep'])
373 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
374 fallback : ['gst-plugins-base', 'video_dep'])
375 if host_machine.system() != 'windows'
376 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
377 required : get_option('tests'),
378 fallback : ['gstreamer', 'gst_check_dep'])
382 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
383 fallback : ['gst-plugins-base', 'gstgl_dep'], required: get_option('gl'))
386 if gstgl_dep.type_name() == 'pkgconfig'
387 gst_gl_apis = gstgl_dep.get_pkgconfig_variable('gl_apis').split()
388 gst_gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys').split()
389 gst_gl_platforms = gstgl_dep.get_pkgconfig_variable('gl_platforms').split()
391 gstbase = subproject('gst-plugins-base')
392 gst_gl_apis = gstbase.get_variable('enabled_gl_apis')
393 gst_gl_winsys = gstbase.get_variable('enabled_gl_winsys')
394 gst_gl_platforms = gstbase.get_variable('enabled_gl_platforms')
397 message('GStreamer OpenGL window systems: @0@'.format(' '.join(gst_gl_winsys)))
398 message('GStreamer OpenGL platforms: @0@'.format(' '.join(gst_gl_platforms)))
399 message('GStreamer OpenGL apis: @0@'.format(' '.join(gst_gl_apis)))
401 foreach ws : ['x11', 'wayland', 'android', 'cocoa', 'eagl', 'win32', 'dispmanx', 'viv_fb']
402 set_variable('gst_gl_have_window_@0@'.format(ws), gst_gl_winsys.contains(ws))
405 foreach p : ['glx', 'egl', 'cgl', 'eagl', 'wgl']
406 set_variable('gst_gl_have_platform_@0@'.format(p), gst_gl_platforms.contains(p))
409 foreach api : ['opengl', 'gles2']
410 set_variable('gst_gl_have_api_@0@'.format(api), gst_gl_apis.contains(api))
414 libm = cc.find_library('m', required : false)
415 glib_dep = dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep'])
416 gmodule_dep = dependency('gmodule-2.0', fallback: ['glib', 'libgmodule_dep'])
417 gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep'])
418 # gio-unix-2.0 is used by sys/bluez
420 # Optional dep of ext/gl and gst/librfb
421 x11_dep = dependency('x11', required : get_option('x11'))
423 cdata.set('HAVE_X11', 1)
426 if host_machine.system() == 'windows'
427 winsock2 = [cc.find_library('ws2_32')]
432 if host_machine.system() == 'darwin'
433 add_languages('objc')
434 mobilecoreservices_dep = dependency('MobileCoreServices', required : false)
435 if mobilecoreservices_dep.found()
436 cdata.set('HAVE_IOS', 1)
439 avfoundation_dep = dependency('AVFoundation', required : false)
440 if avfoundation_dep.found()
441 cdata.set('HAVE_AVFOUNDATION', 1)
444 videotoolbox_dep = dependency('VideoToolbox', required : false)
445 if videotoolbox_dep.found()
446 cdata.set('HAVE_VIDEOTOOLBOX', 1)
449 # FIXME: framework.version() returns 'unknown'
450 # if videotoolbox_dep.version().version_compare('>=10.9.6')
451 # cdata.set('HAVE_VIDEOTOOLBOX_10_9_6', 1)
457 # Used by various libraries/elements that use Orc code
458 orc_dep = dependency('orc-0.4', required : get_option('orc'))
459 orcc = find_program('orcc', required : get_option('orc'))
460 if orc_dep.found() and orcc.found()
462 orcc_args = [orcc, '--include', 'glib.h']
463 cdata.set('HAVE_ORC', 1)
465 message('Orc Compiler not found or disabled, will use backup C code')
466 cdata.set('DISABLE_ORC', 1)
469 if gst_dep.type_name() == 'internal'
470 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
472 # We can't check that in the case of subprojects as we won't
473 # be able to build against an internal dependency (which is not built yet)
474 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
477 if gst_debug_disabled and cc.has_argument('-Wno-unused')
478 add_project_arguments('-Wno-unused', language: 'c')
481 gst_plugins_bad_args = ['-DHAVE_CONFIG_H']
482 configinc = include_directories('.')
483 libsinc = include_directories('gst-libs')
485 python3 = import('python3').find_python()
487 gir = find_program('g-ir-scanner', required : get_option('introspection'))
488 gnome = import('gnome')
489 build_gir = gir.found() and not meson.is_cross_build()
490 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
491 'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
492 'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
493 'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
494 'gst_init(NULL,NULL);' ]
496 pkgconfig = import('pkgconfig')
497 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
498 if get_option('default_library') == 'shared'
499 # If we don't build static plugins there is no need to generate pc files
500 plugins_pkgconfig_install_dir = disabler()
510 # xgettext is optional (on Windows for instance)
511 if find_program('xgettext', required : get_option('nls')).found()
512 cdata.set('ENABLE_NLS', 1)
516 configure_file(output : 'config.h', configuration : cdata)
518 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')