aboutsummaryrefslogtreecommitdiffhomepage
path: root/meson.build
diff options
context:
space:
mode:
authorMihai Fufezan <[email protected]>2022-07-29 13:21:19 +0300
committerGitHub <[email protected]>2022-07-29 13:21:19 +0300
commit0eebf3ab1614a34433cc4d208be84b930b88e25c (patch)
tree23812cd86ec469ce4f1144883ee8a25865961b2e /meson.build
parentac8e5fef101138689d88a08abfcf7ffe95f4f3a9 (diff)
downloadHyprland-0eebf3ab1614a34433cc4d208be84b930b88e25c.tar.gz
Hyprland-0eebf3ab1614a34433cc4d208be84b930b88e25c.zip
meson: add -DGIT arguments (#321)
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build10
1 files changed, 10 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 9bc80a8a..2ab36e18 100644
--- a/meson.build
+++ b/meson.build
@@ -4,12 +4,22 @@ project('Hyprland', 'cpp', 'c',
add_global_arguments('-std=c++23', language: 'cpp')
+GIT_BRANCH = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: false).stdout().strip()
+GIT_COMMIT_HASH = run_command('git', 'rev-parse', 'HEAD', check: false).stdout().strip()
+GIT_COMMIT_MESSAGE = run_command('bash', '-c', 'git show | head -n 5 | tail -n 1', check: false).stdout().strip()
+GIT_DIRTY = run_command('bash', '-c', 'git diff-index --quiet HEAD -- || echo "dirty"', check: false).stdout().strip()
+
add_project_arguments(
[
'-Wno-unused-parameter',
'-Wno-unused-value',
'-Wno-missing-field-initializers',
'-Wno-narrowing',
+
+ f'-DGIT_BRANCH="@GIT_BRANCH@"',
+ f'-DGIT_COMMIT_HASH="@GIT_COMMIT_HASH@"',
+ f'-DGIT_COMMIT_MESSAGE="@GIT_COMMIT_MESSAGE@"',
+ f'-DGIT_DIRTY="@GIT_DIRTY@"',
],
language: 'cpp')