Skip to content
Snippets Groups Projects
Commit d8e55ec6 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added version info feature

parent 6376bf89
No related branches found
No related tags found
No related merge requests found
...@@ -176,6 +176,34 @@ prepare_tree() ...@@ -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() prepare_mingw()
{ {
if [ $BUILDSTATE -ge $BS_PREPARE_MINGW ]; then if [ $BUILDSTATE -ge $BS_PREPARE_MINGW ]; then
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <diagnostics.h> #include <diagnostics.h>
#include <boinc_api.h> #include <boinc_api.h>
#include "../erp_git_version.h"
#include "WindowManager.h" #include "WindowManager.h"
#include "ResourceFactory.h" #include "ResourceFactory.h"
#include "AbstractGraphicsEngine.h" #include "AbstractGraphicsEngine.h"
...@@ -43,6 +45,17 @@ extern "C" { ...@@ -43,6 +45,17 @@ extern "C" {
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
// 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 // enable BOINC diagnostics
// TODO: we might want to optimize this for glibc- and mingw-based stacktraces! // TODO: we might want to optimize this for glibc- and mingw-based stacktraces!
boinc_init_graphics_diagnostics(BOINC_DIAG_DEFAULTS); boinc_init_graphics_diagnostics(BOINC_DIAG_DEFAULTS);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment