From 1cb8095bb7cdc133bdd666738583a87f80b97540 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 17 Mar 2021 21:21:49 +0000 Subject: [PATCH] meson.build: add rev-parse to version number --- meson.build | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meson.build b/meson.build index c8918a58..1aa737e6 100644 --- a/meson.build +++ b/meson.build @@ -27,6 +27,13 @@ add_project_arguments(cc.get_supported_arguments( ) version='"@0@"'.format(meson.project_version()) +git = find_program('git', native: true, required: false) +if git.found() + git_commit = run_command([git, 'describe', '--dirty']) + if git_commit.returncode() == 0 + version = '"@0@"'.format(git_commit.stdout().strip()) + endif +endif add_project_arguments('-DLABWC_VERSION=@0@'.format(version), language: 'c') wlroots_proj = subproject( -- 2.52.0