build: controls: Rework how controls and properties are generated

Add support for using separate YAML files for controls and properties
generation. The mapping of vendor/pipeline handler to control file is
done through the controls_map variable in include/libcamera/meson.build.

This simplifies management of vendor control definitions and avoids
possible merge conflicts when changing the control_ids.yaml file for
core and draft controls. With this change, libcamera and draft controls
and properties files are designated the 'libcamera' vendor tag.

In this change, we also rename control_ids.yaml -> control_ids_core.yaml
and property_ids.yaml -> property_ids_core.yaml to designate these as
core libcamera controls.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2023-11-08 13:44:20 +00:00
parent bba4ec63c4
commit 0455bbbf51
9 changed files with 87 additions and 30 deletions

View file

@ -32,22 +32,54 @@ install_headers(libcamera_public_headers,
libcamera_headers_install_dir = get_option('includedir') / libcamera_include_dir
# control_ids.h and property_ids.h and associated modes
control_source_files = {
'control_ids': 'controls',
'property_ids': 'properties',
controls_map = {
'controls': {
'core': 'control_ids_core.yaml',
},
'properties': {
'core': 'property_ids_core.yaml',
}
}
control_headers = []
controls_files = []
properties_files = []
foreach header, mode : control_source_files
input_files = files('../../src/libcamera/' + header +'.yaml')
template_file = files(header + '.h.in')
foreach mode, entry : controls_map
files_list = []
input_files = []
foreach vendor, header : entry
if vendor != 'core' and vendor != 'draft'
if vendor not in pipelines
continue
endif
endif
if header in files_list
continue
endif
files_list += header
input_files += files('../../src/libcamera/' + header)
endforeach
outfile = ''
if mode == 'controls'
outfile = 'control_ids.h'
controls_files += files_list
else
outfile = 'property_ids.h'
properties_files += files_list
endif
template_file = files(outfile + '.in')
control_headers += custom_target(header + '_h',
input : input_files,
output : header + '.h',
output : outfile,
command : [gen_controls, '-o', '@OUTPUT@',
'--mode', mode, '-t', template_file, '@INPUT@'],
'--mode', mode, '-t', template_file,
'@INPUT@'],
install : true,
install_dir : libcamera_headers_install_dir)
endforeach