|
@@ -1,9 +1,58 @@
|
|
|
+#ifndef IVVERSION_H
|
|
|
+#define IVVERSION_H
|
|
|
|
|
|
#define VERSION "1.1.0-develop"
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
+#include <stdio.h>
|
|
|
+#include <fstream>
|
|
|
+#include <string.h>
|
|
|
|
|
|
-#define showversion(modulename) do{std::cout<<"ADC IV Version:"<<VERSION<<" | Module name: "<<modulename<<" | Build Time: "<<__DATE__<<" "<<__TIME__<<std::endl;}while(0);
|
|
|
+#include <QFile>
|
|
|
|
|
|
+std::string getgitversion()
|
|
|
+{
|
|
|
+ std::string strrtn;
|
|
|
+ bool bfileok = false;
|
|
|
+ char strpath[256];
|
|
|
+ char strtem[256];
|
|
|
+ char strbase[256];
|
|
|
+ snprintf(strbase,256,"./.git/refs/heads/master");
|
|
|
+ snprintf(strtem,256,"./.");
|
|
|
+ int i;
|
|
|
+ for(i=0;i<5;i++)
|
|
|
+ {
|
|
|
+ strncpy(strpath,strtem,256);
|
|
|
+ int j;
|
|
|
+ for(j=0;j<i;j++)strncat(strpath,strtem,256);
|
|
|
+ strncat(strpath,strbase,256);
|
|
|
+ std::ifstream f(strpath);
|
|
|
+ if(f.good())
|
|
|
+ {
|
|
|
+ char strdata[256];
|
|
|
+ f.read(strdata,256);
|
|
|
+ if(f.gcount()>0)strrtn.append(strdata,f.gcount());
|
|
|
|
|
|
+ // std::cout<<"file ok"<<"size is "<<f.gcount()<<std::endl;
|
|
|
+ bfileok = true;
|
|
|
+ f.close();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // std::cout<<" not ok"<<std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(bfileok == false)
|
|
|
+ {
|
|
|
+ strrtn = VERSION;
|
|
|
+ }
|
|
|
+ return strrtn;
|
|
|
+}
|
|
|
+
|
|
|
+//#define showversion(modulename) do{std::cout<<"ADC IV Version:"<<VERSION<<" | Module name: "<<modulename<<" | Build Time: "<<__DATE__<<" "<<__TIME__<<std::endl;}while(0);
|
|
|
+
|
|
|
+#define showversion(modulename) do{std::cout<<"ADC IV Version:"<<getgitversion()<<" | Module name: "<<modulename<<" | Build Time: "<<__DATE__<<" "<<__TIME__<<std::endl;}while(0);
|
|
|
+
|
|
|
+#endif
|