Skip to content

Commit

Permalink
Meson: add version.c generation
Browse files Browse the repository at this point in the history
  • Loading branch information
szszszsz committed May 14, 2020
1 parent 1b9b132 commit d5a141a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
project('hotp-verification', 'c')
project('hotp-verification', 'c',
version : '1.1.0',
)
lusb = dependency('libusb-1.0')

src = [
Expand All @@ -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 = ([
Expand Down

0 comments on commit d5a141a

Please sign in to comment.