From patchwork Tue May 21 16:45:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1242 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7922060C27 for ; Tue, 21 May 2019 18:46:00 +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 EF99D52C for ; Tue, 21 May 2019 18:45:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558457160; bh=MeDZVV0J/CKYNMvNqRVNUZoYDjkPncsaQF7SPbZ/oS8=; h=From:To:Subject:Date:From; b=iPZkieY+TANIzDaUTyIYKO6lJJqy81TE6f4EThBvo7VMw5fLY1+laNykIgfTA8yJs lW3z4pgkDgosmWZL5GjXzmgHRO1pG6BbRqqIdbkeFtu1zTVn19/uZEHl1tO+girM4m yM7RrDeLl1i+rj5a1/Ycyt679EOnuLyYY3mHrkjI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 21 May 2019 19:45:36 +0300 Message-Id: <20190521164536.20920-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] 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: Tue, 21 May 2019 16:46:00 -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 Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- include/libcamera/gen-header.sh | 26 ++++++++++++++++++++++++++ include/libcamera/libcamera.h | 20 -------------------- include/libcamera/meson.build | 10 +++++++++- 3 files changed, 35 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..ea5b79a62520 --- /dev/null +++ b/include/libcamera/gen-header.sh @@ -0,0 +1,26 @@ +#!/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, Google Inc. + * + * libcamera.h - libcamera public API + */ +#ifndef __LIBCAMERA_LIBCAMERA_H__ +#define __LIBCAMERA_LIBCAMERA_H__ + +EOF + +for header in $src_dir/*.h ; do + 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 83d226ac5078..46aff0b6bc2f 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -5,7 +5,6 @@ libcamera_api = files([ 'event_dispatcher.h', 'event_notifier.h', 'geometry.h', - 'libcamera.h', 'object.h', 'request.h', 'signal.h', @@ -13,5 +12,14 @@ libcamera_api = files([ 'timer.h', ]) +gen_header = join_paths(meson.current_source_dir(), 'gen-header.sh') + +custom_target('gen-header', + input: meson.current_source_dir(), + output: 'libcamera.h', + command: [gen_header, '@INPUT@', '@OUTPUT@'], + install: true, + install_dir: 'include/libcamera') + install_headers(libcamera_api, subdir : 'libcamera')