version_get.h: add missing info in Meson build

The Makefile calls the setlocalversion script to get the repo info,
append it to the version, and add it to version_gen.h. Meson is skipping
the repo info and just writing the version into version_gen.h.

The Meson vcs_tag() can call an external program to get the version, but
it can't append the output to another string, so we must update
setlocalversion to do it for us.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
This commit is contained in:
Brandon Maier 2023-08-04 16:16:48 +00:00
parent 38165954c1
commit 874fb7e818
2 changed files with 10 additions and 1 deletions

View file

@ -59,6 +59,11 @@ py = py.find_installation(required: get_option('python'))
swig = find_program('swig', required: get_option('python'))
version_gen_h = vcs_tag(
command: [
'scripts/setlocalversion',
meson.current_source_dir(),
meson.project_version()
],
input: 'version_gen.h.in',
output: 'version_gen.h',
)

View file

@ -3,12 +3,16 @@
# Print additional version information for non-release trees.
usage() {
echo "Usage: $0 [srctree]" >&2
echo "Usage: $0 [srctree] [version]" >&2
exit 1
}
cd "${1:-.}" || usage
if [ -n "${2}" ]; then
printf '%s' "${2}"
fi
# Check for git and a git repo.
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
# Do we have an untagged version?