diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index c63869c2..d41519a0 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -1,5 +1,6 @@ #include "AboutDialog.h" #include "ui_AboutDialog.h" +#include "gen_version.h" #include AboutDialog::AboutDialog(QWidget *parent) : diff --git a/src/src.pro b/src/src.pro index e7dbea55..4e6d36b2 100644 --- a/src/src.pro +++ b/src/src.pro @@ -17,6 +17,18 @@ CONFIG(unittest) { SOURCES += main.cpp } +# version reporting +#version.depends = version.sh +# the following line is commented because otherwise qmake would always call +# this build step and would always relink the target +# I assume that is kinda ok for release, but for development we dont care +# about an all time super actual git version number +# so this is disabled for the debug build +#CONFIG(debug,debug|release):version.target = Makefile.Debug +CONFIG(release,debug|release):version.target = Makefile.Release +version.commands = sh $$PWD/version.sh $$PWD +QMAKE_EXTRA_TARGETS += version + HEADERS += \ sqlitedb.h \ MainWindow.h \ @@ -35,7 +47,8 @@ HEADERS += \ grammar/Sqlite3Parser.hpp \ grammar/sqlite3TokenTypes.hpp \ sqlitetablemodel.h \ - FilterTableHeader.h + FilterTableHeader.h \ + gen_version.h SOURCES += \ sqlitedb.cpp \ @@ -68,9 +81,6 @@ FORMS += \ ExportCsvDialog.ui \ ImportCsvDialog.ui - -QMAKE_CXXFLAGS += -DAPP_VERSION=\\\"`cd $$PWD;git log -n1 --format=%h_git`\\\" - unix { LIBS += -ldl } diff --git a/src/version.sh b/src/version.sh new file mode 100755 index 00000000..5c84183f --- /dev/null +++ b/src/version.sh @@ -0,0 +1,4 @@ +#!/bin/sh +cd $1 +echo -n "#define APP_VERSION " > gen_version.h +git log -n1 --format="\"%h_git\"" >> gen_version.h