1 project('gst-omx', 'c',
3 meson_version : '>= 0.47',
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.40.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
20 tizil_req = '>= 0.1.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', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
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)
160 gio_dep = dependency('gio-2.0', version : glib_req)
161 gmodule_dep = dependency('gmodule-2.0', version : glib_req)
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 cdata.set('USE_OMX_TARGET_TIZONIA', 1)
211 tizil_dep = dependency('tizilheaders', version : tizil_req)
212 cdata.set('TIZONIA_LIBDIR', tizil_dep.get_pkgconfig_variable('libdir'))
213 tizil_includedir = tizil_dep.get_pkgconfig_variable('includedir')
214 gst_omx_args += ['-I' + tizil_includedir + '/tizonia']
216 error ('Unsupported omx target specified. Use the -Dtarget option')
219 extra_video_headers = ''
220 # Check for optional OpenMAX extension headers
225 include_directories : [omx_inc])
226 extra_video_headers += '''
227 #include <OMX_VideoExt.h>'''
228 cdata.set ('HAVE_VIDEO_EXT', 1)
234 include_directories : [omx_inc])
235 cdata.set ('HAVE_INDEX_EXT', 1)
239 'OMX_ComponentExt.h',
241 include_directories : [omx_inc])
242 cdata.set ('HAVE_COMPONENT_EXT', 1)
248 cdata.set ('HAVE_CORE_EXT', 1)
254 cdata.set ('HAVE_AUDIO_EXT', 1)
260 cdata.set ('HAVE_IV_COMMON_EXT', 1)
266 cdata.set ('HAVE_IMAGE_EXT', 1)
272 cdata.set ('HAVE_OTHER_EXT', 1)
275 have_omx_vp8 = cc.has_header_symbol(
277 'OMX_VIDEO_CodingVP8',
278 prefix : extra_video_headers,
280 include_directories : [omx_inc])
282 cdata.set('HAVE_VP8', 1)
285 have_omx_theora = cc.has_header_symbol(
287 'OMX_VIDEO_CodingTheora',
288 prefix : extra_video_headers,
290 include_directories : [omx_inc])
292 cdata.set('HAVE_THEORA', 1)
295 have_omx_hevc = cc.has_header_symbol(
297 'OMX_VIDEO_CodingHEVC',
298 prefix : extra_video_headers,
300 include_directories : [omx_inc])
302 cdata.set('HAVE_HEVC', 1)
306 cdata.set ('HAVE_GST_GL', 1)
310 cdata.set ('HAVE_X11', 1)
313 omx_struct_packing = get_option ('struct_packing').to_int()
314 if omx_struct_packing == 0
315 omx_struct_packing = default_omx_struct_packing
317 if omx_struct_packing != 0
318 cdata.set('GST_OMX_STRUCT_PACKING', omx_struct_packing)
321 omx_conf_dir = join_paths (get_option ('prefix'), get_option ('sysconfdir'), 'xdg')
322 cdata.set_quoted('GST_OMX_CONFIG_DIR', omx_conf_dir)
325 '-Wmissing-declarations',
329 '-Wmissing-include-dirs',
337 '-Wmissing-prototypes',
338 '-Wdeclaration-after-statement',
339 '-Wold-style-definition',
340 '-Waggregate-return',
343 have_cxx = add_languages('cpp', required : false)
346 cxx = meson.get_compiler('cpp')
349 foreach extra_arg : warning_flags
350 if cc.has_argument (extra_arg)
351 add_project_arguments([extra_arg], language: 'c')
353 if have_cxx and cxx.has_argument (extra_arg)
354 add_project_arguments([extra_arg], language: 'cpp')
358 foreach extra_arg : warning_c_flags
359 if cc.has_argument (extra_arg)
360 add_project_arguments([extra_arg], language: 'c')
364 # Disable compiler warnings for unused variables and args if gst debug system is disabled
365 if gst_dep.type_name() == 'internal'
366 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
368 # We can't check that in the case of subprojects as we won't
369 # be able to build against an internal dependency (which is not built yet)
370 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
373 if gst_debug_disabled
374 message('GStreamer debug system is disabled')
375 if cc.has_argument('-Wno-unused')
376 add_project_arguments('-Wno-unused', language: 'c')
378 if have_cxx and cxx.has_argument ('-Wno-unused')
379 add_project_arguments('-Wno-unused', language: 'cpp')
382 message('GStreamer debug system is enabled')
385 configure_file(output : 'config.h', configuration : cdata)
389 if not get_option('examples').disabled()
395 if not get_option('tools').disabled()
399 if not get_option('tests').disabled() and gstcheck_dep.found()
403 python3 = find_program('python3')
404 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')