1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

Obtain version string from git

This commit is contained in:
f4exb 2019-04-13 10:30:16 +02:00
parent af098400d5
commit f5f2349d09
6 changed files with 30 additions and 5 deletions

View File

@ -227,6 +227,21 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
endif()
##############################################################################
execute_process(
COMMAND git describe --abbrev=8 --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
configure_file(
${CMAKE_SOURCE_DIR}/version.h.in
${CMAKE_BINARY_DIR}/generated/sdrangel_version.h
)
##############################################################################
# base libraries
add_subdirectory(sdrbase)
@ -244,6 +259,7 @@ add_subdirectory(swagger)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/generated
${CMAKE_SOURCE_DIR}/exports
${CMAKE_SOURCE_DIR}/sdrbase
${CMAKE_SOURCE_DIR}/sdrgui

View File

@ -26,6 +26,7 @@
#include "loggerwithfile.h"
#include "mainwindow.h"
#include "dsp/dsptypes.h"
#include "sdrangel_version.h"
static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *logger)
{
@ -36,7 +37,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
*/
QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangel");
QCoreApplication::setApplicationVersion("4.5.4");
QCoreApplication::setApplicationVersion(GIT_COMMIT_HASH_STR);
#if QT_VERSION >= 0x050600
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps

View File

@ -28,6 +28,7 @@
#include "loggerwithfile.h"
#include "mainbench.h"
#include "dsp/dsptypes.h"
#include "sdrangel_version.h"
void handler(int sig) {
fprintf(stderr, "quit the application by signal(%d).\n", sig);
@ -58,7 +59,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangelBench");
QCoreApplication::setApplicationVersion("4.5.4");
QCoreApplication::setApplicationVersion(GIT_COMMIT_HASH_STR);
int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int));

View File

@ -27,6 +27,7 @@
#include "loggerwithfile.h"
#include "maincore.h"
#include "dsp/dsptypes.h"
#include "sdrangel_version.h"
void handler(int sig) {
fprintf(stderr, "quit the application by signal(%d).\n", sig);
@ -57,7 +58,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangelSrv");
QCoreApplication::setApplicationVersion("4.5.4");
QCoreApplication::setApplicationVersion(GIT_COMMIT_HASH_STR);
int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int));

View File

@ -633,10 +633,10 @@ void MainWindow::createStatusBar()
{
QString qtVersionStr = QString("Qt %1 ").arg(QT_VERSION_STR);
#if QT_VERSION >= 0x050400
m_showSystemWidget = new QLabel("SDRangel v" + qApp->applicationVersion() + " " + qtVersionStr
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr
+ QSysInfo::currentCpuArchitecture() + " " + QSysInfo::prettyProductName(), this);
#else
m_showSystemWidget = new QLabel("SDRangel v" + qApp->applicationVersion() + " " + qtVersionStr, this);
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr, this);
#endif
statusBar()->addPermanentWidget(m_showSystemWidget);

6
version.h.in Normal file
View File

@ -0,0 +1,6 @@
#ifndef VERSION_H
#define VERSION_H
#define GIT_COMMIT_HASH_STR "@GIT_COMMIT_HASH@"
#endif