summaryrefslogtreecommitdiffstats
path: root/src/b2qt-flashing-wizard
diff options
context:
space:
mode:
authorRainer Keller <rainer.keller@theqtcompany.com>2014-11-17 12:17:57 +0100
committerRainer Keller <rainer.keller@theqtcompany.com>2014-11-17 13:18:50 +0200
commit1071310c5c72439d7fd522d0b6af9a6b0c6359ab (patch)
treed46135758790f678b9ffef53be232cbb4feda7cd /src/b2qt-flashing-wizard
parentce5cf7466f6db9bb69e453a1882c6fe77896f706 (diff)
b2qt-flashing-wizard: Show version on startup
Change-Id: Id6c125a24d1f8e64a9c442632600c3715c3ab546 Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
Diffstat (limited to 'src/b2qt-flashing-wizard')
-rw-r--r--src/b2qt-flashing-wizard/b2qt-flashing-wizard.pro19
-rw-r--r--src/b2qt-flashing-wizard/main.cpp1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/b2qt-flashing-wizard/b2qt-flashing-wizard.pro b/src/b2qt-flashing-wizard/b2qt-flashing-wizard.pro
index 05403b9..31c734d 100644
--- a/src/b2qt-flashing-wizard/b2qt-flashing-wizard.pro
+++ b/src/b2qt-flashing-wizard/b2qt-flashing-wizard.pro
@@ -33,3 +33,22 @@ HEADERS += \
RESOURCES += b2qt-flashing-wizard.qrc
INSTALLS += target
target.path = /bin
+
+# 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\\\""
diff --git a/src/b2qt-flashing-wizard/main.cpp b/src/b2qt-flashing-wizard/main.cpp
index 0321e3e..25ab9d1 100644
--- a/src/b2qt-flashing-wizard/main.cpp
+++ b/src/b2qt-flashing-wizard/main.cpp
@@ -26,6 +26,7 @@
int main(int argc, char **argv)
{
+ printf("Version %s, SHA1 %s\n", GIT_VERSION, GIT_HASH);
QApplication app(argc, argv);
// qDebug() << QStyleFactory::keys();
QStyle *style = QStyleFactory::create("Fusion");