fix version project configuration

pull/357/head
Davide Gerhard 2019-05-02 11:03:40 +02:00
rodzic 8c4de461a1
commit b8bfdcae7e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7CBEFA144857DC97
5 zmienionych plików z 92 dodań i 107 usunięć

Wyświetl plik

@ -9,16 +9,34 @@ project(sdrangel)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
# set version # configure version
SET(sdrangel_VERSION_MAJOR "4") set(SDRANGEL_VERSION_MAJOR "4")
SET(sdrangel_VERSION_MINOR "5") set(SDRANGEL_VERSION_MINOR "5")
SET(sdrangel_VERSION_PATCH "6") set(SDRANGEL_VERSION_PATCH "6")
SET(sdrangel_VERSION_SUFFIX "") set(SDRANGEL_VERSION_SUFFIX "")
SET(sdrangel_VERSION "${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}${sdrangel_VERSION_SUFFIX}")
SET(CPACK_PACKAGE_VERSION "${sdrangel_VERSION_MAJOR}.${sdrangel_VERSION_MINOR}.${sdrangel_VERSION_PATCH}") find_package(Git)
SET(CPACK_PACKAGE_VERSION_MAJOR ${sdrangel_VERSION_MAJOR}) if(GIT_FOUND)
SET(CPACK_PACKAGE_VERSION_MINOR ${sdrangel_VERSION_MINOR}) execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
SET(CPACK_PACKAGE_VERSION_PATCH ${sdrangel_VERSION_PATCH}) WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res)
set(SDRANGEL_VERSION_SUFFIX "-${out}")
endif()
endif()
set(SDRANGEL_VERSION "${SDRANGEL_VERSION_MAJOR}.${SDRANGEL_VERSION_MINOR}.${SDRANGEL_VERSION_PATCH}${SDRANGEL_VERSION_SUFFIX}")
message(STATUS "SDRAngel Version: ${SDRANGEL_VERSION}")
add_definitions("-DSDRANGEL_LIB_VERSION=\"${SDRANGEL_VERSION_MAJOR}.${SDRANGEL_VERSION_MINOR}.${SDRANGEL_VERSION_PATCH}\"")
add_definitions("-DSDRANGEL_VERSION=\"${SDRANGEL_VERSION}\"")
set(CPACK_PACKAGE_VERSION "${SDRANGEL_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR ${SDRANGEL_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SDRANGEL_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SDRANGEL_VERSION_PATCH})
# disable only when needed # disable only when needed
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
@ -208,21 +226,6 @@ elseif (C_GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=1")
endif() endif()
########## version configuration ############
## need more work
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}")
set(CPACK_PACKAGE_VERSION ${GIT_COMMIT_HASH})
configure_file(
${CMAKE_SOURCE_DIR}/custom/version.h.in
${CMAKE_BINARY_DIR}/generated/sdrangel_version.h
)
########### include sub-projects ############ ########### include sub-projects ############
if(BUILD_EXTERNAL_LIBRARIES) if(BUILD_EXTERNAL_LIBRARIES)
@ -277,7 +280,6 @@ endif()
# includes needed by the following target # includes needed by the following target
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/generated
${CMAKE_SOURCE_DIR}/sdrbase ${CMAKE_SOURCE_DIR}/sdrbase
${CMAKE_SOURCE_DIR}/exports ${CMAKE_SOURCE_DIR}/exports
${CMAKE_SOURCE_DIR}/sdrgui ${CMAKE_SOURCE_DIR}/sdrgui

Wyświetl plik

@ -26,11 +26,6 @@
#include "loggerwithfile.h" #include "loggerwithfile.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#ifdef _MSC_VER
#define GIT_COMMIT_HASH_STR "v4.8.0"
#else
#include "sdrangel_version.h"
#endif
static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *logger) static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *logger)
{ {
@ -41,10 +36,10 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
*/ */
QCoreApplication::setOrganizationName("f4exb"); QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangel"); QCoreApplication::setApplicationName("SDRangel");
QCoreApplication::setApplicationVersion(GIT_COMMIT_HASH_STR); QCoreApplication::setApplicationVersion(SDRANGEL_VERSION);
#if QT_VERSION >= 0x050600 #if QT_VERSION >= 0x050600
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps
#endif #endif
#if 1 #if 1

Wyświetl plik

@ -28,7 +28,6 @@
#include "loggerwithfile.h" #include "loggerwithfile.h"
#include "mainbench.h" #include "mainbench.h"
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "sdrangel_version.h"
void handler(int sig) { void handler(int sig) {
fprintf(stderr, "quit the application by signal(%d).\n", sig); fprintf(stderr, "quit the application by signal(%d).\n", sig);
@ -59,7 +58,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
QCoreApplication::setOrganizationName("f4exb"); QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangelBench"); QCoreApplication::setApplicationName("SDRangelBench");
QCoreApplication::setApplicationVersion(GIT_COMMIT_HASH_STR); QCoreApplication::setApplicationVersion(SDRANGEL_VERSION);
int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP}; int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int)); std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int));
@ -70,43 +69,41 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
#if QT_VERSION >= 0x050400 #if QT_VERSION >= 0x050400
qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld", qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld",
qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationName()),
qPrintable(QCoreApplication::applicationVersion()), qPrintable(QCoreApplication::applicationVersion()),
qPrintable(QString(QT_VERSION_STR)), qPrintable(QString(QT_VERSION_STR)),
QT_POINTER_SIZE*8, QT_POINTER_SIZE*8,
qPrintable(QSysInfo::currentCpuArchitecture()), qPrintable(QSysInfo::currentCpuArchitecture()),
qPrintable(QSysInfo::prettyProductName()), qPrintable(QSysInfo::prettyProductName()),
SDR_RX_SAMP_SZ, SDR_RX_SAMP_SZ,
SDR_TX_SAMP_SZ, SDR_TX_SAMP_SZ,
QCoreApplication::applicationPid()); QCoreApplication::applicationPid());
#else #else
qInfo("%s %s Qt %s %db DSP Rx:%db Tx:%db PID %lld", qInfo("%s %s Qt %s %db DSP Rx:%db Tx:%db PID %lld",
qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationName()),
qPrintable((QCoreApplication::>applicationVersion()), qPrintable((QCoreApplication::>applicationVersion()),
qPrintable(QString(QT_VERSION_STR)), qPrintable(QString(QT_VERSION_STR)),
QT_POINTER_SIZE*8, QT_POINTER_SIZE*8,
SDR_RX_SAMP_SZ, SDR_RX_SAMP_SZ,
SDR_TX_SAMP_SZ, SDR_TX_SAMP_SZ,
QCoreApplication::applicationPid()); QCoreApplication::applicationPid());
#endif #endif
MainBench m(logger, parser, &a); MainBench m(logger, parser, &a);
// This will cause the application to exit when the main core is finished // This will cause the application to exit when the main core is finished
QObject::connect(&m, SIGNAL(finished()), &a, SLOT(quit())); QObject::connect(&m, SIGNAL(finished()), &a, SLOT(quit()));
// This will run the task from the application event loop // This will run the task from the application event loop
QTimer::singleShot(0, &m, SLOT(run())); QTimer::singleShot(0, &m, SLOT(run()));
return a.exec();
}
int main(int argc, char* argv[])
{
qtwebapp::LoggerWithFile *logger = new qtwebapp::LoggerWithFile(qApp);
logger->installMsgHandler();
int res = runQtApplication(argc, argv, logger);
qWarning("SDRangel quit.");
return res;
}
return a.exec();
}
int main(int argc, char* argv[])
{
qtwebapp::LoggerWithFile *logger = new qtwebapp::LoggerWithFile(qApp);
logger->installMsgHandler();
int res = runQtApplication(argc, argv, logger);
qWarning("SDRangel quit.");
return res;
}

Wyświetl plik

@ -27,7 +27,6 @@
#include "loggerwithfile.h" #include "loggerwithfile.h"
#include "maincore.h" #include "maincore.h"
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "sdrangel_version.h"
void handler(int sig) { void handler(int sig) {
fprintf(stderr, "quit the application by signal(%d).\n", sig); fprintf(stderr, "quit the application by signal(%d).\n", sig);
@ -58,7 +57,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
QCoreApplication::setOrganizationName("f4exb"); QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangelSrv"); QCoreApplication::setApplicationName("SDRangelSrv");
QCoreApplication::setApplicationVersion(GIT_COMMIT_HASH_STR); QCoreApplication::setApplicationVersion(SDRANGEL_VERSION);
int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP}; int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int)); std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int));
@ -69,41 +68,39 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
#if QT_VERSION >= 0x050400 #if QT_VERSION >= 0x050400
qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld", qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld",
qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationName()),
qPrintable(QCoreApplication::applicationVersion()), qPrintable(QCoreApplication::applicationVersion()),
qPrintable(QString(QT_VERSION_STR)), qPrintable(QString(QT_VERSION_STR)),
QT_POINTER_SIZE*8, QT_POINTER_SIZE*8,
qPrintable(QSysInfo::currentCpuArchitecture()), qPrintable(QSysInfo::currentCpuArchitecture()),
qPrintable(QSysInfo::prettyProductName()), qPrintable(QSysInfo::prettyProductName()),
SDR_RX_SAMP_SZ, SDR_RX_SAMP_SZ,
SDR_TX_SAMP_SZ, SDR_TX_SAMP_SZ,
QCoreApplication::applicationPid()); QCoreApplication::applicationPid());
#else #else
qInfo("%s %s Qt %s %db DSP Rx:%db Tx:%db PID %lld", qInfo("%s %s Qt %s %db DSP Rx:%db Tx:%db PID %lld",
qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationName()),
qPrintable((QCoreApplication::>applicationVersion()), qPrintable((QCoreApplication::>applicationVersion()),
qPrintable(QString(QT_VERSION_STR)), qPrintable(QString(QT_VERSION_STR)),
QT_POINTER_SIZE*8, QT_POINTER_SIZE*8,
SDR_RX_SAMP_SZ, SDR_RX_SAMP_SZ,
SDR_TX_SAMP_SZ, SDR_TX_SAMP_SZ,
QCoreApplication::applicationPid()); QCoreApplication::applicationPid());
#endif #endif
MainCore m(logger, parser, &a); MainCore m(logger, parser, &a);
// This will cause the application to exit when the main core is finished // This will cause the application to exit when the main core is finished
QObject::connect(&m, SIGNAL(finished()), &a, SLOT(quit())); QObject::connect(&m, SIGNAL(finished()), &a, SLOT(quit()));
return a.exec();
}
int main(int argc, char* argv[])
{
qtwebapp::LoggerWithFile *logger = new qtwebapp::LoggerWithFile(qApp);
logger->installMsgHandler();
int res = runQtApplication(argc, argv, logger);
qWarning("SDRangel quit.");
return res;
}
return a.exec();
}
int main(int argc, char* argv[])
{
qtwebapp::LoggerWithFile *logger = new qtwebapp::LoggerWithFile(qApp);
logger->installMsgHandler();
int res = runQtApplication(argc, argv, logger);
qWarning("SDRangel quit.");
return res;
}

Wyświetl plik

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