1 project('gst-omx', 'c',
3 meson_version : '>= 0.62',
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.62.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 # glib doesn't support unloading, which means that unloading and reloading
53 # any library that registers static types will fail
54 if cc.has_link_argument('-Wl,-z,nodelete')
55 add_project_link_arguments('-Wl,-z,nodelete', language: 'c')
58 cdata = configuration_data()
60 # ['HAVE_DLFCN_H', 'dlfcn.h'],
61 # ['HAVE_FCNTL_H', 'fcntl.h'],
62 # ['HAVE_INTTYPES_H', 'inttypes.h'],
63 # ['HAVE_MEMORY_H', 'memory.h'],
64 # ['HAVE_MSACM_H', 'msacm.h'],
65 # ['HAVE_PTHREAD_H', 'pthread.h'],
66 # ['HAVE_STDINT_H', 'stdint.h'],
67 # ['HAVE_STDLIB_H', 'stdlib.h'],
68 # ['HAVE_STRINGS_H', 'strings.h'],
69 # ['HAVE_STRING_H', 'string.h'],
70 # ['HAVE_SYS_PARAM_H', 'sys/param.h'],
71 # ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
72 # ['HAVE_SYS_STAT_H', 'sys/stat.h'],
73 # ['HAVE_SYS_TIME_H', 'sys/time.h'],
74 # ['HAVE_SYS_TYPES_H', 'sys/types.h'],
75 # ['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
76 # ['HAVE_UNISTD_H', 'unistd.h'],
79 foreach h : check_headers
80 if cc.has_header(h.get(1))
81 cdata.set(h.get(0), 1)
86 # check token HAVE_CPU_ALPHA
87 # check token HAVE_CPU_ARM
88 # check token HAVE_CPU_CRIS
89 # check token HAVE_CPU_CRISV32
90 # check token HAVE_CPU_HPPA
91 # check token HAVE_CPU_I386
92 # check token HAVE_CPU_IA64
93 # check token HAVE_CPU_M68K
94 # check token HAVE_CPU_MIPS
95 # check token HAVE_CPU_PPC
96 # check token HAVE_CPU_PPC64
97 # check token HAVE_CPU_S390
98 # check token HAVE_CPU_SPARC
99 # check token HAVE_CPU_X86_64
100 # ['HAVE_DCGETTEXT', 'dcgettext'],
101 # check token HAVE_EXPERIMENTAL
102 # check token HAVE_EXTERNAL
103 # ['HAVE_GETPAGESIZE', 'getpagesize'],
104 # check token HAVE_GETTEXT
107 foreach f : check_functions
108 if cc.has_function(f.get(1))
109 cdata.set(f.get(0), 1)
113 #cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
114 #cdata.set('SIZEOF_INT', cc.sizeof('int'))
115 #cdata.set('SIZEOF_LONG', cc.sizeof('long'))
116 #cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
117 #cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
119 cdata.set('VERSION', '"@0@"'.format(gst_version))
120 cdata.set('PACKAGE', '"gst-omx"')
121 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
122 cdata.set('PACKAGE_BUGREPORT', '"https://gitlab.freedesktop.org/gstreamer/gst-omx/issues/new"')
123 cdata.set('PACKAGE_NAME', '"GStreamer OMX Plugins"')
124 cdata.set('GETTEXT_PACKAGE', '"gst-omx-1.0"')
125 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
126 cdata.set('GST_PACKAGE_NAME', '"GStreamer OpenMAX Plug-ins"')
127 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
128 cdata.set('GST_LICENSE', '"LGPL"')
129 cdata.set('LIBDIR', '"@0@"'.format(get_option('libdir')))
131 # FIXME: This should be exposed as a configuration option
132 host_system = host_machine.system()
133 if host_system == 'linux'
134 cdata.set('DEFAULT_VIDEOSRC', '"v4l2src"')
135 elif host_system == 'osx'
136 cdata.set('DEFAULT_VIDEOSRC', '"avfvideosrc"')
138 cdata.set('DEFAULT_VIDEOSRC', '"videotestsrc"')
142 gst_dep = dependency('gstreamer-1.0', version : gst_req,
143 fallback : ['gstreamer', 'gst_dep'])
144 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
145 fallback : ['gstreamer', 'gst_base_dep'])
146 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
147 fallback : ['gstreamer', 'gst_controller_dep'])
148 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
149 fallback : ['gst-plugins-base', 'allocators_dep'])
151 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
152 fallback : ['gst-plugins-base', 'pbutils_dep'])
153 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
154 fallback : ['gst-plugins-base', 'audio_dep'])
155 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
156 fallback : ['gst-plugins-base', 'fft_dep'])
157 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
158 fallback : ['gst-plugins-base', 'tag_dep'])
159 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
160 fallback : ['gst-plugins-base', 'video_dep'])
162 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
163 fallback : ['gst-plugins-base', 'gstgl_dep'], required : false)
165 x11_dep = dependency('x11', required : false)
167 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
168 required : get_option('tests'),
169 fallback : ['gstreamer', 'gst_check_dep'])
171 libm = cc.find_library('m', required : false)
172 gmodule_dep = dependency('gmodule-no-export-2.0', version: glib_req)
174 gst_omx_args = ['-DHAVE_CONFIG_H']
175 configinc = include_directories('.')
176 omx_header_path = get_option('header_path')
177 if omx_header_path != ''
179 gst_omx_args += ['-I' + omx_header_path]
181 omx_inc = include_directories (join_paths ('omx', 'openmax'))
184 default_omx_struct_packing = 0
185 omx_target = get_option ('target')
186 if omx_target == 'generic'
187 cdata.set('USE_OMX_TARGET_GENERIC', 1)
188 elif omx_target == 'rpi'
189 cdata.set('USE_OMX_TARGET_RPI', 1)
190 cdata.set('OMX_SKIP64BIT', 1)
191 default_omx_struct_packing = 4
194 if gstgl_dep.type_name() == 'pkgconfig'
195 gl_winsys = gstgl_dep.get_variable('gl_winsys').split(' ')
196 gl_platforms = gstgl_dep.get_variable('gl_platforms').split(' ')
197 elif gstgl_dep.type_name() == 'internal'
198 # XXX assume gst-plugins-base was built with dispmanx and egl support
199 gl_winsys = ['dispmanx']
200 gl_platforms = ['egl']
202 error ('unreachable dependency type')
205 if not gl_winsys.contains('dispmanx') or not gl_platforms.contains ('egl')
206 gstgl_dep = dependency('', required : false)
209 elif omx_target == 'bellagio'
210 cdata.set('USE_OMX_TARGET_BELLAGIO', 1)
211 elif omx_target == 'zynqultrascaleplus'
212 cdata.set('USE_OMX_TARGET_ZYNQ_USCALE_PLUS', 1)
213 have_allegro_header = cc.has_header (
216 include_directories : [omx_inc])
217 if not have_allegro_header
218 error ('Need Allegro OMX headers to build for Zynq UltraScale+. Use -Dheader_path option to specify the path of those headers.')
220 elif omx_target == 'tizonia'
221 if omx_header_path != ''
222 warning('Ignoring -Dheader_path because path is in tizilheaders.pc')
224 cdata.set('USE_OMX_TARGET_TIZONIA', 1)
225 tizil_dep = dependency('tizilheaders', version : tizil_req)
226 cdata.set('TIZONIA_LIBDIR', tizil_dep.get_variable('libdir'))
227 tizil_includedir = tizil_dep.get_variable('includedir')
228 gst_omx_args += ['-I' + tizil_includedir + '/tizonia']
231 error ('Unsupported omx target specified. Use the -Dtarget option')
234 message ('OMX target: ' + omx_target)
236 extra_video_headers = ''
237 # Check for optional OpenMAX extension headers
242 include_directories : [omx_inc])
243 extra_video_headers += '''
244 #include <OMX_VideoExt.h>'''
245 cdata.set ('HAVE_VIDEO_EXT', 1)
251 include_directories : [omx_inc])
252 cdata.set ('HAVE_INDEX_EXT', 1)
256 'OMX_ComponentExt.h',
258 include_directories : [omx_inc])
259 cdata.set ('HAVE_COMPONENT_EXT', 1)
265 cdata.set ('HAVE_CORE_EXT', 1)
271 cdata.set ('HAVE_AUDIO_EXT', 1)
277 cdata.set ('HAVE_IV_COMMON_EXT', 1)
283 cdata.set ('HAVE_IMAGE_EXT', 1)
289 cdata.set ('HAVE_OTHER_EXT', 1)
292 have_omx_vp8 = cc.has_header_symbol(
294 'OMX_VIDEO_CodingVP8',
295 prefix : extra_video_headers,
297 include_directories : [omx_inc])
299 cdata.set('HAVE_VP8', 1)
302 have_omx_theora = cc.has_header_symbol(
304 'OMX_VIDEO_CodingTheora',
305 prefix : extra_video_headers,
307 include_directories : [omx_inc])
309 cdata.set('HAVE_THEORA', 1)
312 have_omx_hevc = cc.has_header_symbol(
314 'OMX_VIDEO_CodingHEVC',
315 prefix : extra_video_headers,
317 include_directories : [omx_inc])
319 cdata.set('HAVE_HEVC', 1)
323 cdata.set ('HAVE_GST_GL', 1)
327 cdata.set ('HAVE_X11', 1)
330 omx_struct_packing = get_option ('struct_packing').to_int()
331 if omx_struct_packing == 0
332 omx_struct_packing = default_omx_struct_packing
334 if omx_struct_packing != 0
335 cdata.set('GST_OMX_STRUCT_PACKING', omx_struct_packing)
338 omx_conf_dir = join_paths (get_option ('prefix'), get_option ('sysconfdir'), 'xdg')
339 cdata.set_quoted('GST_OMX_CONFIG_DIR', omx_conf_dir)
342 '-Wmissing-declarations',
346 '-Wmissing-include-dirs',
354 '-Wmissing-prototypes',
355 '-Wold-style-definition',
356 '-Waggregate-return',
359 have_cxx = add_languages('cpp', required : false)
362 cxx = meson.get_compiler('cpp')
365 foreach extra_arg : warning_flags
366 if cc.has_argument (extra_arg)
367 add_project_arguments([extra_arg], language: 'c')
369 if have_cxx and cxx.has_argument (extra_arg)
370 add_project_arguments([extra_arg], language: 'cpp')
374 foreach extra_arg : warning_c_flags
375 if cc.has_argument (extra_arg)
376 add_project_arguments([extra_arg], language: 'c')
380 # Disable compiler warnings for unused variables and args if gst debug system is disabled
381 if gst_dep.type_name() == 'internal'
382 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
384 # We can't check that in the case of subprojects as we won't
385 # be able to build against an internal dependency (which is not built yet)
386 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
389 if gst_debug_disabled
390 message('GStreamer debug system is disabled')
391 if cc.has_argument('-Wno-unused')
392 add_project_arguments('-Wno-unused', language: 'c')
394 if have_cxx and cxx.has_argument ('-Wno-unused')
395 add_project_arguments('-Wno-unused', language: 'cpp')
398 message('GStreamer debug system is enabled')
403 if not get_option('examples').disabled()
409 if not get_option('tools').disabled()
413 if not get_option('tests').disabled() and gstcheck_dep.found()
419 if gst_version_nano == 0
420 extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
421 run_result = run_command(extract_release_date, gst_version, files('gst-omx.doap'), check: true)
422 release_date = run_result.stdout().strip()
423 cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
424 message('Package release date: ' + release_date)
427 configure_file(output: 'config.h', configuration: cdata)