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('VERSION', '"@0@"'.format(gst_version))
147 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
148 cdata.set('GST_LICENSE', '"LGPL"')
149 cdata.set('PACKAGE', '"gst-plugins-good"')
150 cdata.set('GETTEXT_PACKAGE', '"gst-plugins-good-1.0"')
153 '-Wmissing-declarations',
157 '-Wmissing-include-dirs',
164 '-Wmissing-prototypes',
165 '-Wdeclaration-after-statement',
166 '-Wold-style-definition',
167 '-Waggregate-return',
171 cxx = meson.get_compiler('cpp')
174 foreach extra_arg : warning_flags
175 if cc.has_argument (extra_arg)
176 add_project_arguments([extra_arg], language: 'c')
178 if have_cxx and cxx.has_argument (extra_arg)
179 add_project_arguments([extra_arg], language: 'cpp')
183 foreach extra_arg : warning_c_flags
184 if cc.has_argument (extra_arg)
185 add_project_arguments([extra_arg], language: 'c')
189 # GStreamer package name and origin url
190 gst_package_name = get_option('package-name')
191 if gst_package_name == ''
192 if gst_version_nano == 0
193 gst_package_name = 'GStreamer Good Plug-ins source release'
194 elif gst_version_nano == 1
195 gst_package_name = 'GStreamer Good Plug-ins git'
197 gst_package_name = 'GStreamer Good Plug-ins prerelease'
200 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
201 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
204 gst_dep = dependency('gstreamer-1.0', version : gst_req,
205 fallback : ['gstreamer', 'gst_dep'])
206 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
207 fallback : ['gstreamer', 'gst_base_dep'])
208 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
209 fallback : ['gstreamer', 'gst_net_dep'])
210 if host_machine.system() != 'windows'
211 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
212 fallback : ['gstreamer', 'gst_check_dep'])
214 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
215 fallback : ['gstreamer', 'gst_controller_dep'])
217 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
218 fallback : ['gst-plugins-base', 'pbutils_dep'])
219 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
220 fallback : ['gst-plugins-base', 'allocators_dep'])
221 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
222 fallback : ['gst-plugins-base', 'app_dep'])
223 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
224 fallback : ['gst-plugins-base', 'audio_dep'])
225 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
226 fallback : ['gst-plugins-base', 'fft_dep'])
227 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
228 fallback : ['gst-plugins-base', 'riff_dep'])
229 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
230 fallback : ['gst-plugins-base', 'rtp_dep'])
231 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
232 fallback : ['gst-plugins-base', 'rtsp_dep'])
233 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
234 fallback : ['gst-plugins-base', 'sdp_dep'])
235 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
236 fallback : ['gst-plugins-base', 'tag_dep'])
237 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
238 fallback : ['gst-plugins-base', 'video_dep'])
241 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
242 fallback : ['gst-plugins-base', 'gstgl_dep'], required: false)
244 build_gstgl = gstgl_dep.found() # FIXME: add option?
247 if gstgl_dep.type_name() == 'pkgconfig'
248 gst_gl_apis = gstgl_dep.get_pkgconfig_variable('gl_apis').split()
249 gst_gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys').split()
250 gst_gl_platforms = gstgl_dep.get_pkgconfig_variable('gl_platforms').split()
252 gstbase = subproject('gst-plugins-base')
253 gst_gl_apis = gstbase.get_variable('enabled_gl_apis')
254 gst_gl_winsys = gstbase.get_variable('enabled_gl_winsys')
255 gst_gl_platforms = gstbase.get_variable('enabled_gl_platforms')
258 message('GStreamer OpenGL window systems: @0@'.format(' '.join(gst_gl_winsys)))
259 message('GStreamer OpenGL platforms: @0@'.format(' '.join(gst_gl_platforms)))
260 message('GStreamer OpenGL apis: @0@'.format(' '.join(gst_gl_apis)))
262 foreach ws : ['x11', 'wayland', 'android', 'cocoa', 'eagl', 'win32', 'dispmanx', 'viv_fb']
263 set_variable('gst_gl_have_window_@0@'.format(ws), gst_gl_winsys.contains(ws))
266 foreach p : ['glx', 'egl', 'cgl', 'eagl', 'wgl']
267 set_variable('gst_gl_have_platform_@0@'.format(p), gst_gl_platforms.contains(p))
270 foreach api : ['opengl', 'gles2']
271 set_variable('gst_gl_have_api_@0@'.format(api), gst_gl_apis.contains(api))
275 zlib_dep = dependency('zlib', required : false)
276 bz2lib = cc.find_library('bz2', required : false)
277 glib_deps = [dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']),
278 dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])]
279 gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep'])
281 cdata.set('HAVE_ZLIB', zlib_dep.found())
282 cdata.set('HAVE_BZ2', bz2lib.found())
284 # Check all of the things.
285 # TODO: None of these are actually used yet because
286 # the build files haven't been written
288 ['gtk_dep','gtk+-3.0', '', ''],
289 ['gtkx_dep','gtk+-x11-3.0', '', ''],
290 ['caca_dep','caca', '', ''],
291 ['libraw1394_dep','libraw1394', '>=2.0.0', ''],
292 ['libiec61883_dep','libiec61883', '>=1.0.0', ''],
301 curdep = dependency(depname, required : false)
303 curdep = dependency(depname, required : false, version : version)
305 set_variable(varname, curdep)
306 if curdep.found() and confhname != ''
307 cdata.set(confhname, 1)
311 gst_plugins_good_args = ['-DHAVE_CONFIG_H']
312 configinc = include_directories('.')
313 libsinc = include_directories('gst-libs')
317 if get_option('orc') != 'no'
318 need_orc = get_option('orc') == 'yes'
319 # Used by various libraries/elements that use Orc code
320 orc_dep = dependency('orc-0.4', version : '>= 0.4.17', required : need_orc)
321 orcc = find_program('orcc', required : need_orc)
322 if orc_dep.found() and orcc.found()
324 orcc_args = [orcc, '--include', 'glib.h']
325 cdata.set('HAVE_ORC', 1)
327 message('Orc Compiler not found, will use backup C code')
328 cdata.set('DISABLE_ORC', 1)
331 cdata.set('DISABLE_ORC', 1)
334 if gst_dep.type_name() == 'internal'
335 gst_proj = subproject('gstreamer')
337 if not gst_proj.get_variable('gst_debug')
338 message('GStreamer debug system is disabled')
339 add_project_arguments('-Wno-unused', language: 'c')
341 message('GStreamer debug system is enabled')
344 # We can't check that in the case of subprojects as we won't
345 # be able to build against an internal dependency (which is not built yet)
346 if not cc.compiles('''
347 #include <gst/gstconfig.h>
348 #ifdef GST_DISABLE_GST_DEBUG
349 #error "debugging disabled, make compiler fail"
350 #endif''' , dependencies: gst_dep)
351 message('GStreamer debug system is disabled')
352 add_project_arguments('-Wno-unused', language: 'c')
354 message('GStreamer debug system is enabled')
358 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
360 pkgconfig = import('pkgconfig')
361 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
362 if get_option('default_library') == 'shared'
363 # If we don't build static plugins there is no need to generate pc files
364 plugins_pkgconfig_install_dir = disabler()
373 # xgettext is optional (on Windows for instance)
374 if find_program('xgettext', required : false).found()
378 configure_file(output : 'config.h', configuration : cdata)
380 python3 = import('python3').find_python()
381 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')