diff --git a/commondir.pri b/commondir.pri index 7420bd9..d571d55 100755 --- a/commondir.pri +++ b/commondir.pri @@ -1,26 +1,27 @@ # specifying common dirs +DEFINES *= QHTTP_HAS_CLIENT +# Qt5.5.1 on OSX needs both c++11 and c++14!! the c++14 is not enough +CONFIG += c++11 c++14 + unix { TEMPDIR = $$PRJDIR/tmp/unix/$$TARGET macx:TEMPDIR = $$PRJDIR/tmp/osx/$$TARGET - QMAKE_CFLAGS += -std=gnu99 - QMAKE_CXXFLAGS += -std=c++11 } win32 { warning("Windows port of this library has not been tested nor profiled.") TEMPDIR = $$PRJDIR/tmp/win32/$$TARGET - CONFIG += c++11 DEFINES += _WINDOWS WIN32_LEAN_AND_MEAN NOMINMAX } -DESTDIR = $$PRJDIR/xbin -MOC_DIR = $$TEMPDIR -OBJECTS_DIR = $$TEMPDIR -RCC_DIR = $$TEMPDIR -UI_DIR = $$TEMPDIR/Ui -LIBS += -L$$PRJDIR/xbin +DESTDIR = $$PRJDIR/xbin +MOC_DIR = $$TEMPDIR +OBJECTS_DIR = $$TEMPDIR +RCC_DIR = $$TEMPDIR +UI_DIR = $$TEMPDIR/Ui +LIBS += -L$$PRJDIR/xbin -INCLUDEPATH += . $$PRJDIR/src $$PRJDIR/3rdparty +INCLUDEPATH += . $$PRJDIR/src $$PRJDIR/3rdparty diff --git a/example/example.pro b/example/example.pro index df9bc95..b87aedd 100644 --- a/example/example.pro +++ b/example/example.pro @@ -1,10 +1,10 @@ TEMPLATE = subdirs -SUBDIRS += helloworld -SUBDIRS += basic-server -SUBDIRS += benchmark -SUBDIRS += nodejs - -unix:SUBDIRS += keep-alive +# SUBDIRS += helloworld +# SUBDIRS += basic-server +# SUBDIRS += benchmark +# SUBDIRS += nodejs +# +# unix:SUBDIRS += keep-alive diff --git a/src/qhttpclient.hpp b/src/qhttpclient.hpp index 38119fd..423b309 100644 --- a/src/qhttpclient.hpp +++ b/src/qhttpclient.hpp @@ -9,6 +9,9 @@ #ifndef QHTTPCLIENT_HPP #define QHTTPCLIENT_HPP +// configured by src.pro +#if defined(QHTTP_HAS_CLIENT) + /////////////////////////////////////////////////////////////////////////////// #include "qhttpfwd.hpp" @@ -175,4 +178,5 @@ class QHTTP_API QHttpClient : public QObject } // namespace client } // namespace qhttp /////////////////////////////////////////////////////////////////////////////// +#endif // QHTTP_HAS_CLIENT #endif // define QHTTPCLIENT_HPP diff --git a/src/qhttpclientrequest.hpp b/src/qhttpclientrequest.hpp index 6a87506..53edb9b 100644 --- a/src/qhttpclientrequest.hpp +++ b/src/qhttpclientrequest.hpp @@ -9,6 +9,9 @@ #ifndef QHTTPCLIENT_REQUEST_HPP #define QHTTPCLIENT_REQUEST_HPP +// configured by src.pro +#if defined(QHTTP_HAS_CLIENT) + /////////////////////////////////////////////////////////////////////////////// #include "qhttpabstracts.hpp" #include @@ -60,4 +63,5 @@ class QHTTP_API QHttpRequest : public QHttpAbstractOutput } // namespace client } // namespace qhttp /////////////////////////////////////////////////////////////////////////////// +#endif // QHTTP_HAS_CLIENT #endif // define QHTTPCLIENT_REQUEST_HPP diff --git a/src/qhttpclientresponse.hpp b/src/qhttpclientresponse.hpp index 37024f0..ddfdcb4 100644 --- a/src/qhttpclientresponse.hpp +++ b/src/qhttpclientresponse.hpp @@ -8,6 +8,10 @@ #ifndef QHTTPCLIENT_RESPONSE_HPP #define QHTTPCLIENT_RESPONSE_HPP + +// configured by src.pro +#if defined(QHTTP_HAS_CLIENT) + /////////////////////////////////////////////////////////////////////////////// #include "qhttpabstracts.hpp" @@ -70,4 +74,5 @@ class QHTTP_API QHttpResponse : public QHttpAbstractInput } // namespace client } // namespace qhttp /////////////////////////////////////////////////////////////////////////////// +#endif // QHTTP_HAS_CLIENT #endif // define QHTTPCLIENT_RESPONSE_HPP diff --git a/src/src.pro b/src/src.pro index ee2ff7a..ac9177c 100644 --- a/src/src.pro +++ b/src/src.pro @@ -3,24 +3,23 @@ QT -= gui TARGET = qhttp TEMPLATE = lib -CONFIG += c++14 PRJDIR = .. include($$PRJDIR/commondir.pri) -DEFINES += QHTTP_MEMORY_LOG=0 -win32:DEFINES += QHTTP_EXPORT +DEFINES *= QHTTP_MEMORY_LOG=0 +win32:DEFINES *= QHTTP_EXPORT +# Joyent http_parser +SOURCES += $$PRJDIR/3rdparty/http-parser/http_parser.c +HEADERS += $$PRJDIR/3rdparty/http-parser/http_parser.h SOURCES += \ qhttpabstracts.cpp \ qhttpserverconnection.cpp \ qhttpserverrequest.cpp \ qhttpserverresponse.cpp \ - qhttpserver.cpp \ - qhttpclientrequest.cpp \ - qhttpclientresponse.cpp \ - qhttpclient.cpp + qhttpserver.cpp HEADERS += \ qhttpfwd.hpp \ @@ -28,19 +27,16 @@ HEADERS += \ qhttpserverconnection.hpp \ qhttpserverrequest.hpp \ qhttpserverresponse.hpp \ - qhttpserver.hpp \ - qhttpclient.hpp \ - qhttpclientresponse.hpp \ - qhttpclientrequest.hpp \ - private/qhttpbase.hpp \ - private/qhttpserverconnection_private.hpp \ - private/qhttpserverrequest_private.hpp \ - private/qhttpserverresponse_private.hpp \ - private/qhttpserver_private.hpp \ - private/qhttpclientrequest_private.hpp \ - private/qhttpclientresponse_private.hpp \ - private/qhttpclient_private.hpp - -SOURCES += $$PRJDIR/3rdparty/http-parser/http_parser.c -HEADERS += $$PRJDIR/3rdparty/http-parser/http_parser.h - + qhttpserver.hpp + +contains(DEFINES, QHTTP_HAS_CLIENT) { + SOURCES += \ + qhttpclientrequest.cpp \ + qhttpclientresponse.cpp \ + qhttpclient.cpp + + HEADERS += \ + qhttpclient.hpp \ + qhttpclientresponse.hpp \ + qhttpclientrequest.hpp +}