From patchwork Fri Aug 9 00:59:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20856 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 36765BE173 for ; Fri, 9 Aug 2024 00:59:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD74A633C1; Fri, 9 Aug 2024 02:59:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mT/AcNKw"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CCE38633BD for ; Fri, 9 Aug 2024 02:59:47 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CF93E83F for ; Fri, 9 Aug 2024 02:58:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1723165134; bh=9MzqF6BTpYdwHomjvD1Dc0CQb9pfsvcCpV6mhVdvlew=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mT/AcNKwUdA7sxvD1iCb4HWFUx1KFr19Aq8rAkWQIyGLocLlTmlp9zemfc//5C6ff Tzcstxi5N8y7ObSwKt8pnE95w+cyRo8kuR5CfQAR1THMuJD+YXAWmKMIfu48pPfmnU s4TIO+YSAHvlpWkFi3/UWgQvUVmQgeZRBbKg4wmI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 06/10] utils: codegen: gen-header.sh: Generate libcamera.h based on meson.build Date: Fri, 9 Aug 2024 03:59:10 +0300 Message-ID: <20240809005914.20662-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240809005914.20662-1-laurent.pinchart@ideasonboard.com> References: <20240809005914.20662-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The libcamera.h header is a top-level library header that contains every other libcamera header. It is currently generated by listing the files in include/libcamera/ and dropping the .in suffix from template files. This assumes a 1:1 mapping between generate header file names and the name of their templates. Drop that assumption and make the libcamera.h generation based on the libcamera public headers listed in meson.build. This makes the libcamera.h header generation more future-proof. Signed-off-by: Laurent Pinchart Reviewed-by: Daniel Scally Reviewed-by: Paul Elder --- include/libcamera/meson.build | 20 ++++++++++---------- utils/codegen/gen-header.sh | 7 +++---- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 36de1c2a393c..87b9a9412fe7 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -107,16 +107,6 @@ formats_h = custom_target('formats_h', install_dir : libcamera_headers_install_dir) libcamera_public_headers += formats_h -# libcamera.h -libcamera_h = custom_target('gen-header', - input : 'meson.build', - output : 'libcamera.h', - command : [gen_header, meson.current_source_dir(), '@OUTPUT@'], - install : true, - install_dir : libcamera_headers_install_dir) - -libcamera_public_headers += libcamera_h - # version.h version = libcamera_version.split('.') libcamera_version_config = configuration_data() @@ -129,3 +119,13 @@ version_h = configure_file(input : 'version.h.in', configuration : libcamera_version_config, install_dir : libcamera_headers_install_dir) libcamera_public_headers += version_h + +# libcamera.h +libcamera_h = custom_target('gen-header', + input : 'meson.build', + output : 'libcamera.h', + command : [gen_header, '@OUTPUT@', libcamera_public_headers], + install : true, + install_dir : libcamera_headers_install_dir) + +libcamera_public_headers += libcamera_h diff --git a/utils/codegen/gen-header.sh b/utils/codegen/gen-header.sh index d4692758eeb4..c78f085992ef 100755 --- a/utils/codegen/gen-header.sh +++ b/utils/codegen/gen-header.sh @@ -1,7 +1,7 @@ #!/bin/sh -src_dir="$1" -dst_file="$2" +dst_file="$1" +shift cat < "$dst_file" /* SPDX-License-Identifier: LGPL-2.1-or-later */ @@ -16,9 +16,8 @@ cat < "$dst_file" EOF -headers=$(for header in "$src_dir"/*.h "$src_dir"/*.h.in ; do +headers=$(for header in "$@" ; do header=$(basename "$header") - header="${header%.in}" echo "$header" done | sort)