Changed: Qt dependecies are optional

This commit is contained in:
Konrad 2017-03-28 11:18:27 +02:00
parent 4031e493fb
commit 569458a1c1
3 changed files with 48 additions and 28 deletions

View file

@ -17,7 +17,9 @@
#include "ChannelsHandler.h"
#include "StatsHandler.h"
#ifdef LIBRESAPI_QT
#include "SettingsHandler.h"
#endif
/*
data types in json http://json.org/
@ -238,8 +240,10 @@ public:
mChatHandler(sts, ifaces.mNotify, ifaces.mMsgs, ifaces.mPeers, ifaces.mIdentity, &mPeersHandler),
mApiPluginHandler(sts, ifaces),
mChannelsHandler(ifaces.mGxsChannels),
mStatsHandler(),
mSettingsHandler(sts)
mStatsHandler()
#ifdef LIBRESAPI_QT
,mSettingsHandler(sts)
#endif
{
// the dynamic cast is to not confuse the addResourceHandler template like this:
// addResourceHandler(derived class, parent class)
@ -265,8 +269,10 @@ public:
&ChannelsHandler::handleRequest);
router.addResourceHandler("stats", dynamic_cast<ResourceRouter*>(&mStatsHandler),
&StatsHandler::handleRequest);
#ifdef LIBRESAPI_QT
router.addResourceHandler("settings", dynamic_cast<ResourceRouter*>(&mSettingsHandler),
&SettingsHandler::handleRequest);
#endif
}
PeersHandler mPeersHandler;
@ -279,7 +285,10 @@ public:
ApiPluginHandler mApiPluginHandler;
ChannelsHandler mChannelsHandler;
StatsHandler mStatsHandler;
#ifdef LIBRESAPI_QT
SettingsHandler mSettingsHandler;
#endif
};
ApiServer::ApiServer():

View file

@ -3,8 +3,7 @@
TEMPLATE = lib
CONFIG += staticlib
CONFIG += create_prl
CONFIG += qt
QT += core
CONFIG -= qt
TARGET = resapi
TARGET_PRL = libresapi
DESTDIR = lib
@ -183,8 +182,7 @@ SOURCES += \
util/ContentTypes.cpp \
api/ApiPluginHandler.cpp \
api/ChannelsHandler.cpp \
api/StatsHandler.cpp \
api/SettingsHandler.cpp
api/StatsHandler.cpp
HEADERS += \
api/ApiServer.h \
@ -211,8 +209,7 @@ HEADERS += \
util/ContentTypes.h \
api/ApiPluginHandler.h \
api/ChannelsHandler.h \
api/StatsHandler.h \
api/SettingsHandler.h
api/StatsHandler.h
libresapilocalserver {
CONFIG *= qt
@ -220,3 +217,11 @@ libresapilocalserver {
SOURCES *= api/ApiServerLocal.cpp
HEADERS *= api/ApiServerLocal.h
}
qt_dependencies {
CONFIG *= qt
QT *= core
SOURCES += api/SettingsHandler.cpp
HEADERS += api/SettingsHandler.h
}

View file

@ -29,6 +29,11 @@ retroshare_qml_app:CONFIG -= no_retroshare_qml_app
CONFIG *= no_libresapilocalserver
libresapilocalserver:CONFIG -= no_libresapilocalserver
# To enable Qt dependencies in libresapi append the following
# assignation to qmake command line "CONFIG+=qt_dependencies"
CONFIG *= no_qt_dependencies
qt_dependencies:CONFIG -= no_qt_dependencies
# To disable libresapi via HTTP (based on libmicrohttpd) append the following
# assignation to qmake command line "CONFIG+=no_libresapihttpserver"
CONFIG *= libresapihttpserver
@ -155,6 +160,7 @@ unfinished {
wikipoos:DEFINES *= RS_USE_WIKI
rs_gxs:DEFINES *= RS_ENABLE_GXS
libresapilocalserver:DEFINES *= LIBRESAPI_LOCAL_SERVER
qt_dependencies:DEFINES *= LIBRESAPI_QT
libresapihttpserver:DEFINES *= ENABLE_WEBUI
sqlcipher:DEFINES -= NO_SQLCIPHER
no_sqlcipher:DEFINES *= NO_SQLCIPHER