Commit d8e55ec6 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added version info feature

parent 6376bf89
......@@ -176,6 +176,34 @@ prepare_tree()
}
prepare_version_header()
{
HEADER_FILE="$ROOT/src/erp_git_version.h"
cd $ROOT || failure
echo "Retrieving git version information..." | tee -a $LOGFILE
if [ -d .git ]; then
GIT_LOG=`git log -n1 --pretty="format:%H"` || failure
HOST=`hostname` || failure
fi
echo "#ifndef ERP_GIT_VERSION_H" > $HEADER_FILE || failure
echo "#define ERP_GIT_VERSION_H" >> $HEADER_FILE || failure
echo "" >> $HEADER_FILE || failure
if [ "no$GIT_LOG" != "no" ]; then
echo "#define ERP_GIT_VERSION \"$GIT_LOG ($HOST:$PWD)\"" >> $HEADER_FILE || failure
else
echo "#define ERP_GIT_VERSION \"unknown (git repository not found!)\"" >> $HEADER_FILE || failure
fi
echo "" >> $HEADER_FILE || failure
echo "#endif" >> $HEADER_FILE || failure
}
prepare_mingw()
{
if [ $BUILDSTATE -ge $BS_PREPARE_MINGW ]; then
......
......@@ -24,6 +24,8 @@
#include <diagnostics.h>
#include <boinc_api.h>
#include "../erp_git_version.h"
#include "WindowManager.h"
#include "ResourceFactory.h"
#include "AbstractGraphicsEngine.h"
......@@ -43,7 +45,18 @@ extern "C" {
int main(int argc, char **argv)
{
// enable BOINC diagnostics
// print version info
if(argc == 2) {
string param(argv[1]);
if(param == "--version" || param = "-v") {
cout << "Version information:" << endl;
cout << "Graphics Application Revision: " << ERP_GIT_VERSION << endl;
cout << "BOINC Revision: " << SVN_VERSION << endl;
exit(0);
}
}
// enable BOINC diagnostics
// TODO: we might want to optimize this for glibc- and mingw-based stacktraces!
boinc_init_graphics_diagnostics(BOINC_DIAG_DEFAULTS);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment