libcamera/utils/codegen/gen-header.sh
Laurent Pinchart 48f9660acd utils: codegen: gen-header.sh: Generate libcamera.h based on meson.build
The libcamera.h header is a top-level library header that contains every
other libcamera header. It is currently generated by listing the files
in include/libcamera/ and dropping the .in suffix from template files.
This assumes a 1:1 mapping between generated header file names and the
name of their templates.

Drop that assumption and base the libcamera.h generation on the
libcamera public headers listed in meson.build. This makes the
libcamera.h header generation more future-proof.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-16 00:00:28 +03:00

26 lines
426 B
Bash
Executable file

#!/bin/sh
dst_file="$1"
shift
cat <<EOF > "$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 public API
*/
#pragma once
EOF
headers=$(for header in "$@" ; do
header=$(basename "$header")
echo "$header"
done | sort)
for header in $headers ; do
echo "#include <libcamera/$header>" >> "$dst_file"
done