1 project('gst-plugins-good', 'c',
3 meson_version : '>= 0.46.0',
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 have_cxx = add_languages('cpp', required : false)
20 glib_req = '>= 2.40.0'
21 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
25 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
27 cc = meson.get_compiler('c')
29 if cc.get_id() == 'msvc'
30 # Ignore several spurious warnings for things gstreamer does very commonly
31 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
32 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
33 # NOTE: Only add warnings here if you are sure they're spurious
34 add_project_arguments(
35 '/wd4018', # implicit signed/unsigned conversion
36 '/wd4146', # unary minus on unsigned (beware INT_MIN)
37 '/wd4244', # lossy type conversion (e.g. double -> int)
38 '/wd4305', # truncating type conversion (e.g. double -> float)
40 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
41 # are built with MinGW
42 noseh_link_args = ['/SAFESEH:NO']
47 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
48 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
52 if cc.has_argument('-fvisibility=hidden')
53 add_project_arguments('-fvisibility=hidden', language: 'c')
56 # Disable strict aliasing
57 if cc.has_argument('-fno-strict-aliasing')
58 add_project_arguments('-fno-strict-aliasing', language: 'c')
61 cdata = configuration_data()
64 ['HAVE_DLFCN_H', 'dlfcn.h'],
65 ['HAVE_FCNTL_H', 'fcntl.h'],
66 ['HAVE_INTTYPES_H', 'inttypes.h'],
67 ['HAVE_MEMORY_H', 'memory.h'],
68 ['HAVE_PROCESS_H', 'process.h'],
69 ['HAVE_STDINT_H', 'stdint.h'],
70 ['HAVE_STDLIB_H', 'stdlib.h'],
71 ['HAVE_STRINGS_H', 'strings.h'],
72 ['HAVE_STRING_H', 'string.h'],
73 ['HAVE_SYS_IOCTL_H', 'sys/ioctl.h'],
74 ['HAVE_SYS_PARAM_H', 'sys/param.h'],
75 ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
76 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
77 ['HAVE_SYS_TIME_H', 'sys/time.h'],
78 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
79 ['HAVE_UNISTD_H', 'unistd.h'],
82 foreach h : check_headers
83 if cc.has_header(h.get(1))
84 cdata.set(h.get(0), 1)
89 ['HAVE_ASINH', 'asinh', '#include<math.h>'],
90 ['HAVE_CLOCK_GETTIME', 'clock_gettime', '#include<time.h>'],
91 ['HAVE_COSH', 'cosh', '#include<math.h>'],
92 # check token HAVE_CPU_ALPHA
93 # check token HAVE_CPU_ARM
94 # check token HAVE_CPU_CRIS
95 # check token HAVE_CPU_CRISV32
96 # check token HAVE_CPU_HPPA
97 # check token HAVE_CPU_I386
98 # check token HAVE_CPU_IA64
99 # check token HAVE_CPU_M68K
100 # check token HAVE_CPU_MIPS
101 # check token HAVE_CPU_PPC
102 # check token HAVE_CPU_PPC64
103 # check token HAVE_CPU_S390
104 # check token HAVE_CPU_SPARC
105 # check token HAVE_CPU_X86_64
106 ['HAVE_DCGETTEXT', 'dcgettext', '#include<libintl.h>'],
107 # check token HAVE_DIRECTSOUND
108 # check token HAVE_EXPERIMENTAL
109 # check token HAVE_EXTERNAL
110 # check token HAVE_FPCLASS
111 # check token HAVE_GCC_ASM
112 ['HAVE_GETPAGESIZE', 'getpagesize', '#include<unistd.h>'],
113 # check token HAVE_GETTEXT
114 # check token HAVE_GST_V4L2
115 # check token HAVE_IOS
116 ['HAVE_ISINF', 'isinf', '#include<math.h>'],
117 # check token HAVE_LIBV4L2
118 ['HAVE_MMAP', 'mmap', '#include<sys/mman.h>'],
119 ['HAVE_MMAP64', 'mmap64', '#include<sys/mman.h>'],
120 # check token HAVE_OSX_AUDIO
121 # check token HAVE_OSX_VIDEO
122 # check token HAVE_RDTSC
123 ['HAVE_SINH', 'sinh', '#include<math.h>'],
124 # check token HAVE_WAVEFORM
127 libm = cc.find_library('m', required : false)
129 foreach f : check_functions
130 if cc.has_function(f.get(1), prefix : f.get(2), dependencies : libm)
131 cdata.set(f.get(0), 1)
135 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
136 cdata.set('SIZEOF_INT', cc.sizeof('int'))
137 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
138 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
139 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
140 cdata.set('SIZEOF_OFF_T', cc.sizeof('off_t'))
143 # FIXME: check if this is correct
144 cdata.set('HAVE_CPU_X86_64', host_machine.cpu() == 'amd64')
145 cdata.set('HAVE_GCC_ASM', cc.get_id() != 'msvc')
146 cdata.set_quoted('VERSION', gst_version)
147 cdata.set_quoted('PACKAGE_VERSION', gst_version)
148 cdata.set_quoted('GST_LICENSE', 'LGPL')
149 cdata.set_quoted('PACKAGE', 'gst-plugins-good')
150 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-good-1.0')
151 cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
153 cdata.set('ENABLE_NLS', 1)
157 '-Wmissing-declarations',
161 '-Wmissing-include-dirs',
168 '-Wmissing-prototypes',
169 '-Wdeclaration-after-statement',
170 '-Wold-style-definition',
171 '-Waggregate-return',
175 cxx = meson.get_compiler('cpp')
178 foreach extra_arg : warning_flags
179 if cc.has_argument (extra_arg)
180 add_project_arguments([extra_arg], language: 'c')
182 if have_cxx and cxx.has_argument (extra_arg)
183 add_project_arguments([extra_arg], language: 'cpp')
187 foreach extra_arg : warning_c_flags
188 if cc.has_argument (extra_arg)
189 add_project_arguments([extra_arg], language: 'c')
193 # GStreamer package name and origin url
194 gst_package_name = get_option('package-name')
195 if gst_package_name == ''
196 if gst_version_nano == 0
197 gst_package_name = 'GStreamer Good Plug-ins source release'
198 elif gst_version_nano == 1
199 gst_package_name = 'GStreamer Good Plug-ins git'
201 gst_package_name = 'GStreamer Good Plug-ins prerelease'
204 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
205 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
208 gst_dep = dependency('gstreamer-1.0', version : gst_req,
209 fallback : ['gstreamer', 'gst_dep'])
210 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
211 fallback : ['gstreamer', 'gst_base_dep'])
212 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
213 fallback : ['gstreamer', 'gst_net_dep'])
214 if host_machine.system() != 'windows'
215 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
216 fallback : ['gstreamer', 'gst_check_dep'])
218 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
219 fallback : ['gstreamer', 'gst_controller_dep'])
221 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
222 fallback : ['gst-plugins-base', 'pbutils_dep'])
223 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
224 fallback : ['gst-plugins-base', 'allocators_dep'])
225 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
226 fallback : ['gst-plugins-base', 'app_dep'])
227 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
228 fallback : ['gst-plugins-base', 'audio_dep'])
229 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
230 fallback : ['gst-plugins-base', 'fft_dep'])
231 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
232 fallback : ['gst-plugins-base', 'riff_dep'])
233 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
234 fallback : ['gst-plugins-base', 'rtp_dep'])
235 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
236 fallback : ['gst-plugins-base', 'rtsp_dep'])
237 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
238 fallback : ['gst-plugins-base', 'sdp_dep'])
239 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
240 fallback : ['gst-plugins-base', 'tag_dep'])
241 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
242 fallback : ['gst-plugins-base', 'video_dep'])
245 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
246 fallback : ['gst-plugins-base', 'gstgl_dep'], required: false)
248 build_gstgl = gstgl_dep.found() # FIXME: add option?
251 if gstgl_dep.type_name() == 'pkgconfig'
252 gst_gl_apis = gstgl_dep.get_pkgconfig_variable('gl_apis').split()
253 gst_gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys').split()
254 gst_gl_platforms = gstgl_dep.get_pkgconfig_variable('gl_platforms').split()
256 gstbase = subproject('gst-plugins-base')
257 gst_gl_apis = gstbase.get_variable('enabled_gl_apis')
258 gst_gl_winsys = gstbase.get_variable('enabled_gl_winsys')
259 gst_gl_platforms = gstbase.get_variable('enabled_gl_platforms')
262 message('GStreamer OpenGL window systems: @0@'.format(' '.join(gst_gl_winsys)))
263 message('GStreamer OpenGL platforms: @0@'.format(' '.join(gst_gl_platforms)))
264 message('GStreamer OpenGL apis: @0@'.format(' '.join(gst_gl_apis)))
266 foreach ws : ['x11', 'wayland', 'android', 'cocoa', 'eagl', 'win32', 'dispmanx', 'viv_fb']
267 set_variable('gst_gl_have_window_@0@'.format(ws), gst_gl_winsys.contains(ws))
270 foreach p : ['glx', 'egl', 'cgl', 'eagl', 'wgl']
271 set_variable('gst_gl_have_platform_@0@'.format(p), gst_gl_platforms.contains(p))
274 foreach api : ['opengl', 'gles2']
275 set_variable('gst_gl_have_api_@0@'.format(api), gst_gl_apis.contains(api))
279 zlib_dep = dependency('zlib', required : false)
280 bz2lib = cc.find_library('bz2', required : false)
281 glib_deps = [dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']),
282 dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])]
283 gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep'])
285 cdata.set('HAVE_ZLIB', zlib_dep.found())
286 cdata.set('HAVE_BZ2', bz2lib.found())
288 # Check all of the things.
289 # TODO: None of these are actually used yet because
290 # the build files haven't been written
292 ['gtk_dep','gtk+-3.0', '', ''],
293 ['gtkx_dep','gtk+-x11-3.0', '', ''],
294 ['caca_dep','caca', '', ''],
295 ['libraw1394_dep','libraw1394', '>=2.0.0', ''],
296 ['libiec61883_dep','libiec61883', '>=1.0.0', ''],
305 curdep = dependency(depname, required : false)
307 curdep = dependency(depname, required : false, version : version)
309 set_variable(varname, curdep)
310 if curdep.found() and confhname != ''
311 cdata.set(confhname, 1)
315 gst_plugins_good_args = ['-DHAVE_CONFIG_H']
316 configinc = include_directories('.')
317 libsinc = include_directories('gst-libs')
321 if get_option('orc') != 'no'
322 need_orc = get_option('orc') == 'yes'
323 # Used by various libraries/elements that use Orc code
324 orc_dep = dependency('orc-0.4', version : '>= 0.4.17', required : need_orc)
325 orcc = find_program('orcc', required : need_orc)
326 if orc_dep.found() and orcc.found()
328 orcc_args = [orcc, '--include', 'glib.h']
329 cdata.set('HAVE_ORC', 1)
331 message('Orc Compiler not found, will use backup C code')
332 cdata.set('DISABLE_ORC', 1)
335 cdata.set('DISABLE_ORC', 1)
338 if gst_dep.type_name() == 'internal'
339 gst_proj = subproject('gstreamer')
341 if not gst_proj.get_variable('gst_debug')
342 message('GStreamer debug system is disabled')
343 add_project_arguments('-Wno-unused', language: 'c')
345 message('GStreamer debug system is enabled')
348 # We can't check that in the case of subprojects as we won't
349 # be able to build against an internal dependency (which is not built yet)
350 if not cc.compiles('''
351 #include <gst/gstconfig.h>
352 #ifdef GST_DISABLE_GST_DEBUG
353 #error "debugging disabled, make compiler fail"
354 #endif''' , dependencies: gst_dep)
355 message('GStreamer debug system is disabled')
356 add_project_arguments('-Wno-unused', language: 'c')
358 message('GStreamer debug system is enabled')
362 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
364 pkgconfig = import('pkgconfig')
365 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
366 if get_option('default_library') == 'shared'
367 # If we don't build static plugins there is no need to generate pc files
368 plugins_pkgconfig_install_dir = disabler()
377 # xgettext is optional (on Windows for instance)
378 if get_option('nls') and find_program('xgettext', required : false).found()
382 configure_file(output : 'config.h', configuration : cdata)
384 python3 = import('python3').find_python()
385 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')