From patchwork Wed Nov 9 16:36:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 17761 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 479FDBD16B for ; Wed, 9 Nov 2022 16:36:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A986863083; Wed, 9 Nov 2022 17:36:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668011787; bh=nIGq9KFof3RXYQNRMB/mECslxVfmPMIL7OiZ8xxzfaw=; h=Date:To:List-Id:List-Post:From:List-Subscribe:List-Unsubscribe: List-Archive:Reply-To:List-Help:Subject:From; b=FBVcB2lTpgpKKPx8IT9oKXsvWf0EARFOcBYaNhkv5rldxk4QkT28CZFlkCHYh4nY0 JQh4CevqCKc/t43ocR0NUgdP4JkDGmlTdT7Cr9P3NsEVZyMXTIwHNMHQcjo+x0n5ba ddl1fxnQhRE1ezvg7OkF8z8oHammwYoolKpGDpDFMN7lwJJ/27CIPbNI8jVh2p8uTn 99xpdk9PTY9AxvdoaDjlFb0Lwz+ygH2UoU0wCcWoHwFiGG3bRz3pAUvShxxsgjMBGV t2wF22izDJRNKzQMafResIuReMTN2dI5pzHPsyx2vkWWy/NB//dLNmNGPlNdzbVpUh 1BUh26eeKrLUA== Date: Wed, 09 Nov 2022 16:36:14 +0000 To: libcamera-devel@lists.libcamera.org MIME-Version: 1.0 Message-ID: List-Id: List-Post: X-Patchwork-Original-From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze_via_libcamera-devel?= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Precedence: list X-Mailman-Version: 2.1.29 X-BeenThere: libcamera-devel@lists.libcamera.org List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= List-Help: Subject: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header generation when built as subproject Content-Disposition: inline Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The previously used path = output.replace('include/', '', 1) logic is not sufficient to correctly determine the proper path when libcamera is built as a subproject. Fix it by using Python's pathlib to calculate the relative path of the output file with respect to the "include" directory of libcamera. Signed-off-by: Barnabás Pőcze Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- include/libcamera/internal/meson.build | 2 +- include/meson.build | 2 ++ utils/tracepoints/gen-tp-header.py | 13 +++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) -- 2.38.1 diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 7a780d48ee57..f8be86e040c5 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -6,7 +6,7 @@ libcamera_tracepoint_header = custom_target( 'tp_header', input: ['tracepoints.h.in', tracepoint_files], output: 'tracepoints.h', - command: [gen_tracepoints_header, '@OUTPUT@', '@INPUT@'], + command: [gen_tracepoints_header, include_build_dir, '@OUTPUT@', '@INPUT@'], ) libcamera_internal_headers = files([ diff --git a/include/meson.build b/include/meson.build index 27ce2f41c534..19b93a7bd753 100644 --- a/include/meson.build +++ b/include/meson.build @@ -1,4 +1,6 @@ # SPDX-License-Identifier: CC0-1.0 +include_build_dir = meson.current_build_dir() + subdir('android') subdir('libcamera') diff --git a/utils/tracepoints/gen-tp-header.py b/utils/tracepoints/gen-tp-header.py index bbd472d972d0..a454615e4625 100755 --- a/utils/tracepoints/gen-tp-header.py +++ b/utils/tracepoints/gen-tp-header.py @@ -8,22 +8,23 @@ import datetime import jinja2 +import pathlib import os import sys def main(argv): - if len(argv) < 3: - print(f'Usage: {argv[0]} output template tp_files...') + if len(argv) < 4: + print(f'Usage: {argv[0]} include_build_dir output template tp_files...') return 1 - output = argv[1] - template = argv[2] + output = argv[2] + template = argv[3] year = datetime.datetime.now().year - path = output.replace('include/', '', 1) + path = pathlib.Path(output).absolute().relative_to(argv[1]) source = '' - for fname in argv[3:]: + for fname in argv[4:]: source += open(fname, 'r', encoding='utf-8').read() + '\n\n' template = jinja2.Template(open(template, 'r', encoding='utf-8').read())