From patchwork Fri Nov 24 12:37:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19235 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 25BF6C328F for ; Fri, 24 Nov 2023 12:37:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0E957629C5; Fri, 24 Nov 2023 13:37:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1700829441; bh=ehngwBkfs7R+bPnNwIVw1bFA5d7Nf3Z/b0qPu2pWLyo=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=U/hb5FoMt08YKW4ALXSG+35kfOOHCx5ZJjxJH2VrDDiN5/mrhG9E4SCA0thK/a4k8 16/EzN+AZ91Bk2LPnisnQR5sOzS9ovWtClWlPLi/eo/N5ltdve1+Vv7h03s5wibRj7 99qZJUyFW8iA+klBCtw9CXJHtnesRI64SPcr2+4f5dcBz30ENa98KqOXJhCeseoCiC DW2SoSuMSBHsYXahEqIrvhmwSqySQDFO+RYRByVZbcpWIt5+HI9vf8/ZY1nw5BgvVO 61SzdpZX80wwuQqPgSrXcycGo6i/tVdxQXCqsOo7XRyufMM6ZAGCa+0T74KMTxmK0I eSUmWWOPdWTAQ== Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 61D4F629B6 for ; Fri, 24 Nov 2023 13:37:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="o5O2RKjF"; dkim-atps=neutral Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40b358f216dso12065605e9.1 for ; Fri, 24 Nov 2023 04:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1700829437; x=1701434237; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9RwY5vd7zi9A8JwMNsB0WJPcBdyXlwV+lPLOwLdH5O0=; b=o5O2RKjFKpQuRtp9rAGbqCTtGugfUjmPH4AuSI+5rrnY63yKKpGXips/GPWBgl9pEM FSbUMGi8YwQV8esuudp6xBq/GJFj7PY0CcQ2+zrQxvsG0iozCzt1D/eEvSLiDOLKDbF+ MLkWFnxSO1JCFWBiKECPzKWW3NEuS7t385zqscD3Nw0fEgdbVLV9e8NWlzVBcdMP+Bd5 UXbtdT3cd4VvDGz4SfXLx3u6HGOfuu1LyZjPGkBTII6/k8vvViTDRpxSVZsOh9q0TbQx Q3FMVtWHsktp95/Ewx//mx80gcd/UKz5kgzu7FN+y/q7Tz2iUoCs0SRL5KaL7Q34JRWD qpZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700829437; x=1701434237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9RwY5vd7zi9A8JwMNsB0WJPcBdyXlwV+lPLOwLdH5O0=; b=vJmacJsCuF8dSKFUG2R/iuTwqDlWPAFm+Cqblrflz4iKex78WjvCYGyqPPzsieCkyC DgsfR5CoFO30oHXP5tMG1Yl0saEVK+/X5VjRLJapxeDaT/OULJj8fNEfsXMZZRSZugyS Tav9T2Mz3VmTWsjLmre5jEcS7RjFPlRCRfzni41zVI19Kp9mw5sBQ7i3DwSGmIEw3joM DZA+HKSl4Ru+QXv06vEH7/wAqCVtRoti+D469skIHNGHqd+BZxGLfcXa+yVhnDXQ2y2U ts9mHTuXa4UCBENJij8yGtDRx0dmyPA/Mfd/jmqFU4IL/uQKzZLj2PzcTCYXUMun/7aK g8oQ== X-Gm-Message-State: AOJu0Yx2TmVSS33lD3dn+rSzCkW1jX5s22KfaT6p2WUQvjT7pccSwQ/Y iVXShqYVY5SU52kUjHra6xLSL3kOJmHe0MI5kNcrgw== X-Google-Smtp-Source: AGHT+IGPOA49crTnC5DmcbdxMW7rZzCPdcitwvem7Vbs4JKfh6C5s69WEu9wkU8MMaKsRcWTTfSDow== X-Received: by 2002:a05:600c:2614:b0:408:3ea0:3026 with SMTP id h20-20020a05600c261400b004083ea03026mr2322994wma.11.1700829437600; Fri, 24 Nov 2023 04:37:17 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id v11-20020a05600c444b00b0040b3867a297sm3303690wmn.36.2023.11.24.04.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 04:37:16 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Nov 2023 12:37:08 +0000 Message-Id: <20231124123713.22519-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231124123713.22519-1-naush@raspberrypi.com> References: <20231124123713.22519-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/7] controls: Update argument handling for controls generation scripts X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- include/libcamera/meson.build | 7 ++++--- src/libcamera/meson.build | 7 ++++--- src/py/libcamera/gen-py-controls.py | 4 ++-- src/py/libcamera/meson.build | 18 ++++++++---------- utils/gen-controls.py | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 2c8c0258c95e..5fb772e6dd14 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -41,12 +41,13 @@ control_source_files = { control_headers = [] 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', input : input_files, output : header + '.h', - command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@', - '--mode', mode], + command : [gen_controls, '-o', '@OUTPUT@', + '--mode', mode, '-t', template_file, '@INPUT@'], install : true, install_dir : libcamera_headers_install_dir) endforeach diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index e49bf850b355..05ee38daf22b 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -128,12 +128,13 @@ endif control_sources = [] 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', input : input_files, output : source + '.cpp', - command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@', - '--mode', mode]) + command : [gen_controls, '-o', '@OUTPUT@', + '--mode', mode, '-t', template_file, '@INPUT@']) endforeach libcamera_sources += control_sources diff --git a/src/py/libcamera/gen-py-controls.py b/src/py/libcamera/gen-py-controls.py index dfd7c179a883..cfcfd4d16acf 100755 --- a/src/py/libcamera/gen-py-controls.py +++ b/src/py/libcamera/gen-py-controls.py @@ -93,10 +93,10 @@ def main(argv): help='Mode is either "controls" or "properties"') parser.add_argument('--output', '-o', metavar='file', type=str, 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, help='Input file name.') - parser.add_argument('template', type=str, - help='Template file name.') args = parser.parse_args(argv[1:]) if args.mode not in ['controls', 'properties']: diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build index f58c7198ee9e..1c3ea1843ac0 100644 --- a/src/py/libcamera/meson.build +++ b/src/py/libcamera/meson.build @@ -28,29 +28,27 @@ pycamera_sources = files([ # Generate controls -gen_py_controls_input_files = files([ - '../../libcamera/control_ids.yaml', - 'py_controls_generated.cpp.in', -]) +gen_py_controls_input_files = files('../../libcamera/control_ids.yaml') +gen_py_controls_template = files('py_controls_generated.cpp.in') gen_py_controls = files('gen-py-controls.py') pycamera_sources += custom_target('py_gen_controls', input : gen_py_controls_input_files, 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 -gen_py_property_enums_input_files = files([ - '../../libcamera/property_ids.yaml', - 'py_properties_generated.cpp.in', -]) +gen_py_property_enums_input_files = files('../../libcamera/property_ids.yaml') +gen_py_properties_template = files('py_properties_generated.cpp.in') pycamera_sources += custom_target('py_gen_properties', input : gen_py_property_enums_input_files, 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 diff --git a/utils/gen-controls.py b/utils/gen-controls.py index 4c8d41eb9997..6680ecf84acb 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -337,10 +337,10 @@ def main(argv): help='Mode of operation') parser.add_argument('--output', '-o', metavar='file', type=str, 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, help='Input file name.') - parser.add_argument('template', type=str, - help='Template file name.') args = parser.parse_args(argv[1:])