From 4a1133146a322e10033170530ea2f5ffbc874043 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 25 Apr 2020 16:12:04 +0200 Subject: [PATCH] Generate a header containing git version info It contains the last annotated tag, and possibly also the number of commits since then and the hash of the last commit. --- meson.build | 4 ++++ src/common/config/meson.build | 8 ++++++++ src/common/config/version.h.in | 24 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 src/common/config/meson.build create mode 100644 src/common/config/version.h.in diff --git a/meson.build b/meson.build index 65144f82..de4e49c9 100644 --- a/meson.build +++ b/meson.build @@ -27,6 +27,10 @@ endif # about the way these two components work together can be found in the readme # file. +# Generate header files for configuration variables such as the current git tag +# and the last commit hash +subdir('src/common/config') + boost_dep = dependency('boost', modules : ['filesystem']) bitsery_dep = subproject('bitsery').get_variable('bitsery_dep') threads_dep = dependency('threads') diff --git a/src/common/config/meson.build b/src/common/config/meson.build new file mode 100644 index 00000000..93a6b3a1 --- /dev/null +++ b/src/common/config/meson.build @@ -0,0 +1,8 @@ +# Generate a file containing the last annotated git tag and possibly also the +# amount of commits since then and the hash of the last commit +vcs_tag( + command : ['git', 'describe', '--always'], + input : 'version.h.in', + output : 'version.h', + replace_string : '@VCS_VERSION@' +) diff --git a/src/common/config/version.h.in b/src/common/config/version.h.in new file mode 100644 index 00000000..ead22331 --- /dev/null +++ b/src/common/config/version.h.in @@ -0,0 +1,24 @@ +// yabridge: a Wine VST bridge +// Copyright (C) 2020 Robbert van der Helm +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#pragma once + +/** + * Will be replaced with the output of `git describe` by Meson. Contains the + * latest annotated tag and possibly also the amount of commits and the hash of + * the last commit. + */ +constexpr char yabridge_git_version[] = "@VCS_VERSION@";