mirror of
https://github.com/QuasarApp/qthttpserver.git
synced 2025-04-27 02:44:31 +00:00
Add cmake support for Qt6/dev branch
Change-Id: Icca0edab01d6028d786b76f99fba388565bd6e76 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
6d0a9b6f83
commit
4b2790aa6d
15
CMakeLists.txt
Normal file
15
CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Generated from qthttpserver.pro.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.15.0)
|
||||||
|
|
||||||
|
project(QtHttpServer
|
||||||
|
VERSION 6.0.0
|
||||||
|
DESCRIPTION "Qt HTTP Server"
|
||||||
|
HOMEPAGE_URL "https://qt.io/"
|
||||||
|
LANGUAGES CXX C
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Network)
|
||||||
|
find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Concurrent)
|
||||||
|
|
||||||
|
qt_build_repo()
|
7
examples/CMakeLists.txt
Normal file
7
examples/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Generated from examples.pro.
|
||||||
|
|
||||||
|
qt_examples_build_begin()
|
||||||
|
|
||||||
|
add_subdirectory(httpserver)
|
||||||
|
|
||||||
|
qt_examples_build_end()
|
3
examples/httpserver/CMakeLists.txt
Normal file
3
examples/httpserver/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Generated from httpserver.pro.
|
||||||
|
|
||||||
|
add_subdirectory(simple)
|
40
examples/httpserver/simple/CMakeLists.txt
Normal file
40
examples/httpserver/simple/CMakeLists.txt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Generated from simple.pro.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
project(simple LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
|
||||||
|
set(INSTALL_EXAMPLEDIR "examples/httpserver/simple")
|
||||||
|
|
||||||
|
find_package(Qt6 COMPONENTS HttpServer)
|
||||||
|
|
||||||
|
add_executable(simple
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(simple PUBLIC
|
||||||
|
Qt::HttpServer
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Resources:
|
||||||
|
set(assets_resource_files
|
||||||
|
"assets/qt-logo.png"
|
||||||
|
)
|
||||||
|
|
||||||
|
qt6_add_resources(simple "assets"
|
||||||
|
PREFIX
|
||||||
|
"/"
|
||||||
|
FILES
|
||||||
|
${assets_resource_files}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS simple
|
||||||
|
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||||
|
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||||
|
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||||
|
)
|
6
src/CMakeLists.txt
Normal file
6
src/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Generated from src.pro.
|
||||||
|
|
||||||
|
if(QT_FEATURE_ssl)
|
||||||
|
add_subdirectory(sslserver)
|
||||||
|
endif()
|
||||||
|
add_subdirectory(httpserver)
|
54
src/httpserver/CMakeLists.txt
Normal file
54
src/httpserver/CMakeLists.txt
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Generated from httpserver.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## HttpServer Module:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
qt_add_module(HttpServer
|
||||||
|
SOURCES
|
||||||
|
../3rdparty/http-parser/http_parser.c ../3rdparty/http-parser/http_parser.h
|
||||||
|
qabstracthttpserver.cpp qabstracthttpserver.h qabstracthttpserver_p.h
|
||||||
|
qhttpserver.cpp qhttpserver.h qhttpserver_p.h
|
||||||
|
qhttpserverliterals.cpp qhttpserverliterals_p.h
|
||||||
|
qhttpserverrequest.cpp qhttpserverrequest.h qhttpserverrequest_p.h
|
||||||
|
qhttpserverresponder.cpp qhttpserverresponder.h qhttpserverresponder_p.h
|
||||||
|
qhttpserverresponse.cpp qhttpserverresponse.h qhttpserverresponse_p.h
|
||||||
|
qhttpserverrouter.cpp qhttpserverrouter.h qhttpserverrouter_p.h
|
||||||
|
qhttpserverrouterrule.cpp qhttpserverrouterrule.h qhttpserverrouterrule_p.h
|
||||||
|
qhttpserverrouterviewtraits.h
|
||||||
|
qthttpserverglobal.h
|
||||||
|
INCLUDE_DIRECTORIES
|
||||||
|
.
|
||||||
|
../3rdparty/http-parser
|
||||||
|
LIBRARIES
|
||||||
|
Qt::CorePrivate
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::Core
|
||||||
|
Qt::Network
|
||||||
|
PRIVATE_MODULE_INTERFACE
|
||||||
|
Qt::CorePrivate
|
||||||
|
)
|
||||||
|
|
||||||
|
## Scopes:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
qt_extend_target(HttpServer CONDITION TARGET Qt::WebSockets
|
||||||
|
LIBRARIES
|
||||||
|
Qt::WebSocketsPrivate
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::WebSockets
|
||||||
|
PRIVATE_MODULE_INTERFACE
|
||||||
|
Qt::WebSocketsPrivate
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_extend_target(HttpServer CONDITION QT_FEATURE_ssl
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::SslServer
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_extend_target(HttpServer CONDITION TARGET Qt::Concurrent
|
||||||
|
SOURCES
|
||||||
|
qhttpserverfutureresponse.cpp qhttpserverfutureresponse.h
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::Concurrent
|
||||||
|
)
|
16
src/sslserver/CMakeLists.txt
Normal file
16
src/sslserver/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Generated from sslserver.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## SslServer Module:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
qt_add_module(SslServer
|
||||||
|
SOURCES
|
||||||
|
qsslserver.cpp qsslserver.h qsslserver_p.h
|
||||||
|
qtsslserverglobal.h
|
||||||
|
INCLUDE_DIRECTORIES
|
||||||
|
.
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::Core
|
||||||
|
Qt::Network
|
||||||
|
)
|
7
tests/CMakeLists.txt
Normal file
7
tests/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Generated from tests.pro.
|
||||||
|
|
||||||
|
if(QT_BUILD_STANDALONE_TESTS)
|
||||||
|
# Add qt_find_package calls for extra dependencies that need to be found when building
|
||||||
|
# the standalone tests here.
|
||||||
|
endif()
|
||||||
|
qt_build_tests()
|
7
tests/auto/CMakeLists.txt
Normal file
7
tests/auto/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Generated from auto.pro.
|
||||||
|
|
||||||
|
add_subdirectory(qabstracthttpserver)
|
||||||
|
add_subdirectory(qhttpserver)
|
||||||
|
add_subdirectory(qhttpserverresponder)
|
||||||
|
add_subdirectory(qhttpserverrouter)
|
||||||
|
add_subdirectory(qhttpserverresponse)
|
12
tests/auto/qabstracthttpserver/CMakeLists.txt
Normal file
12
tests/auto/qabstracthttpserver/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Generated from qabstracthttpserver.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## tst_qabstracthttpserver Test:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
qt_add_test(tst_qabstracthttpserver
|
||||||
|
SOURCES
|
||||||
|
tst_qabstracthttpserver.cpp
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::HttpServer
|
||||||
|
)
|
@ -3,5 +3,3 @@ TARGET = tst_qabstracthttpserver
|
|||||||
SOURCES += tst_qabstracthttpserver.cpp
|
SOURCES += tst_qabstracthttpserver.cpp
|
||||||
|
|
||||||
QT = httpserver testlib
|
QT = httpserver testlib
|
||||||
|
|
||||||
qtHaveModule(websockets): QT += websockets
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include <QtHttpServer/qabstracthttpserver.h>
|
#include <QtHttpServer/qabstracthttpserver.h>
|
||||||
|
|
||||||
#if defined(QT_WEBSOCKETS_LIB)
|
#if defined(QT_WEBSOCKETS_LIB)
|
||||||
#include <QtWebSockets/qwebsocket.h>
|
# include <QtWebSockets/qwebsocket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QtTest/qsignalspy.h>
|
#include <QtTest/qsignalspy.h>
|
||||||
@ -45,8 +45,8 @@
|
|||||||
#include <QtHttpServer/qhttpserverrequest.h>
|
#include <QtHttpServer/qhttpserverrequest.h>
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
17
tests/auto/qhttpserver/CMakeLists.txt
Normal file
17
tests/auto/qhttpserver/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated from qhttpserver.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## tst_qhttpserver Test:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# Collect test data
|
||||||
|
list(APPEND test_data "data/")
|
||||||
|
|
||||||
|
qt_add_test(tst_qhttpserver
|
||||||
|
SOURCES
|
||||||
|
tst_qhttpserver.cpp
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::HttpServer
|
||||||
|
Qt::HttpServerPrivate
|
||||||
|
TESTDATA ${test_data}
|
||||||
|
)
|
17
tests/auto/qhttpserverresponder/CMakeLists.txt
Normal file
17
tests/auto/qhttpserverresponder/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated from qhttpserverresponder.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## tst_qhttpserverresponder Test:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# Collect test data
|
||||||
|
list(APPEND test_data "data/")
|
||||||
|
|
||||||
|
qt_add_test(tst_qhttpserverresponder
|
||||||
|
SOURCES
|
||||||
|
tst_qhttpserverresponder.cpp
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::HttpServer
|
||||||
|
Qt::HttpServerPrivate
|
||||||
|
TESTDATA ${test_data}
|
||||||
|
)
|
@ -4,4 +4,4 @@ SOURCES += tst_qhttpserverresponder.cpp
|
|||||||
|
|
||||||
QT = httpserver httpserver-private testlib
|
QT = httpserver httpserver-private testlib
|
||||||
|
|
||||||
TESTDATA += *.html
|
TESTDATA += data/
|
||||||
|
@ -189,7 +189,7 @@ void tst_QHttpServerResponder::writeFile_data()
|
|||||||
QTest::addColumn<QString>("data");
|
QTest::addColumn<QString>("data");
|
||||||
|
|
||||||
QTest::addRow("index.html")
|
QTest::addRow("index.html")
|
||||||
<< qobject_cast<QIODevice *>(new QFile(QFINDTESTDATA("index.html"), this))
|
<< qobject_cast<QIODevice *>(new QFile(QFINDTESTDATA("data/index.html"), this))
|
||||||
<< 200
|
<< 200
|
||||||
<< "text/html"
|
<< "text/html"
|
||||||
<< "<html></html>";
|
<< "<html></html>";
|
||||||
@ -231,7 +231,7 @@ void tst_QHttpServerResponder::writeFile()
|
|||||||
|
|
||||||
void tst_QHttpServerResponder::writeFileExtraHeader()
|
void tst_QHttpServerResponder::writeFileExtraHeader()
|
||||||
{
|
{
|
||||||
auto file = new QFile(QFINDTESTDATA("index.html"), this);
|
auto file = new QFile(QFINDTESTDATA("data/index.html"), this);
|
||||||
QSignalSpy spyDestroyIoDevice(file, &QObject::destroyed);
|
QSignalSpy spyDestroyIoDevice(file, &QObject::destroyed);
|
||||||
|
|
||||||
HttpServer server([=](QHttpServerResponder responder) {
|
HttpServer server([=](QHttpServerResponder responder) {
|
||||||
|
17
tests/auto/qhttpserverresponse/CMakeLists.txt
Normal file
17
tests/auto/qhttpserverresponse/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated from qhttpserverresponse.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## tst_qhttpserverresponse Test:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# Collect test data
|
||||||
|
list(APPEND test_data "data/")
|
||||||
|
|
||||||
|
qt_add_test(tst_qhttpserverresponse
|
||||||
|
SOURCES
|
||||||
|
tst_qhttpserverresponse.cpp
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::HttpServer
|
||||||
|
Qt::HttpServerPrivate
|
||||||
|
TESTDATA ${test_data}
|
||||||
|
)
|
12
tests/auto/qhttpserverrouter/CMakeLists.txt
Normal file
12
tests/auto/qhttpserverrouter/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Generated from qhttpserverrouter.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## tst_qhttpserverrouter Test:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
qt_add_test(tst_qhttpserverrouter
|
||||||
|
SOURCES
|
||||||
|
tst_qhttpserverrouter.cpp
|
||||||
|
PUBLIC_LIBRARIES
|
||||||
|
Qt::HttpServer
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user