]> Some of my projects - AniAddCLI.git/commitdiff
Add some revision and runtime info.
authorAPTX <marek321@gmail.com>
Thu, 12 Jan 2012 15:15:06 +0000 (16:15 +0100)
committerAPTX <marek321@gmail.com>
Thu, 12 Jan 2012 15:15:06 +0000 (16:15 +0100)
AniAddCLI.pro
main.cpp

index 283ec1f05a3667ae99834db682b59032dfef5f26..17d02edfec3c81320d0a0b31102fe75ec0d92f01 100644 (file)
@@ -7,6 +7,9 @@ TEMPLATE = app
 SOURCES += main.cpp \
     aniaddcli.cpp
 
+REV = $$system(git show-ref -s --verify refs/heads/master)
+DEFINES += REVISION=\"$${REV}\"
+
 LIBS += -lanidbudpclient
 
 HEADERS += \
index 4ce6d9b3dd5ab849bbcfbc23ad77e97ddb2912a0..34518cc278662ed55071f7367d5a41aed0bc8115 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -8,6 +8,9 @@
 #include <QDebug>
 #include "aniaddcli.h"
 
+#define STRINGIFY_INTERNAL(x) #x
+#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
+
 QString State2String(AniDBUdpClient::State state)
 {
        using namespace AniDBUdpClient;
@@ -121,7 +124,17 @@ int main(int argc, char *argv[])
 
        if (opts.count("help")) {
                cout << QCoreApplication::applicationName() << " v" << QCoreApplication::applicationVersion()
-                        << " by " << QCoreApplication::organizationName() << endl << endl;
+                        << " by " << QCoreApplication::organizationName() << endl;
+               cout << "Built on " __DATE__ " at " __TIME__ " with Qt" QT_VERSION_STR ", Qxt" QXT_VERSION_STR;
+#ifdef REVISION
+               cout << endl << "\tfrom revision   " STRINGIFY(REVISION) "." << endl;
+#else
+               cout << "." << endl;
+#endif
+               if (AniDBUdpClient::revision())
+                       cout << "AniDBUdpClient revision " << AniDBUdpClient::revision() << "." << endl;
+               cout << "Running with Qt" << qVersion() << ", Qxt" << qxtVersion() << endl;
+               cout << endl;
                opts.showUsage();
                return -1;
        }