meson: add -DGIT arguments (#321)

This commit is contained in:
Mihai Fufezan 2022-07-29 13:21:19 +03:00 committed by GitHub
parent ac8e5fef10
commit 0eebf3ab16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -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')

View File

@ -5,6 +5,7 @@
pkg-config,
meson,
ninja,
git,
libdrm,
libinput,
libxcb,
@ -36,6 +37,7 @@ stdenv.mkDerivation {
buildInputs =
[
git
libdrm
libinput
libxcb