libcamera: Auto generate version information

Generate a version string, and provide a global string object which
allows applications to interrogate the current libcamera version
information.

The version header is automatically updated by meson on each build.
The string roughly follows the semver [0] conventions of
major.minor.patch-label as a value.

[0] https://semver.org/

A script (utils/gen-version.sh) is provided which is modelled upon the
processing from autoconf's git-version-gen. The gen-version.sh script
will look for tags in the form vX.Y as starting points for the version
string. While the repository does not have any matching tags, v0.0 will
be assumed, resulting in versions with both major and minor being set to
'0', and the patch count resulting from the number of patches in the
history to that point.

Finally, a uniquely identifying shortened hash is provided from git:

	v0.0.509+0ec0edf7

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2019-01-18 11:59:40 +00:00
parent 63d50ef0c6
commit b817bcec6b
8 changed files with 85 additions and 13 deletions

View file

@ -1,4 +1,4 @@
doc_install_dir = join_paths(get_option('datadir'), 'doc', 'libcamera-@0@'.format(api_version))
doc_install_dir = join_paths(get_option('datadir'), 'doc', 'libcamera-@0@'.format(meson.project_version()))
#
# Doxygen
@ -47,8 +47,11 @@ if sphinx.found()
'index.rst',
]
release = 'release=' + meson.project_version()
custom_target('documentation',
command : [sphinx, '-q', '-W', '-b', 'html', meson.current_source_dir(), '@OUTPUT@'],
command : [sphinx, '-D', release, '-q', '-W', '-b', 'html',
meson.current_source_dir(), '@OUTPUT@'],
input : docs_sources,
output : 'html',
build_by_default : true,