diff options
Diffstat (limited to 'appcontroller.pro')
-rw-r--r-- | appcontroller.pro | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/appcontroller.pro b/appcontroller.pro index 7ad5acc..ac7eb83 100644 --- a/appcontroller.pro +++ b/appcontroller.pro @@ -15,3 +15,22 @@ android { target.path = $$[INSTALL_ROOT]/usr/bin } INSTALLS+=target + +# Find out git hash +unix:system(which git):HAS_GIT=TRUE +win32:system(where git.exe):HAS_GIT=TRUE +contains(HAS_GIT, TRUE) { + GIT_HASH=$$system(git log -1 --format=%H) + !system(git diff-index --quiet HEAD): GIT_HASH="$$GIT_HASH-dirty" + GIT_VERSION=$$system(git describe --tags --exact-match) + isEmpty(GIT_VERSION) : GIT_VERSION="unknown" +} else { + GIT_HASH="unknown" + GIT_VERSION="unknown" +} + +isEmpty(GIT_VERSION) : error("No suitable tag found") +isEmpty(GIT_HASH) : error("No hash available") + +DEFINES+="GIT_HASH=\\\"$$GIT_HASH\\\"" +DEFINES+="GIT_VERSION=\\\"$$GIT_VERSION\\\"" |