Don't use tag for git version

pull/263/head
Andri Yngvason 2023-10-09 22:57:36 +00:00
parent b5128070ae
commit c1281dad60
2 changed files with 9 additions and 8 deletions

View File

@ -14,7 +14,6 @@ host_system = host_machine.system()
prefix = get_option('prefix')
c_args = [
'-DPROJECT_VERSION="@0@"'.format(meson.project_version()),
'-D_GNU_SOURCE',
'-DAML_UNSTABLE_API=1',
@ -22,18 +21,22 @@ c_args = [
'-Wno-missing-field-initializers',
]
version = '"@0@"'.format(meson.project_version())
git = find_program('git', native: true, required: false)
if git.found()
git_describe = run_command([git, 'describe', '--tags', '--long'])
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'])
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'])
if git_describe.returncode() == 0 and git_branch.returncode() == 0
c_args += '-DGIT_VERSION="@0@ (@1@)"'.format(
git_describe.stdout().strip(),
if git_commit.returncode() == 0 and git_branch.returncode() == 0
version = '"v@0@-@1@ (@2@)"'.format(
meson.project_version(),
git_commit.stdout().strip(),
git_branch.stdout().strip(),
)
endif
endif
add_project_arguments('-DPROJECT_VERSION=@0@'.format(version), language: 'c')
if buildtype != 'debug' and buildtype != 'debugoptimized'
c_args += '-DNDEBUG'
endif

View File

@ -23,9 +23,7 @@
#include "util.h"
const char* wayvnc_version =
#if defined(GIT_VERSION)
GIT_VERSION;
#elif defined(PROJECT_VERSION)
#if defined(PROJECT_VERSION)
PROJECT_VERSION;
#else
"UNKNOWN";