From 9cb714018cf01bf559f343836943dff27feefeca Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 18 Jul 2018 13:11:08 +0200 Subject: meson: add support for generated VCS tag Signed-off-by: Igor Gnatenko --- meson.build | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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', -- cgit v1.2.3