From patchwork Thu Nov 30 14:25:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19250 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 1B851C32B5 for ; Thu, 30 Nov 2023 14:25:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2ECFD629C2; Thu, 30 Nov 2023 15:25:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1701354345; bh=fMpws5UIx7BYKu/3NzHLaLEyUquyAuud/to7nZFElPc=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Frw4pot4HBsgdGPndmw8CYKZfvToPnSIduXWPzOmlFLa5ji/XBwCrSpsmsWL7zkBk EcoAYi1AZFunAHx6k2iUKZ2xURWBFKVXA5myaeMDfw2PXG8/TeqFu9XdqtfweifZz5 vHBa9yoEViuG09hwPTRdwPE9umWznl9G64UHBK4Pc67BKjAJNK6bnXuOR36ErK6Il4 jW2dVjfa0Lo5j968MT0CKUqnWkhl+7IQnnw6DGhCcfeYojsEZFfG0atMvs0IkaBOwg ekvL5TKNC2BlVPB+H+PyX2bDI8Yle59TqPb7PeMjE2FXNXwQwtLGOe/+1W89FhJwpf GRQLiS92CywEA== Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D6ED629C2 for ; Thu, 30 Nov 2023 15:25:43 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Q3swp61b"; dkim-atps=neutral Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a18f732dc83so83227666b.1 for ; Thu, 30 Nov 2023 06:25:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1701354343; x=1701959143; 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=5b5WNA8sbB0SjEir0c+PWNwpUQepvRCeAHvgloft+lQ=; b=Q3swp61bu/Z5O+Q4GLhcMBFKVGF2AzL72Ybww7DD+gTitcY9BfG0UydqzC17axoWqi DUldaoIVW6nKiHo/maK0Zb6fubUGJwdP3rRTE99R4tAhEDTnKvev5cOAL/ZzeCL9B18Y mFS1yZaOljEXBKT1UiZpz6jVgn8Y4tMtqbfrc4zbNCcx7W9Yo4JOks/zIHCQECv8mjtx ac3R7ok0xZzkONiFDDDvpZv4Pkr590AhTvKDMdr14Irtyr12lz7D2603HOTU0Ef9gYSy 8LZYZo9Q3cHJHBUp0iXuv78N+KPkz4ebGd0VHUCE483ewGjADAWaVnWIOvuZcD4KeNYM H3dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701354343; x=1701959143; 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=5b5WNA8sbB0SjEir0c+PWNwpUQepvRCeAHvgloft+lQ=; b=wFHacr/tiS3+UWraDqaNcK6QH1gkRtQYrYTOvu5byvGij0GqDI7kUyZ5lcPGdYGZ5L LPHF+smnaGV/w4CFlCefuMbRFA0lWw09ezxMB+05heW7Z74qzT0i8TaVsekfOvQyZXWZ 9cJvwBmM4Mjbboc0kmgwQ+Zm8rakX6iaHdB8xvVEqi+Y5Ktz54Llv1jnJ6lE7Ndu9fKE nbF7rF/taz8SxSeUKEi9B1wL0zqYnI4y47T8Dc8Ocsnjz/PWGDgkiyeTqEKavMtx9RLo 6BTg4uPtBo2i/dTTX3her1FUXvmsgqv87KiUhgcvDuH2LyTqsdcSGXrf1KQJTMXaCjZ0 hMVg== X-Gm-Message-State: AOJu0YyzjicwWLxJ7+Z4tGAQ5Id11PtJZuRYYiZWMjHVc7eVmGZX7r68 MgR/paDycHKielK6eG1oEozLVRjlriJOjblSOkiTVA== X-Google-Smtp-Source: AGHT+IEkKp0dYo/dc+H/8/fp1fzi62esKp6xEmZxPcwU3m0bjac9nLkO5dTas9+hILONfBaVs0VXPA== X-Received: by 2002:a17:906:220b:b0:a0e:3ba4:4eac with SMTP id s11-20020a170906220b00b00a0e3ba44eacmr14143011ejs.27.1701354342732; Thu, 30 Nov 2023 06:25:42 -0800 (PST) Received: from localhost.localdomain ([88.97.53.79]) by smtp.gmail.com with ESMTPSA id a5-20020a17090640c500b009e50ea0a05asm725577ejk.99.2023.11.30.06.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:25:42 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Nov 2023 14:25:30 +0000 Message-Id: <20231130142534.2075-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231130142534.2075-1-naush@raspberrypi.com> References: <20231130142534.2075-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/6] 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 Cc: Jacopo Mondi 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 c1172cb26e7b..56e0c7ba98f2 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -340,10 +340,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:])