From patchwork Wed May 22 16:17:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1254 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 780B260C02 for ; Wed, 22 May 2019 18:18:01 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 001E1443 for ; Wed, 22 May 2019 18:18:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558541881; bh=IEkITrgtbZ2GOQjLEYUZTBoliAXjhWnkU3sIw4X+U6I=; h=From:To:Subject:Date:From; b=WG127JOIEMXbM+DwWoVBZld/zX/TCP4iXZNs6wBWwyCAu0D7oGtZY2LSFzlDf0kEf wzdj5WxBkLljZf68WfZ1EXkiQjhH4ULPSL8GLtH5z8n7TKHpTEfGjvv2/bg+3/JQOO LIVchNpIeXqHD0T/ltMHCuCXiUsAGx0FxOwctscc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 22 May 2019 19:17:40 +0300 Message-Id: <20190522161740.24718-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] libcamera: Auto-generate libcamera.h X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 16:18:01 -0000 As shown by two missing includes, keeping the libcamera.h file in sync when adding or removing headers is an error-prone manual process. Automate it by generating the header automatically. Signed-off-by: Laurent Pinchart --- include/libcamera/gen-header.sh | 27 +++++++++++++++++++++++++++ include/libcamera/libcamera.h | 20 -------------------- include/libcamera/meson.build | 10 +++++++++- 3 files changed, 36 insertions(+), 21 deletions(-) create mode 100755 include/libcamera/gen-header.sh delete mode 100644 include/libcamera/libcamera.h diff --git a/include/libcamera/gen-header.sh b/include/libcamera/gen-header.sh new file mode 100755 index 000000000000..e171c08c20b8 --- /dev/null +++ b/include/libcamera/gen-header.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +src_dir="$1" +dst_file="$2" + +cat < "$dst_file" +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* This file is auto-generated, do not edit! */ +/* + * Copyright (C) 2018-2019, Google Inc. + * + * libcamera.h - libcamera public API + */ +#ifndef __LIBCAMERA_LIBCAMERA_H__ +#define __LIBCAMERA_LIBCAMERA_H__ + +EOF + +for header in "$src_dir"/*.h ; do + header=$(basename "$header") + echo "#include " >> "$dst_file" +done + +cat <> "$dst_file" + +#endif /* __LIBCAMERA_LIBCAMERA_H__ */ +EOF diff --git a/include/libcamera/libcamera.h b/include/libcamera/libcamera.h deleted file mode 100644 index dda576e906fb..000000000000 --- a/include/libcamera/libcamera.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2018, Google Inc. - * - * libcamera.h - libcamera public API - */ -#ifndef __LIBCAMERA_LIBCAMERA_H__ -#define __LIBCAMERA_LIBCAMERA_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* __LIBCAMERA_LIBCAMERA_H__ */ diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index cb64f0ca0f8b..8aa7043eb438 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -6,7 +6,6 @@ libcamera_api = files([ 'event_notifier.h', 'geometry.h', 'ipa/ipa_module_info.h', - 'libcamera.h', 'object.h', 'request.h', 'signal.h', @@ -14,5 +13,14 @@ libcamera_api = files([ 'timer.h', ]) +gen_header = join_paths(meson.current_source_dir(), 'gen-header.sh') + +custom_target('gen-header', + input: 'meson.build', + output: 'libcamera.h', + command: [gen_header, meson.current_source_dir(), '@OUTPUT@'], + install: true, + install_dir: 'include/libcamera') + install_headers(libcamera_api, subdir : 'libcamera')