diff options
| author | Mihai Fufezan <fufexan@protonmail.com> | 2022-07-29 13:21:19 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-29 13:21:19 +0300 |
| commit | 0eebf3ab1614a34433cc4d208be84b930b88e25c (patch) | |
| tree | 23812cd86ec469ce4f1144883ee8a25865961b2e | |
| parent | ac8e5fef101138689d88a08abfcf7ffe95f4f3a9 (diff) | |
meson: add -DGIT arguments (#321)
| -rw-r--r-- | meson.build | 10 | ||||
| -rw-r--r-- | nix/default.nix | 2 |
2 files changed, 12 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') diff --git a/nix/default.nix b/nix/default.nix index b729fd98..0070cb31 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -5,6 +5,7 @@ pkg-config, meson, ninja, + git, libdrm, libinput, libxcb, @@ -36,6 +37,7 @@ stdenv.mkDerivation { buildInputs = [ + git libdrm libinput libxcb |
