meson: use include_directories() with external OMX headers path

It seems cleaner to use the proper meson tools to include this path
rather than manually tweak the build flags.

This also allows us to simplify the OMX extensions detection code. We
are now always checking which files are present, even when using our
internal copy of OMX, rather than hardcoding the ones present in it.

https://bugzilla.gnome.org/show_bug.cgi?id=792043
This commit is contained in:
Guillaume Desmottes 2018-01-30 10:31:03 +01:00 committed by Nicolas Dufresne
parent 6c57d06ee1
commit 9d37a92a61
3 changed files with 26 additions and 39 deletions

View file

@ -169,7 +169,9 @@ gst_omx_args = ['-DHAVE_CONFIG_H']
configinc = include_directories('.') configinc = include_directories('.')
omx_header_path = get_option('with_omx_header_path') omx_header_path = get_option('with_omx_header_path')
if omx_header_path != '' if omx_header_path != ''
gst_omx_args += ['-I' + omx_header_path] omx_inc = include_directories (omx_header_path)
else
omx_inc = include_directories (join_paths ('omx', 'openmax'))
endif endif
default_omx_struct_packing = 0 default_omx_struct_packing = 0
@ -204,6 +206,7 @@ elif omx_target == 'zynqultrascaleplus'
have_allegro_header = cc.has_header ( have_allegro_header = cc.has_header (
'OMX_Allegro.h', 'OMX_Allegro.h',
args : gst_omx_args, args : gst_omx_args,
include_directories : [omx_inc],
required : false) required : false)
if not have_allegro_header if not have_allegro_header
error ('Need Allegro OMX headers to build for Zynq UltraScale+. Use with_omx_header_path option to specify the path of those headers.') error ('Need Allegro OMX headers to build for Zynq UltraScale+. Use with_omx_header_path option to specify the path of those headers.')
@ -218,46 +221,32 @@ else
error ('Unsupported omx target specified. Use the -Dwith_omx_target option') error ('Unsupported omx target specified. Use the -Dwith_omx_target option')
endif endif
have_external_omx = cc.has_header(
'OMX_Core.h',
args : gst_omx_args,
required : false)
extra_video_headers = '' extra_video_headers = ''
# Our internal OpenMAX IL headers have OMX_VideoExt.h, OMX_IndexExt.h and OMX_ComponentExt.h # Check for optional OpenMAX extension headers
have_video_ext = true
have_index_ext = true
have_component_ext = true
if have_external_omx if cc.has_header (
have_video_ext = cc.has_header ( 'OMX_VideoExt.h',
'OMX_VideoExt.h', args : gst_omx_args,
args : gst_omx_args, include_directories : [omx_inc],
required : false) required : false)
if have_video_ext extra_video_headers += '''
extra_video_headers += '''
#include <OMX_VideoExt.h>''' #include <OMX_VideoExt.h>'''
endif
have_index_ext = cc.has_header (
'OMX_IndexExt.h',
args : gst_omx_args,
required : false)
have_component_ext = cc.has_header (
'OMX_ComponentExt.h',
args : gst_omx_args,
required : false)
endif
if have_video_ext
cdata.set ('HAVE_VIDEO_EXT', 1) cdata.set ('HAVE_VIDEO_EXT', 1)
endif endif
if have_index_ext if cc.has_header (
'OMX_IndexExt.h',
args : gst_omx_args,
include_directories : [omx_inc],
required : false)
cdata.set ('HAVE_INDEX_EXT', 1) cdata.set ('HAVE_INDEX_EXT', 1)
endif endif
if have_component_ext if cc.has_header (
'OMX_ComponentExt.h',
args : gst_omx_args,
include_directories : [omx_inc],
required : false)
cdata.set ('HAVE_COMPONENT_EXT', 1) cdata.set ('HAVE_COMPONENT_EXT', 1)
endif endif
@ -266,6 +255,7 @@ have_omx_vp8 = cc.has_header_symbol(
'OMX_VIDEO_CodingVP8', 'OMX_VIDEO_CodingVP8',
prefix : extra_video_headers, prefix : extra_video_headers,
args : gst_omx_args, args : gst_omx_args,
include_directories : [omx_inc],
required : false) required : false)
if have_omx_vp8 if have_omx_vp8
cdata.set('HAVE_VP8', 1) cdata.set('HAVE_VP8', 1)
@ -276,6 +266,7 @@ have_omx_theora = cc.has_header_symbol(
'OMX_VIDEO_CodingTheora', 'OMX_VIDEO_CodingTheora',
prefix : extra_video_headers, prefix : extra_video_headers,
args : gst_omx_args, args : gst_omx_args,
include_directories : [omx_inc],
required : false) required : false)
if have_omx_theora if have_omx_theora
cdata.set('HAVE_THEORA', 1) cdata.set('HAVE_THEORA', 1)
@ -286,6 +277,7 @@ have_omx_hevc = cc.has_header_symbol(
'OMX_VIDEO_CodingHEVC', 'OMX_VIDEO_CodingHEVC',
prefix : extra_video_headers, prefix : extra_video_headers,
args : gst_omx_args, args : gst_omx_args,
include_directories : [omx_inc],
required : false) required : false)
if have_omx_hevc if have_omx_hevc
cdata.set('HAVE_HEVC', 1) cdata.set('HAVE_HEVC', 1)

View file

@ -26,7 +26,6 @@ omx_sources = [
'gstomxmp3enc.c', 'gstomxmp3enc.c',
] ]
extra_inc = []
extra_c_args = [] extra_c_args = []
if have_omx_vp8 if have_omx_vp8
@ -43,10 +42,6 @@ if have_omx_hevc
omx_sources += 'gstomxh265dec.c' omx_sources += 'gstomxh265dec.c'
endif endif
if not have_external_omx
extra_inc += include_directories ('openmax')
endif
optional_deps = [] optional_deps = []
if gstgl_dep.found() if gstgl_dep.found()
optional_deps += gstgl_dep optional_deps += gstgl_dep
@ -57,7 +52,7 @@ gstomx = library('gstomx',
omx_sources, omx_sources,
c_args : gst_omx_args + extra_c_args, c_args : gst_omx_args + extra_c_args,
# link_args : noseh_link_args, # link_args : noseh_link_args,
include_directories : [configinc] + extra_inc, include_directories : [configinc, omx_inc],
dependencies : [gstvideo_dep, gstaudio_dep, gstbase_dep, gstcontroller_dep, dependencies : [gstvideo_dep, gstaudio_dep, gstbase_dep, gstcontroller_dep,
libm, gmodule_dep, gstallocators_dep] + optional_deps, libm, gmodule_dep, gstallocators_dep] + optional_deps,
install : true, install : true,

View file

@ -1,7 +1,7 @@
executable('listcomponents', executable('listcomponents',
'listcomponents.c', 'listcomponents.c',
install: false, install: false,
include_directories : [configinc] + extra_inc, include_directories : [configinc, omx_inc],
dependencies : [glib_dep, gmodule_dep], dependencies : [glib_dep, gmodule_dep],
link_with: [], link_with: [],
c_args : gst_omx_args + extra_c_args, c_args : gst_omx_args + extra_c_args,