controls: Update argument handling for controls generation scripts
The template file to the gen-controls.py and gen-py-controls.py is now passed in through the '-t' or '--template' command line argument instead of being a positional argument. This will allow multiple input files to be provided to the scripts in a future commit. 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:
parent
bd6658943a
commit
bba4ec63c4
5 changed files with 20 additions and 20 deletions
|
@ -41,12 +41,13 @@ control_source_files = {
|
||||||
control_headers = []
|
control_headers = []
|
||||||
|
|
||||||
foreach header, mode : control_source_files
|
foreach header, mode : control_source_files
|
||||||
input_files = files('../../src/libcamera/' + header +'.yaml', header + '.h.in')
|
input_files = files('../../src/libcamera/' + header +'.yaml')
|
||||||
|
template_file = files(header + '.h.in')
|
||||||
control_headers += custom_target(header + '_h',
|
control_headers += custom_target(header + '_h',
|
||||||
input : input_files,
|
input : input_files,
|
||||||
output : header + '.h',
|
output : header + '.h',
|
||||||
command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@',
|
command : [gen_controls, '-o', '@OUTPUT@',
|
||||||
'--mode', mode],
|
'--mode', mode, '-t', template_file, '@INPUT@'],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : libcamera_headers_install_dir)
|
install_dir : libcamera_headers_install_dir)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
|
@ -128,12 +128,13 @@ endif
|
||||||
control_sources = []
|
control_sources = []
|
||||||
|
|
||||||
foreach source, mode : control_source_files
|
foreach source, mode : control_source_files
|
||||||
input_files = files(source +'.yaml', source + '.cpp.in')
|
input_files = files(source +'.yaml')
|
||||||
|
template_file = files(source + '.cpp.in')
|
||||||
control_sources += custom_target(source + '_cpp',
|
control_sources += custom_target(source + '_cpp',
|
||||||
input : input_files,
|
input : input_files,
|
||||||
output : source + '.cpp',
|
output : source + '.cpp',
|
||||||
command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@',
|
command : [gen_controls, '-o', '@OUTPUT@',
|
||||||
'--mode', mode])
|
'--mode', mode, '-t', template_file, '@INPUT@'])
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
libcamera_sources += control_sources
|
libcamera_sources += control_sources
|
||||||
|
|
|
@ -93,10 +93,10 @@ def main(argv):
|
||||||
help='Mode is either "controls" or "properties"')
|
help='Mode is either "controls" or "properties"')
|
||||||
parser.add_argument('--output', '-o', metavar='file', type=str,
|
parser.add_argument('--output', '-o', metavar='file', type=str,
|
||||||
help='Output file name. Defaults to standard output if not specified.')
|
help='Output file name. Defaults to standard output if not specified.')
|
||||||
|
parser.add_argument('--template', '-t', type=str, required=True,
|
||||||
|
help='Template file name.')
|
||||||
parser.add_argument('input', type=str,
|
parser.add_argument('input', type=str,
|
||||||
help='Input file name.')
|
help='Input file name.')
|
||||||
parser.add_argument('template', type=str,
|
|
||||||
help='Template file name.')
|
|
||||||
args = parser.parse_args(argv[1:])
|
args = parser.parse_args(argv[1:])
|
||||||
|
|
||||||
if args.mode not in ['controls', 'properties']:
|
if args.mode not in ['controls', 'properties']:
|
||||||
|
|
|
@ -28,29 +28,27 @@ pycamera_sources = files([
|
||||||
|
|
||||||
# Generate controls
|
# Generate controls
|
||||||
|
|
||||||
gen_py_controls_input_files = files([
|
gen_py_controls_input_files = files('../../libcamera/control_ids.yaml')
|
||||||
'../../libcamera/control_ids.yaml',
|
gen_py_controls_template = files('py_controls_generated.cpp.in')
|
||||||
'py_controls_generated.cpp.in',
|
|
||||||
])
|
|
||||||
|
|
||||||
gen_py_controls = files('gen-py-controls.py')
|
gen_py_controls = files('gen-py-controls.py')
|
||||||
|
|
||||||
pycamera_sources += custom_target('py_gen_controls',
|
pycamera_sources += custom_target('py_gen_controls',
|
||||||
input : gen_py_controls_input_files,
|
input : gen_py_controls_input_files,
|
||||||
output : ['py_controls_generated.cpp'],
|
output : ['py_controls_generated.cpp'],
|
||||||
command : [gen_py_controls, '--mode', 'controls', '-o', '@OUTPUT@', '@INPUT@'])
|
command : [gen_py_controls, '--mode', 'controls', '-o', '@OUTPUT@',
|
||||||
|
'-t', gen_py_controls_template, '@INPUT@'])
|
||||||
|
|
||||||
# Generate properties
|
# Generate properties
|
||||||
|
|
||||||
gen_py_property_enums_input_files = files([
|
gen_py_property_enums_input_files = files('../../libcamera/property_ids.yaml')
|
||||||
'../../libcamera/property_ids.yaml',
|
gen_py_properties_template = files('py_properties_generated.cpp.in')
|
||||||
'py_properties_generated.cpp.in',
|
|
||||||
])
|
|
||||||
|
|
||||||
pycamera_sources += custom_target('py_gen_properties',
|
pycamera_sources += custom_target('py_gen_properties',
|
||||||
input : gen_py_property_enums_input_files,
|
input : gen_py_property_enums_input_files,
|
||||||
output : ['py_properties_generated.cpp'],
|
output : ['py_properties_generated.cpp'],
|
||||||
command : [gen_py_controls, '--mode', 'properties', '-o', '@OUTPUT@', '@INPUT@'])
|
command : [gen_py_controls, '--mode', 'properties', '-o', '@OUTPUT@',
|
||||||
|
'-t', gen_py_properties_template, '@INPUT@'])
|
||||||
|
|
||||||
# Generate formats
|
# Generate formats
|
||||||
|
|
||||||
|
|
|
@ -340,10 +340,10 @@ def main(argv):
|
||||||
help='Mode of operation')
|
help='Mode of operation')
|
||||||
parser.add_argument('--output', '-o', metavar='file', type=str,
|
parser.add_argument('--output', '-o', metavar='file', type=str,
|
||||||
help='Output file name. Defaults to standard output if not specified.')
|
help='Output file name. Defaults to standard output if not specified.')
|
||||||
|
parser.add_argument('--template', '-t', dest='template', type=str, required=True,
|
||||||
|
help='Template file name.')
|
||||||
parser.add_argument('input', type=str,
|
parser.add_argument('input', type=str,
|
||||||
help='Input file name.')
|
help='Input file name.')
|
||||||
parser.add_argument('template', type=str,
|
|
||||||
help='Template file name.')
|
|
||||||
|
|
||||||
args = parser.parse_args(argv[1:])
|
args = parser.parse_args(argv[1:])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue