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>
This commit is contained in:
parent
a5f12d2eb3
commit
48f9660acd
2 changed files with 13 additions and 14 deletions
|
@ -107,16 +107,6 @@ formats_h = custom_target('formats_h',
|
||||||
install_dir : libcamera_headers_install_dir)
|
install_dir : libcamera_headers_install_dir)
|
||||||
libcamera_public_headers += formats_h
|
libcamera_public_headers += formats_h
|
||||||
|
|
||||||
# libcamera.h
|
|
||||||
libcamera_h = custom_target('gen-header',
|
|
||||||
input : 'meson.build',
|
|
||||||
output : 'libcamera.h',
|
|
||||||
command : [gen_header, meson.current_source_dir(), '@OUTPUT@'],
|
|
||||||
install : true,
|
|
||||||
install_dir : libcamera_headers_install_dir)
|
|
||||||
|
|
||||||
libcamera_public_headers += libcamera_h
|
|
||||||
|
|
||||||
# version.h
|
# version.h
|
||||||
version = libcamera_version.split('.')
|
version = libcamera_version.split('.')
|
||||||
libcamera_version_config = configuration_data()
|
libcamera_version_config = configuration_data()
|
||||||
|
@ -129,3 +119,13 @@ version_h = configure_file(input : 'version.h.in',
|
||||||
configuration : libcamera_version_config,
|
configuration : libcamera_version_config,
|
||||||
install_dir : libcamera_headers_install_dir)
|
install_dir : libcamera_headers_install_dir)
|
||||||
libcamera_public_headers += version_h
|
libcamera_public_headers += version_h
|
||||||
|
|
||||||
|
# libcamera.h
|
||||||
|
libcamera_h = custom_target('gen-header',
|
||||||
|
input : 'meson.build',
|
||||||
|
output : 'libcamera.h',
|
||||||
|
command : [gen_header, '@OUTPUT@', libcamera_public_headers],
|
||||||
|
install : true,
|
||||||
|
install_dir : libcamera_headers_install_dir)
|
||||||
|
|
||||||
|
libcamera_public_headers += libcamera_h
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
src_dir="$1"
|
dst_file="$1"
|
||||||
dst_file="$2"
|
shift
|
||||||
|
|
||||||
cat <<EOF > "$dst_file"
|
cat <<EOF > "$dst_file"
|
||||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
@ -16,9 +16,8 @@ cat <<EOF > "$dst_file"
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
headers=$(for header in "$src_dir"/*.h "$src_dir"/*.h.in ; do
|
headers=$(for header in "$@" ; do
|
||||||
header=$(basename "$header")
|
header=$(basename "$header")
|
||||||
header="${header%.in}"
|
|
||||||
echo "$header"
|
echo "$header"
|
||||||
done | sort)
|
done | sort)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue