1 project('gst-omx', 'c',
3 meson_version : '>= 0.60',
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'
29 # Ignore several spurious warnings for things gstreamer does very commonly
30 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
31 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
32 # NOTE: Only add warnings here if you are sure they're spurious
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)
37 cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
39 # Enable some warnings on MSVC to match GCC/Clang behaviour
40 '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
41 '/w14101', # 'identifier' : unreferenced local variable
42 '/w14189', # 'identifier' : local variable is initialized but not referenced
44 add_project_arguments(msvc_args, language: 'c')
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']
52 cdata = configuration_data()
54 # ['HAVE_DLFCN_H', 'dlfcn.h'],
55 # ['HAVE_FCNTL_H', 'fcntl.h'],
56 # ['HAVE_INTTYPES_H', 'inttypes.h'],
57 # ['HAVE_MEMORY_H', 'memory.h'],
58 # ['HAVE_MSACM_H', 'msacm.h'],
59 # ['HAVE_PTHREAD_H', 'pthread.h'],
60 # ['HAVE_STDINT_H', 'stdint.h'],
61 # ['HAVE_STDLIB_H', 'stdlib.h'],
62 # ['HAVE_STRINGS_H', 'strings.h'],
63 # ['HAVE_STRING_H', 'string.h'],
64 # ['HAVE_SYS_PARAM_H', 'sys/param.h'],
65 # ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
66 # ['HAVE_SYS_STAT_H', 'sys/stat.h'],
67 # ['HAVE_SYS_TIME_H', 'sys/time.h'],
68 # ['HAVE_SYS_TYPES_H', 'sys/types.h'],
69 # ['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
70 # ['HAVE_UNISTD_H', 'unistd.h'],
73 foreach h : check_headers
74 if cc.has_header(h.get(1))
75 cdata.set(h.get(0), 1)
80 # check token HAVE_CPU_ALPHA
81 # check token HAVE_CPU_ARM
82 # check token HAVE_CPU_CRIS
83 # check token HAVE_CPU_CRISV32
84 # check token HAVE_CPU_HPPA
85 # check token HAVE_CPU_I386
86 # check token HAVE_CPU_IA64
87 # check token HAVE_CPU_M68K
88 # check token HAVE_CPU_MIPS
89 # check token HAVE_CPU_PPC
90 # check token HAVE_CPU_PPC64
91 # check token HAVE_CPU_S390
92 # check token HAVE_CPU_SPARC
93 # check token HAVE_CPU_X86_64
94 # ['HAVE_DCGETTEXT', 'dcgettext'],
95 # check token HAVE_EXPERIMENTAL
96 # check token HAVE_EXTERNAL
97 # ['HAVE_GETPAGESIZE', 'getpagesize'],
98 # check token HAVE_GETTEXT
101 foreach f : check_functions
102 if cc.has_function(f.get(1))
103 cdata.set(f.get(0), 1)
107 #cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
108 #cdata.set('SIZEOF_INT', cc.sizeof('int'))
109 #cdata.set('SIZEOF_LONG', cc.sizeof('long'))
110 #cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
111 #cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
113 cdata.set('VERSION', '"@0@"'.format(gst_version))
114 cdata.set('PACKAGE', '"gst-omx"')
115 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
116 cdata.set('PACKAGE_BUGREPORT', '"https://gitlab.freedesktop.org/gstreamer/gst-omx/issues/new"')
117 cdata.set('PACKAGE_NAME', '"GStreamer OMX Plugins"')
118 cdata.set('GETTEXT_PACKAGE', '"gst-omx-1.0"')
119 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
120 cdata.set('GST_PACKAGE_NAME', '"GStreamer OpenMAX Plug-ins"')
121 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
122 cdata.set('GST_LICENSE', '"LGPL"')
123 cdata.set('LIBDIR', '"@0@"'.format(get_option('libdir')))
125 # FIXME: This should be exposed as a configuration option
126 host_system = host_machine.system()
127 if host_system == 'linux'
128 cdata.set('DEFAULT_VIDEOSRC', '"v4l2src"')
129 elif host_system == 'osx'
130 cdata.set('DEFAULT_VIDEOSRC', '"avfvideosrc"')
132 cdata.set('DEFAULT_VIDEOSRC', '"videotestsrc"')
136 gst_dep = dependency('gstreamer-1.0', version : gst_req,
137 fallback : ['gstreamer', 'gst_dep'])
138 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
139 fallback : ['gstreamer', 'gst_base_dep'])
140 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
141 fallback : ['gstreamer', 'gst_controller_dep'])
142 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
143 fallback : ['gst-plugins-base', 'allocators_dep'])
145 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
146 fallback : ['gst-plugins-base', 'pbutils_dep'])
147 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
148 fallback : ['gst-plugins-base', 'audio_dep'])
149 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
150 fallback : ['gst-plugins-base', 'fft_dep'])
151 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
152 fallback : ['gst-plugins-base', 'tag_dep'])
153 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
154 fallback : ['gst-plugins-base', 'video_dep'])
156 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
157 fallback : ['gst-plugins-base', 'gstgl_dep'], required : false)
159 x11_dep = dependency('x11', required : false)
161 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
162 required : get_option('tests'),
163 fallback : ['gstreamer', 'gst_check_dep'])
165 libm = cc.find_library('m', required : false)
166 gmodule_dep = dependency('gmodule-2.0', version: glib_req)
168 gst_omx_args = ['-DHAVE_CONFIG_H']
169 configinc = include_directories('.')
170 omx_header_path = get_option('header_path')
171 if omx_header_path != ''
173 gst_omx_args += ['-I' + omx_header_path]
175 omx_inc = include_directories (join_paths ('omx', 'openmax'))
178 default_omx_struct_packing = 0
179 omx_target = get_option ('target')
180 if omx_target == 'generic'
181 cdata.set('USE_OMX_TARGET_GENERIC', 1)
182 elif omx_target == 'rpi'
183 cdata.set('USE_OMX_TARGET_RPI', 1)
184 cdata.set('OMX_SKIP64BIT', 1)
185 default_omx_struct_packing = 4
188 if gstgl_dep.type_name() == 'pkgconfig'
189 gl_winsys = gstgl_dep.get_variable('gl_winsys').split(' ')
190 gl_platforms = gstgl_dep.get_variable('gl_platforms').split(' ')
191 elif gstgl_dep.type_name() == 'internal'
192 # XXX assume gst-plugins-base was built with dispmanx and egl support
193 gl_winsys = ['dispmanx']
194 gl_platforms = ['egl']
196 error ('unreachable dependency type')
199 if not gl_winsys.contains('dispmanx') or not gl_platforms.contains ('egl')
200 gstgl_dep = dependency('', required : false)
203 elif omx_target == 'bellagio'
204 cdata.set('USE_OMX_TARGET_BELLAGIO', 1)
205 elif omx_target == 'zynqultrascaleplus'
206 cdata.set('USE_OMX_TARGET_ZYNQ_USCALE_PLUS', 1)
207 have_allegro_header = cc.has_header (
210 include_directories : [omx_inc])
211 if not have_allegro_header
212 error ('Need Allegro OMX headers to build for Zynq UltraScale+. Use -Dheader_path option to specify the path of those headers.')
214 elif omx_target == 'tizonia'
215 if omx_header_path != ''
216 warning('Ignoring -Dheader_path because path is in tizilheaders.pc')
218 cdata.set('USE_OMX_TARGET_TIZONIA', 1)
219 tizil_dep = dependency('tizilheaders', version : tizil_req)
220 cdata.set('TIZONIA_LIBDIR', tizil_dep.get_variable('libdir'))
221 tizil_includedir = tizil_dep.get_variable('includedir')
222 gst_omx_args += ['-I' + tizil_includedir + '/tizonia']
225 error ('Unsupported omx target specified. Use the -Dtarget option')
228 message ('OMX target: ' + omx_target)
230 extra_video_headers = ''
231 # Check for optional OpenMAX extension headers
236 include_directories : [omx_inc])
237 extra_video_headers += '''
238 #include <OMX_VideoExt.h>'''
239 cdata.set ('HAVE_VIDEO_EXT', 1)
245 include_directories : [omx_inc])
246 cdata.set ('HAVE_INDEX_EXT', 1)
250 'OMX_ComponentExt.h',
252 include_directories : [omx_inc])
253 cdata.set ('HAVE_COMPONENT_EXT', 1)
259 cdata.set ('HAVE_CORE_EXT', 1)
265 cdata.set ('HAVE_AUDIO_EXT', 1)
271 cdata.set ('HAVE_IV_COMMON_EXT', 1)
277 cdata.set ('HAVE_IMAGE_EXT', 1)
283 cdata.set ('HAVE_OTHER_EXT', 1)
286 have_omx_vp8 = cc.has_header_symbol(
288 'OMX_VIDEO_CodingVP8',
289 prefix : extra_video_headers,
291 include_directories : [omx_inc])
293 cdata.set('HAVE_VP8', 1)
296 have_omx_theora = cc.has_header_symbol(
298 'OMX_VIDEO_CodingTheora',
299 prefix : extra_video_headers,
301 include_directories : [omx_inc])
303 cdata.set('HAVE_THEORA', 1)
306 have_omx_hevc = cc.has_header_symbol(
308 'OMX_VIDEO_CodingHEVC',
309 prefix : extra_video_headers,
311 include_directories : [omx_inc])
313 cdata.set('HAVE_HEVC', 1)
317 cdata.set ('HAVE_GST_GL', 1)
321 cdata.set ('HAVE_X11', 1)
324 omx_struct_packing = get_option ('struct_packing').to_int()
325 if omx_struct_packing == 0
326 omx_struct_packing = default_omx_struct_packing
328 if omx_struct_packing != 0
329 cdata.set('GST_OMX_STRUCT_PACKING', omx_struct_packing)
332 omx_conf_dir = join_paths (get_option ('prefix'), get_option ('sysconfdir'), 'xdg')
333 cdata.set_quoted('GST_OMX_CONFIG_DIR', omx_conf_dir)
336 '-Wmissing-declarations',
340 '-Wmissing-include-dirs',
348 '-Wmissing-prototypes',
349 '-Wdeclaration-after-statement',
350 '-Wold-style-definition',
351 '-Waggregate-return',
354 have_cxx = add_languages('cpp', required : false)
357 cxx = meson.get_compiler('cpp')
360 foreach extra_arg : warning_flags
361 if cc.has_argument (extra_arg)
362 add_project_arguments([extra_arg], language: 'c')
364 if have_cxx and cxx.has_argument (extra_arg)
365 add_project_arguments([extra_arg], language: 'cpp')
369 foreach extra_arg : warning_c_flags
370 if cc.has_argument (extra_arg)
371 add_project_arguments([extra_arg], language: 'c')
375 # Disable compiler warnings for unused variables and args if gst debug system is disabled
376 if gst_dep.type_name() == 'internal'
377 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
379 # We can't check that in the case of subprojects as we won't
380 # be able to build against an internal dependency (which is not built yet)
381 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
384 if gst_debug_disabled
385 message('GStreamer debug system is disabled')
386 if cc.has_argument('-Wno-unused')
387 add_project_arguments('-Wno-unused', language: 'c')
389 if have_cxx and cxx.has_argument ('-Wno-unused')
390 add_project_arguments('-Wno-unused', language: 'cpp')
393 message('GStreamer debug system is enabled')
398 if not get_option('examples').disabled()
404 if not get_option('tools').disabled()
408 if not get_option('tests').disabled() and gstcheck_dep.found()
414 if gst_version_nano == 0
415 extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
416 run_result = run_command(extract_release_date, gst_version, files('gst-omx.doap'), check: true)
417 release_date = run_result.stdout().strip()
418 cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
419 message('Package release date: ' + release_date)
422 configure_file(output: 'config.h', configuration: cdata)