From cfa748807241bddf0f8bb5f18837d87654437271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 9 Nov 2022 16:36:14 +0000 Subject: libcamera: tracing: fix header generation when built as subproject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building libcamera as a subproject is failing when tracepoints are enabled due to incorrectly managing the relative paths between the source and build directory while generating tracepoint headers. 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, and does not correctly handle the relative paths, causing path to be processed as: 'subprojects/libcamera/include/libcamera/internal/tracepoints.h'.replace('include/', '', 1) which evaluates to 'subprojects/libcamera/libcamera/internal/tracepoints.h' so the tracepoints.h header file will try to include: #define TRACEPOINT_INCLUDE "subprojects/libcamera/libcamera/internal/tracepoints.h" which will fail. Fix it by using Python's pathlib to calculate the relative path of the output file with respect to the "include" directory of libcamera. This has been tested with Pipewire. For non-subproject builds it should generate the exact same path that was previously generated. Signed-off-by: Barnabás Pőcze Reviewed-by: Paul Elder [Kieran: Commit message expanded/reworded] Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- include/libcamera/internal/meson.build | 2 +- include/meson.build | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 7a780d48..f8be86e0 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 27ce2f41..19b93a7b 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') -- cgit v1.2.1