libcamera: tracing: fix header generation when built as subproject
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 <pobrn@protonmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> [Kieran: Commit message expanded/reworded] Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
3d612720fb
commit
cfa7488072
3 changed files with 10 additions and 7 deletions
|
@ -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([
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include_build_dir = meson.current_build_dir()
|
||||
|
||||
subdir('android')
|
||||
subdir('libcamera')
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue