utils: ipc: Allow the skipHeader attribute on enums

Currently, enums that are passed between pipeline handlers and their IPA
must be defined in a mojom file. However, there is a use case for
enum/flags to be defined in a C++ header, such that the enum can be used
in a component other than the pipeline handler and its IPA.

To support this, add support for the skipHeader attribute for enums.
Like structs, it is only allowed in core.mojom.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Paul Elder 2022-08-26 11:50:55 -05:00
parent 3b54b56a2d
commit 4e9ed14311
4 changed files with 8 additions and 6 deletions

View file

@ -26,7 +26,7 @@ namespace libcamera {
static const {{const.kind|name}} {{const.mojom_name}} = {{const.value}};
{% endfor %}
{% for enum in enums %}
{% for enum in enums_gen_header %}
{{funcs.define_enum(enum)}}
{% endfor %}

View file

@ -483,7 +483,7 @@ class Generator(generator.Generator):
def _GetJinjaExportsForCore(self):
return {
'consts': self.module.constants,
'enums': self.module.enums,
'enums_gen_header': [x for x in self.module.enums if x.attributes is None or 'skipHeader' not in x.attributes],
'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,
'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,
'structs_gen_header': [x for x in self.module.structs if x.attributes is None or 'skipHeader' not in x.attributes],