summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>2018-07-18 13:11:08 +0200
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>2018-07-18 13:11:08 +0200
commit9cb714018cf01bf559f343836943dff27feefeca (patch)
tree8c41152ab0dba5ef47d9a3b204e9faead01964b3
parentc7e53c7f8fd437819d572aaeb0ad12ac1fdc3187 (diff)
downloadlibnitrokey-9cb714018cf01bf559f343836943dff27feefeca.tar.gz
libnitrokey-9cb714018cf01bf559f343836943dff27feefeca.tar.bz2
meson: add support for generated VCS tag
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
-rw-r--r--meson.build20
1 files changed, 19 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 79f9d77..366168a 100644
--- a/meson.build
+++ b/meson.build
@@ -28,13 +28,31 @@ endif
if get_option('log-volatile-data')
libnitrokey_args += ['-DLOG_VOLATILE_DATA']
endif
+
+version_array = meson.project_version().split('.')
+version_major = version_array[0].to_int()
+version_minor = version_array[1].to_int()
+version_data = configuration_data()
+version_data.set('PROJECT_VERSION_MAJOR', version_major)
+version_data.set('PROJECT_VERSION_MINOR', version_minor)
+# We don't want to substitute it by noop
+version_data.set('PROJECT_VERSION_GIT', '@VCS_TAG@')
+version_cc_in = configure_file(
+ input : 'version.cc.in',
+ output : 'version.cc.in',
+ configuration : version_data,
+)
+version_cc = vcs_tag(
+ input : version_cc_in,
+ output : 'version.cc',
+)
libnitrokey = library(
'nitokey',
sources : [
'command_id.cc',
'device.cc',
'log.cc',
- 'version.cc',
+ version_cc,
'misc.cc',
'NitrokeyManager.cc',
'NK_C_API.cc',