From d5a141a9707968854c2de118085e014bba1fbef5 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 14 May 2020 18:40:01 +0200 Subject: [PATCH] Meson: add version.c generation --- meson.build | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index aa62455..9ca0c66 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,6 @@ -project('hotp-verification', 'c') +project('hotp-verification', 'c', + version : '1.1.0', +) lusb = dependency('libusb-1.0') src = [ @@ -15,6 +17,25 @@ src = [ 'hidapi/libusb/hid.c' ] +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('GIT_VERSION_PLACEHOLDER', '@VCS_TAG@') +version_cc_in = configure_file( + input : 'version.c.in', + output : 'version.c.in', + configuration : version_data, +) +version_cc = vcs_tag( + input : version_cc_in, + output : 'version.c', + fallback : 'v@0@'.format(meson.project_version()), +) + common_flags = ['-DNK_REMOVE_PTHREAD'] incdir = ([