1 project('gst-omx', 'c',
3 meson_version : '>= 0.54',
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.56.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
20 tizil_req = '>= 0.19.0'
23 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
25 cc = meson.get_compiler('c')
27 if cc.get_id() == 'msvc'
28 # Ignore several spurious warnings for things gstreamer does very commonly
29 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
30 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
31 # NOTE: Only add warnings here if you are sure they're spurious
32 add_project_arguments(
33 '/wd4018', # implicit signed/unsigned conversion
34 '/wd4146', # unary minus on unsigned (beware INT_MIN)
35 '/wd4244', # lossy type conversion (e.g. double -> int)
36 '/wd4305', # truncating type conversion (e.g. double -> float)
38 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
39 # are built with MinGW
40 noseh_link_args = ['/SAFESEH:NO']
45 cdata = configuration_data()
47 # ['HAVE_DLFCN_H', 'dlfcn.h'],
48 # ['HAVE_FCNTL_H', 'fcntl.h'],
49 # ['HAVE_INTTYPES_H', 'inttypes.h'],
50 # ['HAVE_MEMORY_H', 'memory.h'],
51 # ['HAVE_MSACM_H', 'msacm.h'],
52 # ['HAVE_PTHREAD_H', 'pthread.h'],
53 # ['HAVE_STDINT_H', 'stdint.h'],
54 # ['HAVE_STDLIB_H', 'stdlib.h'],
55 # ['HAVE_STRINGS_H', 'strings.h'],
56 # ['HAVE_STRING_H', 'string.h'],
57 # ['HAVE_SYS_PARAM_H', 'sys/param.h'],
58 # ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
59 # ['HAVE_SYS_STAT_H', 'sys/stat.h'],
60 # ['HAVE_SYS_TIME_H', 'sys/time.h'],
61 # ['HAVE_SYS_TYPES_H', 'sys/types.h'],
62 # ['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
63 # ['HAVE_UNISTD_H', 'unistd.h'],
66 foreach h : check_headers
67 if cc.has_header(h.get(1))
68 cdata.set(h.get(0), 1)
73 # check token HAVE_CPU_ALPHA
74 # check token HAVE_CPU_ARM
75 # check token HAVE_CPU_CRIS
76 # check token HAVE_CPU_CRISV32
77 # check token HAVE_CPU_HPPA
78 # check token HAVE_CPU_I386
79 # check token HAVE_CPU_IA64
80 # check token HAVE_CPU_M68K
81 # check token HAVE_CPU_MIPS
82 # check token HAVE_CPU_PPC
83 # check token HAVE_CPU_PPC64
84 # check token HAVE_CPU_S390
85 # check token HAVE_CPU_SPARC
86 # check token HAVE_CPU_X86_64
87 # ['HAVE_DCGETTEXT', 'dcgettext'],
88 # check token HAVE_EXPERIMENTAL
89 # check token HAVE_EXTERNAL
90 # ['HAVE_GETPAGESIZE', 'getpagesize'],
91 # check token HAVE_GETTEXT
94 foreach f : check_functions
95 if cc.has_function(f.get(1))
96 cdata.set(f.get(0), 1)
100 #cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
101 #cdata.set('SIZEOF_INT', cc.sizeof('int'))
102 #cdata.set('SIZEOF_LONG', cc.sizeof('long'))
103 #cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
104 #cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
106 cdata.set('VERSION', '"@0@"'.format(gst_version))
107 cdata.set('PACKAGE', '"gst-omx"')
108 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
109 cdata.set('PACKAGE_BUGREPORT', '"https://gitlab.freedesktop.org/gstreamer/gst-omx/issues/new"')
110 cdata.set('PACKAGE_NAME', '"GStreamer OMX Plugins"')
111 cdata.set('GETTEXT_PACKAGE', '"gst-omx-1.0"')
112 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
113 cdata.set('GST_PACKAGE_NAME', '"GStreamer OpenMAX Plug-ins"')
114 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
115 cdata.set('GST_LICENSE', '"LGPL"')
116 cdata.set('LIBDIR', '"@0@"'.format(get_option('libdir')))
118 # FIXME: This should be exposed as a configuration option
119 host_system = host_machine.system()
120 if host_system == 'linux'
121 cdata.set('DEFAULT_VIDEOSRC', '"v4l2src"')
122 elif host_system == 'osx'
123 cdata.set('DEFAULT_VIDEOSRC', '"avfvideosrc"')
125 cdata.set('DEFAULT_VIDEOSRC', '"videotestsrc"')
129 gst_dep = dependency('gstreamer-1.0', version : gst_req,
130 fallback : ['gstreamer', 'gst_dep'])
131 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
132 fallback : ['gstreamer', 'gst_base_dep'])
133 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
134 fallback : ['gstreamer', 'gst_controller_dep'])
135 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
136 fallback : ['gst-plugins-base', 'allocators_dep'])
138 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
139 fallback : ['gst-plugins-base', 'pbutils_dep'])
140 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
141 fallback : ['gst-plugins-base', 'audio_dep'])
142 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
143 fallback : ['gst-plugins-base', 'fft_dep'])
144 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
145 fallback : ['gst-plugins-base', 'tag_dep'])
146 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
147 fallback : ['gst-plugins-base', 'video_dep'])
149 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
150 fallback : ['gst-plugins-base', 'gstgl_dep'], required : false)
152 x11_dep = dependency('x11', required : false)
154 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
155 required : get_option('tests'),
156 fallback : ['gstreamer', 'gst_check_dep'])
158 libm = cc.find_library('m', required : false)
159 glib_dep = dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep'])
160 gio_dep = dependency('gio-2.0', version : glib_req, fallback: ['glib', 'libgio_dep'] )
161 gmodule_dep = dependency('gmodule-2.0', version : glib_req, fallback: ['glib', 'libgmodule_dep'])
163 gst_omx_args = ['-DHAVE_CONFIG_H']
164 configinc = include_directories('.')
165 omx_header_path = get_option('header_path')
166 if omx_header_path != ''
168 gst_omx_args += ['-I' + omx_header_path]
170 omx_inc = include_directories (join_paths ('omx', 'openmax'))
173 default_omx_struct_packing = 0
174 omx_target = get_option ('target')
175 if omx_target == 'generic'
176 cdata.set('USE_OMX_TARGET_GENERIC', 1)
177 elif omx_target == 'rpi'
178 cdata.set('USE_OMX_TARGET_RPI', 1)
179 cdata.set('OMX_SKIP64BIT', 1)
180 default_omx_struct_packing = 4
183 if gstgl_dep.type_name() == 'pkgconfig'
184 gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys').split(' ')
185 gl_platforms = gstgl_dep.get_pkgconfig_variable('gl_platforms').split(' ')
186 elif gstgl_dep.type_name() == 'internal'
187 # XXX assume gst-plugins-base was built with dispmanx and egl support
188 gl_winsys = ['dispmanx']
189 gl_platforms = ['egl']
191 error ('unreachable dependency type')
194 if not gl_winsys.contains('dispmanx') or not gl_platforms.contains ('egl')
195 gstgl_dep = dependency('', required : false)
198 elif omx_target == 'bellagio'
199 cdata.set('USE_OMX_TARGET_BELLAGIO', 1)
200 elif omx_target == 'zynqultrascaleplus'
201 cdata.set('USE_OMX_TARGET_ZYNQ_USCALE_PLUS', 1)
202 have_allegro_header = cc.has_header (
205 include_directories : [omx_inc])
206 if not have_allegro_header
207 error ('Need Allegro OMX headers to build for Zynq UltraScale+. Use -Dheader_path option to specify the path of those headers.')
209 elif omx_target == 'tizonia'
210 if omx_header_path != ''
211 warning('Ignoring -Dheader_path because path is in tizilheaders.pc')
213 cdata.set('USE_OMX_TARGET_TIZONIA', 1)
214 tizil_dep = dependency('tizilheaders', version : tizil_req)
215 cdata.set('TIZONIA_LIBDIR', tizil_dep.get_pkgconfig_variable('libdir'))
216 tizil_includedir = tizil_dep.get_pkgconfig_variable('includedir')
217 gst_omx_args += ['-I' + tizil_includedir + '/tizonia']
220 error ('Unsupported omx target specified. Use the -Dtarget option')
223 message ('OMX target: ' + omx_target)
225 extra_video_headers = ''
226 # Check for optional OpenMAX extension headers
231 include_directories : [omx_inc])
232 extra_video_headers += '''
233 #include <OMX_VideoExt.h>'''
234 cdata.set ('HAVE_VIDEO_EXT', 1)
240 include_directories : [omx_inc])
241 cdata.set ('HAVE_INDEX_EXT', 1)
245 'OMX_ComponentExt.h',
247 include_directories : [omx_inc])
248 cdata.set ('HAVE_COMPONENT_EXT', 1)
254 cdata.set ('HAVE_CORE_EXT', 1)
260 cdata.set ('HAVE_AUDIO_EXT', 1)
266 cdata.set ('HAVE_IV_COMMON_EXT', 1)
272 cdata.set ('HAVE_IMAGE_EXT', 1)
278 cdata.set ('HAVE_OTHER_EXT', 1)
281 have_omx_vp8 = cc.has_header_symbol(
283 'OMX_VIDEO_CodingVP8',
284 prefix : extra_video_headers,
286 include_directories : [omx_inc])
288 cdata.set('HAVE_VP8', 1)
291 have_omx_theora = cc.has_header_symbol(
293 'OMX_VIDEO_CodingTheora',
294 prefix : extra_video_headers,
296 include_directories : [omx_inc])
298 cdata.set('HAVE_THEORA', 1)
301 have_omx_hevc = cc.has_header_symbol(
303 'OMX_VIDEO_CodingHEVC',
304 prefix : extra_video_headers,
306 include_directories : [omx_inc])
308 cdata.set('HAVE_HEVC', 1)
312 cdata.set ('HAVE_GST_GL', 1)
316 cdata.set ('HAVE_X11', 1)
319 omx_struct_packing = get_option ('struct_packing').to_int()
320 if omx_struct_packing == 0
321 omx_struct_packing = default_omx_struct_packing
323 if omx_struct_packing != 0
324 cdata.set('GST_OMX_STRUCT_PACKING', omx_struct_packing)
327 omx_conf_dir = join_paths (get_option ('prefix'), get_option ('sysconfdir'), 'xdg')
328 cdata.set_quoted('GST_OMX_CONFIG_DIR', omx_conf_dir)
331 '-Wmissing-declarations',
335 '-Wmissing-include-dirs',
343 '-Wmissing-prototypes',
344 '-Wdeclaration-after-statement',
345 '-Wold-style-definition',
346 '-Waggregate-return',
349 have_cxx = add_languages('cpp', required : false)
352 cxx = meson.get_compiler('cpp')
355 foreach extra_arg : warning_flags
356 if cc.has_argument (extra_arg)
357 add_project_arguments([extra_arg], language: 'c')
359 if have_cxx and cxx.has_argument (extra_arg)
360 add_project_arguments([extra_arg], language: 'cpp')
364 foreach extra_arg : warning_c_flags
365 if cc.has_argument (extra_arg)
366 add_project_arguments([extra_arg], language: 'c')
370 # Disable compiler warnings for unused variables and args if gst debug system is disabled
371 if gst_dep.type_name() == 'internal'
372 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
374 # We can't check that in the case of subprojects as we won't
375 # be able to build against an internal dependency (which is not built yet)
376 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
379 if gst_debug_disabled
380 message('GStreamer debug system is disabled')
381 if cc.has_argument('-Wno-unused')
382 add_project_arguments('-Wno-unused', language: 'c')
384 if have_cxx and cxx.has_argument ('-Wno-unused')
385 add_project_arguments('-Wno-unused', language: 'cpp')
388 message('GStreamer debug system is enabled')
393 if not get_option('examples').disabled()
399 if not get_option('tools').disabled()
403 if not get_option('tests').disabled() and gstcheck_dep.found()
409 if gst_version_nano == 0
410 extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
411 run_result = run_command(extract_release_date, gst_version, files('gst-omx.doap'))
412 if run_result.returncode() == 0
413 release_date = run_result.stdout().strip()
414 cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
415 message('Package release date: ' + release_date)
417 # Error out if our release can't be found in the .doap file
418 error(run_result.stderr())
422 configure_file(output: 'config.h', configuration: cdata)
424 python3 = find_program('python3')
425 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')