diff --git a/libnymea-core/debugreportgenerator.cpp b/libnymea-core/debugreportgenerator.cpp index c0f87598..ed9222b3 100644 --- a/libnymea-core/debugreportgenerator.cpp +++ b/libnymea-core/debugreportgenerator.cpp @@ -23,6 +23,7 @@ #include "nymeasettings.h" #include "nymeacore.h" #include "nymeaconfiguration.h" +#include "version.h" #include #include diff --git a/libnymea-core/debugserverhandler.cpp b/libnymea-core/debugserverhandler.cpp index b2431efc..8e76aca8 100644 --- a/libnymea-core/debugserverhandler.cpp +++ b/libnymea-core/debugserverhandler.cpp @@ -26,6 +26,7 @@ #include "debugserverhandler.h" #include "nymeaconfiguration.h" #include "stdio.h" +#include "version.h" #include #include diff --git a/libnymea-core/devices/devicemanagerimplementation.cpp b/libnymea-core/devices/devicemanagerimplementation.cpp index 2abf4327..676326fd 100644 --- a/libnymea-core/devices/devicemanagerimplementation.cpp +++ b/libnymea-core/devices/devicemanagerimplementation.cpp @@ -30,6 +30,7 @@ #include "loggingcategories.h" #include "typeutils.h" #include "nymeasettings.h" +#include "version.h" #include "devices/devicediscoveryinfo.h" #include "devices/devicepairinginfo.h" diff --git a/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp b/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp index 88aed231..ed65e231 100644 --- a/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp +++ b/libnymea-core/hardware/network/upnp/upnpdiscoveryimplementation.cpp @@ -38,6 +38,7 @@ #include "nymeasettings.h" #include "loggingcategories.h" +#include "version.h" #include "upnpdiscoveryimplementation.h" #include "upnpdiscoveryreplyimplementation.h" diff --git a/libnymea-core/jsonrpc/jsonrpcserverimplementation.cpp b/libnymea-core/jsonrpc/jsonrpcserverimplementation.cpp index 47f5bcb9..f3791ec0 100644 --- a/libnymea-core/jsonrpc/jsonrpcserverimplementation.cpp +++ b/libnymea-core/jsonrpc/jsonrpcserverimplementation.cpp @@ -48,6 +48,7 @@ #include "ruleengine/ruleengine.h" #include "loggingcategories.h" #include "platform/platform.h" +#include "version.h" #include "devicehandler.h" #include "actionhandler.h" diff --git a/libnymea-core/libnymea-core.pro b/libnymea-core/libnymea-core.pro index 090642c1..9b229f42 100644 --- a/libnymea-core/libnymea-core.pro +++ b/libnymea-core/libnymea-core.pro @@ -4,7 +4,7 @@ TARGET = nymea-core include(../nymea.pri) QT += sql qml -INCLUDEPATH += $$top_srcdir/libnymea +INCLUDEPATH += $$top_srcdir/libnymea $$top_builddir LIBS += -L$$top_builddir/libnymea/ -lnymea -lssl -lcrypto -lnymea-mqtt target.path = $$[QT_INSTALL_LIBS] diff --git a/libnymea-core/servermanager.cpp b/libnymea-core/servermanager.cpp index e6a21c53..9d190979 100644 --- a/libnymea-core/servermanager.cpp +++ b/libnymea-core/servermanager.cpp @@ -39,6 +39,7 @@ #include "nymeasettings.h" #include "platform/platform.h" #include "platform/platformzeroconfcontroller.h" +#include "version.h" #include "jsonrpc/jsonrpcserverimplementation.h" #include "servers/mocktcpserver.h" diff --git a/libnymea-core/servers/httpreply.cpp b/libnymea-core/servers/httpreply.cpp index 73fa1b9a..b76df7ee 100644 --- a/libnymea-core/servers/httpreply.cpp +++ b/libnymea-core/servers/httpreply.cpp @@ -134,6 +134,7 @@ #include "httpreply.h" #include "loggingcategories.h" #include "nymeacore.h" +#include "version.h" #include #include diff --git a/libnymea-core/servers/webserver.cpp b/libnymea-core/servers/webserver.cpp index 534d7d56..6f1eded7 100644 --- a/libnymea-core/servers/webserver.cpp +++ b/libnymea-core/servers/webserver.cpp @@ -77,6 +77,7 @@ #include "httpreply.h" #include "httprequest.h" #include "debugserverhandler.h" +#include "version.h" #include #include diff --git a/nymea.pri b/nymea.pri index 292888fb..d4924a5f 100644 --- a/nymea.pri +++ b/nymea.pri @@ -1,20 +1,7 @@ -# Parse and export NYMEA_VERSION_STRING -NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') - -# define protocol versions -JSON_PROTOCOL_VERSION_MAJOR=4 -JSON_PROTOCOL_VERSION_MINOR=1 -LIBNYMEA_API_VERSION_MAJOR=4 -LIBNYMEA_API_VERSION_MINOR=0 -LIBNYMEA_API_VERSION_PATCH=0 - COPYRIGHT_YEAR_FROM=2013 COPYRIGHT_YEAR_TO=2020 -DEFINES += NYMEA_VERSION_STRING=\\\"$${NYMEA_VERSION_STRING}\\\" \ - JSON_PROTOCOL_VERSION=\\\"$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}\\\" \ - COPYRIGHT_YEAR_STRING=\\\"$${COPYRIGHT_YEAR_FROM}-$${COPYRIGHT_YEAR_TO}\\\" \ - LIBNYMEA_API_VERSION=\\\"$${LIBNYMEA_API_VERSION_MAJOR}.$${LIBNYMEA_API_VERSION_MINOR}.$${LIBNYMEA_API_VERSION_PATCH}\\\" +DEFINES += COPYRIGHT_YEAR_STRING=\\\"$${COPYRIGHT_YEAR_FROM}-$${COPYRIGHT_YEAR_TO}\\\" QT *= network websockets bluetooth dbus diff --git a/nymea.pro b/nymea.pro index acd5e33d..dde7e47e 100644 --- a/nymea.pro +++ b/nymea.pro @@ -1,5 +1,20 @@ include(nymea.pri) +# Parse and export NYMEA_VERSION_STRING +NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') + +# define protocol versions +JSON_PROTOCOL_VERSION_MAJOR=4 +JSON_PROTOCOL_VERSION_MINOR=1 +JSON_PROTOCOL_VERSION="$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}" +LIBNYMEA_API_VERSION_MAJOR=4 +LIBNYMEA_API_VERSION_MINOR=0 +LIBNYMEA_API_VERSION_PATCH=0 +LIBNYMEA_API_VERSION="$${LIBNYMEA_API_VERSION_MAJOR}.$${LIBNYMEA_API_VERSION_MINOR}.$${LIBNYMEA_API_VERSION_PATCH}" + +QMAKE_SUBSTITUTES += version.h.in + + TEMPLATE=subdirs SUBDIRS += libnymea tools diff --git a/server/main.cpp b/server/main.cpp index 739a4e1c..1ba9b3d6 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -43,6 +43,7 @@ #include "nymeadbusservice.h" #include "nymeaapplication.h" #include "loggingcategories.h" +#include "version.h" using namespace nymeaserver; diff --git a/server/nymeaservice.cpp b/server/nymeaservice.cpp index 0a0ec38e..b0b0cc88 100644 --- a/server/nymeaservice.cpp +++ b/server/nymeaservice.cpp @@ -40,6 +40,7 @@ #include "nymeacore.h" #include "nymeasettings.h" #include "loggingcategories.h" +#include "version.h" namespace nymeaserver { diff --git a/server/server.pro b/server/server.pro index 0ae74e99..4965e3d4 100644 --- a/server/server.pro +++ b/server/server.pro @@ -3,7 +3,7 @@ include(../nymea.pri) TARGET = nymead TEMPLATE = app -INCLUDEPATH += ../libnymea ../libnymea-core +INCLUDEPATH += ../libnymea ../libnymea-core $$top_builddir target.path = /usr/bin INSTALLS += target diff --git a/tests/auto/autotests.pri b/tests/auto/autotests.pri index 64af8559..7acc1e39 100644 --- a/tests/auto/autotests.pri +++ b/tests/auto/autotests.pri @@ -3,7 +3,8 @@ CONFIG += testcase INCLUDEPATH += $$top_srcdir/libnymea \ $$top_srcdir/libnymea-core \ - $$top_srcdir/tests/testlib/ + $$top_srcdir/tests/testlib/ \ + $$top_builddir LIBS += -L$$top_builddir/libnymea/ -lnymea \ -L$$top_builddir/libnymea-core/ -lnymea-core \ diff --git a/tests/auto/jsonrpc/testjsonrpc.cpp b/tests/auto/jsonrpc/testjsonrpc.cpp index db15daf2..9a41fe3b 100644 --- a/tests/auto/jsonrpc/testjsonrpc.cpp +++ b/tests/auto/jsonrpc/testjsonrpc.cpp @@ -22,6 +22,7 @@ #include "nymeatestbase.h" #include "../../utils/pushbuttonagent.h" #include "nymeacore.h" +#include "version.h" #include "servers/mocktcpserver.h" #include "usermanager/usermanager.h" diff --git a/tests/auto/versioning/testversioning.cpp b/tests/auto/versioning/testversioning.cpp index 3f96eab1..32b3f438 100644 --- a/tests/auto/versioning/testversioning.cpp +++ b/tests/auto/versioning/testversioning.cpp @@ -19,6 +19,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "nymeatestbase.h" +#include "version.h" using namespace nymeaserver; diff --git a/tests/auto/websocketserver/testwebsocketserver.cpp b/tests/auto/websocketserver/testwebsocketserver.cpp index 3fd3403c..9dc4e636 100644 --- a/tests/auto/websocketserver/testwebsocketserver.cpp +++ b/tests/auto/websocketserver/testwebsocketserver.cpp @@ -20,6 +20,7 @@ #include "nymeatestbase.h" #include "nymeacore.h" +#include "version.h" #include diff --git a/tools/nymea-plugininfocompiler/nymea-plugininfocompiler.pro b/tools/nymea-plugininfocompiler/nymea-plugininfocompiler.pro index d5ab2478..d540aa8a 100644 --- a/tools/nymea-plugininfocompiler/nymea-plugininfocompiler.pro +++ b/tools/nymea-plugininfocompiler/nymea-plugininfocompiler.pro @@ -3,7 +3,7 @@ CONFIG += c++11 console CONFIG -= app_bundle include(../../nymea.pri) -INCLUDEPATH += $$top_srcdir/libnymea +INCLUDEPATH += $$top_srcdir/libnymea $$top_builddir LIBS += -L$$top_builddir/libnymea -lnymea SOURCES += \ diff --git a/tools/nymea-plugininfocompiler/plugininfocompiler.cpp b/tools/nymea-plugininfocompiler/plugininfocompiler.cpp index 1bbd95cb..2ff109fb 100644 --- a/tools/nymea-plugininfocompiler/plugininfocompiler.cpp +++ b/tools/nymea-plugininfocompiler/plugininfocompiler.cpp @@ -21,6 +21,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "plugininfocompiler.h" +#include "version.h" #include #include diff --git a/version.h.in b/version.h.in new file mode 100644 index 00000000..77ee0c7d --- /dev/null +++ b/version.h.in @@ -0,0 +1,29 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2020 Michael Zanetti * + * * + * This file is part of nymea. * + * * + * nymea is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, version 2 of the License. * + * * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with nymea. If not, see . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef VERSION_H +#define VERSION_H + +#define NYMEA_VERSION_STRING '"$$NYMEA_VERSION_STRING"' +#define JSON_PROTOCOL_VERSION '"$$JSON_PROTOCOL_VERSION"' +#define LIBNYMEA_API_VERSION '"$$LIBNYMEA_API_VERSION"' + +#endif +