1project('gst-plugins-good', 'c', 2 version : '1.20.3', 3 meson_version : '>= 0.59', 4 default_options : [ 'warning_level=1', 5 'buildtype=debugoptimized' ]) 6 7gst_version = meson.project_version() 8version_arr = gst_version.split('.') 9gst_version_major = version_arr[0].to_int() 10gst_version_minor = version_arr[1].to_int() 11gst_version_micro = version_arr[2].to_int() 12 if version_arr.length() == 4 13 gst_version_nano = version_arr[3].to_int() 14else 15 gst_version_nano = 0 16endif 17gst_version_is_stable = gst_version_minor.is_even() 18gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90 19 20have_cxx = add_languages('cpp', native: false, required: false) 21 22glib_req = '>= 2.56.0' 23orc_req = '>= 0.4.17' 24 25if gst_version_is_stable 26 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor) 27else 28 gst_req = '>= ' + gst_version 29endif 30 31api_version = '1.0' 32 33plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0') 34plugins = [] 35 36cc = meson.get_compiler('c') 37host_system = host_machine.system() 38 39if cc.get_id() == 'msvc' 40 msvc_args = [ 41 # Ignore several spurious warnings for things gstreamer does very commonly 42 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it 43 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once 44 # NOTE: Only add warnings here if you are sure they're spurious 45 '/wd4018', # implicit signed/unsigned conversion 46 '/wd4146', # unary minus on unsigned (beware INT_MIN) 47 '/wd4244', # lossy type conversion (e.g. double -> int) 48 '/wd4305', # truncating type conversion (e.g. double -> float) 49 cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8 50 51 # Enable some warnings on MSVC to match GCC/Clang behaviour 52 '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled 53 '/w14101', # 'identifier' : unreferenced local variable 54 '/w14189', # 'identifier' : local variable is initialized but not referenced 55 ] 56 if have_cxx 57 add_project_arguments(msvc_args, language: ['c', 'cpp']) 58 else 59 add_project_arguments(msvc_args, language: 'c') 60 endif 61 # Disable SAFESEH with MSVC for plugins and libs that use external deps that 62 # are built with MinGW 63 noseh_link_args = ['/SAFESEH:NO'] 64else 65 noseh_link_args = [] 66endif 67 68if cc.has_link_argument('-Wl,-Bsymbolic-functions') 69 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c') 70endif 71 72# Symbol visibility 73if cc.has_argument('-fvisibility=hidden') 74 add_project_arguments('-fvisibility=hidden', language: 'c') 75endif 76 77# Disable strict aliasing 78if cc.has_argument('-fno-strict-aliasing') 79 add_project_arguments('-fno-strict-aliasing', language: 'c') 80endif 81 82# Define G_DISABLE_DEPRECATED for development versions 83if gst_version_is_dev 84 message('Disabling deprecated GLib API') 85 add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c') 86endif 87 88cast_checks = get_option('gobject-cast-checks') 89if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev) 90 message('Disabling GLib cast checks') 91 add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c') 92endif 93 94glib_asserts = get_option('glib-asserts') 95if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev) 96 message('Disabling GLib asserts') 97 add_project_arguments('-DG_DISABLE_ASSERT', language: 'c') 98endif 99 100glib_checks = get_option('glib-checks') 101if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev) 102 message('Disabling GLib checks') 103 add_project_arguments('-DG_DISABLE_CHECKS', language: 'c') 104endif 105 106cdata = configuration_data() 107 108check_headers = [ 109 ['HAVE_DLFCN_H', 'dlfcn.h'], 110 ['HAVE_FCNTL_H', 'fcntl.h'], 111 ['HAVE_INTTYPES_H', 'inttypes.h'], 112 ['HAVE_MEMORY_H', 'memory.h'], 113 ['HAVE_PROCESS_H', 'process.h'], 114 ['HAVE_STDINT_H', 'stdint.h'], 115 ['HAVE_STDLIB_H', 'stdlib.h'], 116 ['HAVE_STRINGS_H', 'strings.h'], 117 ['HAVE_STRING_H', 'string.h'], 118 ['HAVE_SYS_IOCTL_H', 'sys/ioctl.h'], 119 ['HAVE_SYS_PARAM_H', 'sys/param.h'], 120 ['HAVE_SYS_SOCKET_H', 'sys/socket.h'], 121 ['HAVE_SYS_STAT_H', 'sys/stat.h'], 122 ['HAVE_SYS_TIME_H', 'sys/time.h'], 123 ['HAVE_SYS_TYPES_H', 'sys/types.h'], 124 ['HAVE_UNISTD_H', 'unistd.h'], 125] 126 127foreach h : check_headers 128 if cc.has_header(h.get(1)) 129 cdata.set(h.get(0), 1) 130 endif 131endforeach 132 133check_functions = [ 134 ['HAVE_ASINH', 'asinh', '#include<math.h>'], 135 ['HAVE_CLOCK_GETTIME', 'clock_gettime', '#include<time.h>'], 136 ['HAVE_COSH', 'cosh', '#include<math.h>'], 137# check token HAVE_CPU_ALPHA 138# check token HAVE_CPU_ARM 139# check token HAVE_CPU_CRIS 140# check token HAVE_CPU_CRISV32 141# check token HAVE_CPU_HPPA 142# check token HAVE_CPU_I386 143# check token HAVE_CPU_IA64 144# check token HAVE_CPU_M68K 145# check token HAVE_CPU_MIPS 146# check token HAVE_CPU_PPC 147# check token HAVE_CPU_PPC64 148# check token HAVE_CPU_S390 149# check token HAVE_CPU_SPARC 150# check token HAVE_CPU_X86_64 151 ['HAVE_DCGETTEXT', 'dcgettext', '#include<libintl.h>'], 152# check token HAVE_DIRECTSOUND 153# check token HAVE_EXPERIMENTAL 154# check token HAVE_EXTERNAL 155# check token HAVE_FPCLASS 156# check token HAVE_GCC_ASM 157 ['HAVE_GETPAGESIZE', 'getpagesize', '#include<unistd.h>'], 158# check token HAVE_GETTEXT 159# check token HAVE_GST_V4L2 160 ['HAVE_ISINF', 'isinf', '#include<math.h>'], 161# check token HAVE_LIBV4L2 162 ['HAVE_MMAP', 'mmap', '#include<sys/mman.h>'], 163 ['HAVE_MMAP64', 'mmap64', '#include<sys/mman.h>'], 164# check token HAVE_OSX_AUDIO 165# check token HAVE_OSX_VIDEO 166# check token HAVE_RDTSC 167 ['HAVE_SINH', 'sinh', '#include<math.h>'], 168# check token HAVE_WAVEFORM 169 ['HAVE_GMTIME_R', 'gmtime_r', '#include<time.h>'], 170] 171 172libm = cc.find_library('m', required : false) 173 174foreach f : check_functions 175 if cc.has_function(f.get(1), prefix : f.get(2), dependencies : libm) 176 cdata.set(f.get(0), 1) 177 endif 178endforeach 179 180cdata.set('HAVE_IOS', host_system == 'ios') 181 182cdata.set('SIZEOF_CHAR', cc.sizeof('char')) 183cdata.set('SIZEOF_INT', cc.sizeof('int')) 184cdata.set('SIZEOF_LONG', cc.sizeof('long')) 185cdata.set('SIZEOF_SHORT', cc.sizeof('short')) 186cdata.set('SIZEOF_VOIDP', cc.sizeof('void*')) 187cdata.set('SIZEOF_OFF_T', cc.sizeof('off_t')) 188 189have_rtld_noload = cc.has_header_symbol('dlfcn.h', 'RTLD_NOLOAD') 190cdata.set('HAVE_RTLD_NOLOAD', have_rtld_noload) 191 192# Here be fixmes. 193# FIXME: check if this is correct 194cdata.set('HAVE_CPU_X86_64', host_machine.cpu() == 'amd64') 195cdata.set('HAVE_GCC_ASM', cc.get_id() != 'msvc') 196cdata.set_quoted('VERSION', gst_version) 197cdata.set_quoted('PACKAGE_VERSION', gst_version) 198cdata.set_quoted('GST_LICENSE', 'LGPL') 199cdata.set_quoted('PACKAGE', 'gst-plugins-good') 200cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-good-1.0') 201cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) 202 203warning_flags = [ 204 '-Wmissing-declarations', 205 '-Wredundant-decls', 206 '-Wwrite-strings', 207 '-Winit-self', 208 '-Wmissing-include-dirs', 209 '-Wno-multichar', 210 '-Wvla', 211 '-Wpointer-arith', 212] 213 214warning_c_flags = [ 215 '-Wmissing-prototypes', 216 '-Wdeclaration-after-statement', 217 '-Wold-style-definition', 218 '-Waggregate-return', 219] 220 221if have_cxx 222 cxx = meson.get_compiler('cpp') 223endif 224 225foreach extra_arg : warning_flags 226 if cc.has_argument (extra_arg) 227 add_project_arguments([extra_arg], language: 'c') 228 endif 229 if have_cxx and cxx.has_argument (extra_arg) 230 add_project_arguments([extra_arg], language: 'cpp') 231 endif 232endforeach 233 234foreach extra_arg : warning_c_flags 235 if cc.has_argument (extra_arg) 236 add_project_arguments([extra_arg], language: 'c') 237 endif 238endforeach 239 240# GStreamer package name and origin url 241gst_package_name = get_option('package-name') 242if gst_package_name == '' 243 if gst_version_nano == 0 244 gst_package_name = 'GStreamer Good Plug-ins source release' 245 elif gst_version_nano == 1 246 gst_package_name = 'GStreamer Good Plug-ins git' 247 else 248 gst_package_name = 'GStreamer Good Plug-ins prerelease' 249 endif 250endif 251cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name) 252cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin')) 253 254# Mandatory GST deps 255gst_dep = dependency('gstreamer-1.0', version : gst_req, 256 fallback : ['gstreamer', 'gst_dep']) 257gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req, 258 fallback : ['gstreamer', 'gst_base_dep']) 259gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req, 260 fallback : ['gstreamer', 'gst_net_dep']) 261gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req, 262 fallback : ['gstreamer', 'gst_controller_dep']) 263gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req, 264 required : get_option('tests'), 265 fallback : ['gstreamer', 'gst_check_dep']) 266gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req, 267 fallback : ['gst-plugins-base', 'pbutils_dep']) 268gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req, 269 fallback : ['gst-plugins-base', 'allocators_dep']) 270gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req, 271 fallback : ['gst-plugins-base', 'app_dep']) 272gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req, 273 fallback : ['gst-plugins-base', 'audio_dep']) 274gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req, 275 fallback : ['gst-plugins-base', 'fft_dep']) 276gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req, 277 fallback : ['gst-plugins-base', 'riff_dep']) 278gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req, 279 fallback : ['gst-plugins-base', 'rtp_dep']) 280gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req, 281 fallback : ['gst-plugins-base', 'rtsp_dep']) 282gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req, 283 fallback : ['gst-plugins-base', 'sdp_dep']) 284gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req, 285 fallback : ['gst-plugins-base', 'tag_dep']) 286gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req, 287 fallback : ['gst-plugins-base', 'video_dep']) 288 289# GStreamer OpenGL 290# FIXME: automagic 291gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req, 292 fallback : ['gst-plugins-base', 'gstgl_dep'], required: false) 293gstglproto_dep = dependency('', required : false) 294gstglx11_dep = dependency('', required : false) 295gstglwayland_dep = dependency('', required : false) 296gstglegl_dep = dependency('', required : false) 297 298have_gstgl = gstgl_dep.found() 299 300if have_gstgl 301 if gstgl_dep.type_name() == 'pkgconfig' 302 gst_gl_apis = gstgl_dep.get_variable('gl_apis').split() 303 gst_gl_winsys = gstgl_dep.get_variable('gl_winsys').split() 304 gst_gl_platforms = gstgl_dep.get_variable('gl_platforms').split() 305 else 306 gstbase = subproject('gst-plugins-base') 307 gst_gl_apis = gstbase.get_variable('enabled_gl_apis') 308 gst_gl_winsys = gstbase.get_variable('enabled_gl_winsys') 309 gst_gl_platforms = gstbase.get_variable('enabled_gl_platforms') 310 endif 311 312 message('GStreamer OpenGL window systems: @0@'.format(' '.join(gst_gl_winsys))) 313 message('GStreamer OpenGL platforms: @0@'.format(' '.join(gst_gl_platforms))) 314 message('GStreamer OpenGL apis: @0@'.format(' '.join(gst_gl_apis))) 315 316 foreach ws : ['x11', 'wayland', 'android', 'cocoa', 'eagl', 'win32', 'dispmanx', 'viv_fb'] 317 set_variable('gst_gl_have_window_@0@'.format(ws), gst_gl_winsys.contains(ws)) 318 endforeach 319 320 foreach p : ['glx', 'egl', 'cgl', 'eagl', 'wgl'] 321 set_variable('gst_gl_have_platform_@0@'.format(p), gst_gl_platforms.contains(p)) 322 endforeach 323 324 foreach api : ['gl', 'gles2'] 325 set_variable('gst_gl_have_api_@0@'.format(api), gst_gl_apis.contains(api)) 326 endforeach 327 328 gstglproto_dep = dependency('gstreamer-gl-prototypes-1.0', version : gst_req, 329 fallback : ['gst-plugins-base', 'gstglproto_dep'], required: true) 330 # Behind specific checks because meson fails at optional dependencies with a 331 # fallback to the same subproject. On the first failure, meson will never 332 # check the system again even if the fallback never existed. 333 # Last checked with meson 0.54.3 334 if gst_gl_have_window_x11 335 gstglx11_dep = dependency('gstreamer-gl-x11-1.0', version : gst_req, 336 fallback : ['gst-plugins-base', 'gstglx11_dep'], required: true) 337 endif 338 if gst_gl_have_window_wayland 339 gstglwayland_dep = dependency('gstreamer-gl-wayland-1.0', version : gst_req, 340 fallback : ['gst-plugins-base', 'gstglwayland_dep'], required: true) 341 endif 342 if gst_gl_have_platform_egl 343 gstglegl_dep = dependency('gstreamer-gl-egl-1.0', version : gst_req, 344 fallback : ['gst-plugins-base', 'gstglegl_dep'], required: true) 345 endif 346endif 347 348zlib_dep = dependency('zlib') 349cdata.set('HAVE_ZLIB', true) 350 351glib_deps = [dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']), 352 dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])] 353gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep']) 354 355gst_plugins_good_args = ['-DHAVE_CONFIG_H'] 356configinc = include_directories('.') 357libsinc = include_directories('gst-libs') 358 359have_orcc = false 360orcc_args = [] 361orc_targets = [] 362# Used by various libraries/elements that use Orc code 363orc_dep = dependency('orc-0.4', version : orc_req, required : get_option('orc'), 364 fallback : ['orc', 'orc_dep']) 365orcc = find_program('orcc', required : get_option('orc')) 366if orc_dep.found() and orcc.found() 367 have_orcc = true 368 orcc_args = [orcc, '--include', 'glib.h'] 369 cdata.set('HAVE_ORC', 1) 370else 371 message('Orc Compiler not found, will use backup C code') 372 cdata.set('DISABLE_ORC', 1) 373endif 374 375have_nasm = false 376# FIXME: nasm path needs testing on non-Linux, esp. Windows 377host_cpu = host_machine.cpu_family() 378if host_cpu == 'x86_64' 379 if cc.get_define('__ILP32__') == '1' 380 message('Nasm disabled on x32') 381 else 382 asm_option = get_option('asm') 383 nasm = find_program('nasm', native: true, required: asm_option) 384 if nasm.found() 385 # We can't use the version: kwarg for find_program because old versions 386 # of nasm don't support --version 387 ret = run_command(nasm, '-v', check: false) 388 if ret.returncode() == 0 389 nasm_version = ret.stdout().strip().split()[2] 390 nasm_req = '>=2.13' 391 if nasm_version.version_compare(nasm_req) 392 message('nasm found on x86-64') 393 cdata.set('HAVE_NASM', 1) 394 have_nasm = true 395 else 396 if asm_option.enabled() 397 error('asm option is enabled, and nasm @0@ was found, but @1@ is required'.format(nasm_version, nasm_req)) 398 endif 399 message('nasm @0@ was found, but @1@ is required'.format(nasm_version, nasm_req)) 400 endif 401 else 402 if asm_option.enabled() 403 error('asm option is enabled, but nasm is not usable: @0@\n@1@'.format(ret.stdout(), ret.stderr())) 404 endif 405 message('nasm was found, but it\'s not usable') 406 endif 407 # Unset nasm to not be 'found' 408 if not have_nasm 409 nasm = disabler() 410 endif 411 endif 412 endif 413endif 414 415# Disable compiler warnings for unused variables and args if gst debug system is disabled 416if gst_dep.type_name() == 'internal' 417 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug') 418else 419 # We can't check that in the case of subprojects as we won't 420 # be able to build against an internal dependency (which is not built yet) 421 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep) 422endif 423 424if gst_debug_disabled 425 message('GStreamer debug system is disabled') 426 if cc.has_argument('-Wno-unused') 427 add_project_arguments('-Wno-unused', language: 'c') 428 endif 429 if have_cxx and cxx.has_argument ('-Wno-unused') 430 add_project_arguments('-Wno-unused', language: 'cpp') 431 endif 432else 433 message('GStreamer debug system is enabled') 434endif 435 436presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets') 437 438python3 = import('python').find_installation() 439pkgconfig = import('pkgconfig') 440plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig') 441if get_option('default_library') == 'shared' 442 # If we don't build static plugins there is no need to generate pc files 443 plugins_pkgconfig_install_dir = disabler() 444endif 445 446subdir('gst') 447subdir('sys') 448subdir('ext') 449subdir('tests') 450subdir('docs') 451 452if have_orcc and orc_targets.length() > 0 453 update_orc_dist_files = find_program('scripts/update-orc-dist-files.py') 454 455 orc_update_targets = [] 456 foreach t : orc_targets 457 orc_name = t.get('name') 458 orc_file = t.get('orc-source') 459 header = t.get('header') 460 source = t.get('source') 461 # alias_target() only works with build targets, so can't use run_target() here 462 orc_update_targets += [ 463 custom_target('update-orc-@0@'.format(orc_name), 464 input: [header, source], 465 command: [update_orc_dist_files, orc_file, header, source], 466 output: ['@0@-dist.c'.format(orc_name)]) # not entirely true 467 ] 468 endforeach 469 470 if orc_update_targets.length() > 0 471 update_orc_dist_target = alias_target('update-orc-dist', orc_update_targets) 472 endif 473endif 474 475# xgettext is optional (on Windows for instance) 476if find_program('xgettext', required : get_option('nls')).found() 477 cdata.set('ENABLE_NLS', 1) 478 subdir('po') 479endif 480 481subdir('scripts') 482 483# Set release date 484if gst_version_nano == 0 485 extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py') 486 run_result = run_command(extract_release_date, gst_version, files('gst-plugins-good.doap'), check: true) 487 release_date = run_result.stdout().strip() 488 cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date) 489 message('Package release date: ' + release_date) 490endif 491 492if gio_dep.version().version_compare('< 2.67.4') 493 cdata.set('g_memdup2(ptr,sz)', '(G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL)') 494endif 495 496configure_file(output : 'config.h', configuration : cdata) 497 498plugin_names = [] 499foreach plugin: plugins 500 if plugin.name().startswith('gst') 501 plugin_names += [plugin.name().substring(3)] 502 else 503 plugin_names += [plugin.name()] 504 endif 505endforeach 506 507summary({ 508 'Plugins': plugin_names, 509}, list_sep: ', ') 510