diff --git a/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro b/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro index 8112438ed..70ac509e8 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro +++ b/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro @@ -141,3 +141,5 @@ unix:!macx { INSTALLS += images } OTHER_FILES += Core.pluginspec + +include(gcsversioninfo.pri) diff --git a/ground/openpilotgcs/src/plugins/coreplugin/gcsversioninfo.pri b/ground/openpilotgcs/src/plugins/coreplugin/gcsversioninfo.pri new file mode 100644 index 000000000..559dc3528 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/coreplugin/gcsversioninfo.pri @@ -0,0 +1,35 @@ +# +# This qmake file generates a header with the GCS version info string. +# +# This is a bit tricky since the script should be run always and before +# the other dependencies evaluation. +# + +# Since debug_and_release option is set, we need this +!debug_and_release|build_pass { + ROOT_DIR = $$GCS_SOURCE_TREE/../.. + VERSION_INFO_HEADER = $$GCS_BUILD_TREE/gcsversioninfo.h + VERSION_INFO_SCRIPT = $$ROOT_DIR/make/scripts/version-info.py + VERSION_INFO_TEMPLATE = $$ROOT_DIR/make/templates/gcsversioninfotemplate.h + VERSION_INFO_COMMAND = python \"$$VERSION_INFO_SCRIPT\" + + # Create custom version_info target which generates a header + version_info.target = $$VERSION_INFO_HEADER + version_info.commands = $$VERSION_INFO_COMMAND \ + --path=\"$$GCS_SOURCE_TREE\" \ + --template=\"$$VERSION_INFO_TEMPLATE\" \ + --outfile=\"$$VERSION_INFO_HEADER\" + version_info.depends = FORCE + QMAKE_EXTRA_TARGETS += version_info + + # Hook version_info target in between qmake's Makefile update and + # the actual project target + version_info_hook.depends = version_info + debug_and_release { + CONFIG(debug,debug|release):version_info_hook.target = Makefile.Debug + CONFIG(release,debug|release):version_info_hook.target = Makefile.Release + } else { + version_info_hook.target = Makefile + } + QMAKE_EXTRA_TARGETS += version_info_hook +} diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp index cd4200765..aa8239f6e 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp @@ -65,7 +65,7 @@ VersionDialog::VersionDialog(QWidget *parent) QString ideRev; #ifdef GCS_REVISION //: This gets conditionally inserted as argument %8 into the description string. - ideRev = tr("From revision %1
").arg(QString::fromLatin1(GCS_REVISION_STR).left(10)); + ideRev = tr("From revision %1
").arg(QString::fromLatin1(GCS_REVISION_STR).left(60)); #endif const QString description = tr( diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h index 1293e7313..ab6ec24d2 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h @@ -29,6 +29,9 @@ #ifndef VERSIONDIALOG_H #define VERSIONDIALOG_H +// autogenerated version info string +#include "../../../../../build/ground/openpilotgcs/gcsversioninfo.h" + #include namespace Core { diff --git a/make/templates/gcsversioninfotemplate.h b/make/templates/gcsversioninfotemplate.h new file mode 100644 index 000000000..2130f59bf --- /dev/null +++ b/make/templates/gcsversioninfotemplate.h @@ -0,0 +1,32 @@ +/** + ****************************************************************************** + * + * @file ${OUTFILENAME} + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011. + * @brief GCS revision info file autogenerated using template + * ${TEMPLATE} + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define GCS_REVISION ${TAG_OR_BRANCH}:${HASH8}${DIRTY} ${DATETIME} + +/** + * @} + */