[qcoro] New port (#33273)

This commit is contained in:
Dan Vrátil 2023-10-09 23:21:05 +00:00 committed by GitHub
parent 785aacdaff
commit 848006ded3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 185 additions and 0 deletions

View File

@ -0,0 +1,19 @@
diff --git a/qcoro/websockets/qcorowebsocket.cpp b/qcoro/websockets/qcorowebsocket.cpp
index be9c1f7..c686d14 100644
--- a/qcoro/websockets/qcorowebsocket.cpp
+++ b/qcoro/websockets/qcorowebsocket.cpp
@@ -32,7 +32,13 @@ public:
emitReady(true);
}
}))
- , mError(connect(socket, qOverload<QAbstractSocket::SocketError>(&QWebSocket::error), this, [this](auto error) {
+ , mError(connect(socket, qOverload<QAbstractSocket::SocketError>(
+#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+ &QWebSocket::errorOccurred
+#else
+ &QWebSocket::error
+#endif
+ ), this, [this](auto error) {
qWarning() << "QWebSocket failed to connect to a websocket server: " << error;
emitReady(false);
}))

View File

@ -0,0 +1,59 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO danvratil/qcoro
REF "v${VERSION}"
SHA512 f708e1a82861c39434d6934172246c3280864e933b333b56c0471f1a629f9da65554d1508af4291ac2257ad8df2040655394ae5525d728710de5bd83cef8fbee
HEAD_REF main
PATCHES 0001-qt6-deprecated-qwebsocket-error.patch
)
vcpkg_check_features(
OUT_FEATURE_OPTIONS EXTRA_OPTIONS
FEATURES
dbus QCORO_WITH_QTDBUS
network QCORO_WITH_QTNETWORK
websockets QCORO_WITH_QTWEBSOCKETS
quick QCORO_WITH_QTQUICK
qml QCORO_WITH_QML
test QCORO_WITH_QTTEST
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DUSE_QT_VERSION=6
-DBUILD_TESTING=OFF
-DQCORO_BUILD_EXAMPLES=OFF
${EXTRA_OPTIONS}
)
vcpkg_cmake_install()
if (QCORO_WITH_QTDBUS)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6DBus DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6DBus)
endif()
if (QCORO_WITH_QTNETWORK)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6Network DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6Network)
endif()
if (QCORO_WITH_QTWEBSOCKETS)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6WebSockets DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6WebSockets)
endif()
if (QCORO_WITH_QTQUICK)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6Quick DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6Quick)
endif()
if (QCORO_WITH_QML)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6Qml DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6Qml)
endif()
if (QCORO_WITH_QTTEST)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6Test DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6Test)
endif()
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6Coro DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6Coro)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6 DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH lib/cmake/QCoro6)
vcpkg_cmake_config_fixup(PACKAGE_NAME QCoro6Core CONFIG_PATH lib/cmake/QCoro6Core)
# Remove debug includes and CMake macros
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

36
ports/qcoro/usage Normal file
View File

@ -0,0 +1,36 @@
qcoro-qt6 provides CMake targets:
# Generic coroutine types and tools
find_package(QCoro6Coro CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::Coro)
# Coroutine support for QtCore types
find_package(QCoro6Core CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::Core)
# Coroutine supports for QtDBus types
find_package(QCoro6DBus CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::DBus)
# Coroutine support for QtNetwork types
find_package(QCoro6Network CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::Network)
# Coroutine support for QtQml types
find_package(QCoro6Qml CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::Qml)
# Coroutine support for QML
find_package(QCoro6Quick CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::Quick)
# Coroutine support for developing tests with QtTest
find_package(QCoro6Test CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::Test)
# Coroutine support for QtWebSockets types
find_package(QCoro6WebSockets CONFIG REQUIRED)
target_link_libraries(main PRIVATE QCoro6::WebSockets)
You can also use `QCoro` target namespace for transparent
support of both Qt5 and Qt6.

56
ports/qcoro/vcpkg.json Normal file
View File

@ -0,0 +1,56 @@
{
"name": "qcoro",
"version": "0.9.0",
"description": "Coroutine support for Qt",
"homepage": "https://www.github.com/danvratil/qcoro",
"documentation": "https://qcoro.dvratil.cz",
"license": "MIT",
"dependencies": [
"qtbase",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"dbus",
"network",
"qml",
"quick",
"test",
"websockets"
],
"features": {
"dbus": {
"description": "Coroutine support for QtDBus module"
},
"network": {
"description": "Coroutine support for QtNetwork module"
},
"qml": {
"description": "Coroutine support for QtQml module",
"dependencies": [
"qtdeclarative"
]
},
"quick": {
"description": "Coroutine support for QtQuick module",
"dependencies": [
"qtdeclarative"
]
},
"test": {
"description": "Support code for easier testing of coroutines with QtTest."
},
"websockets": {
"description": "Coroutine support for QtWebSockets module",
"dependencies": [
"qtwebsockets"
]
}
}
}

View File

@ -960,6 +960,8 @@ python3:x64-android=fail
# Not yet ready for these platforms.
qbittorrent:x64-osx=fail
qbittorrent:x64-linux=fail
# Triggers ICE in release build.
qcoro:x64-osx=fail
qpid-proton:arm-neon-android=fail
qpid-proton:arm64-uwp=fail
qpid-proton:arm64-android=fail

View File

@ -6708,6 +6708,10 @@
"baseline": "2.3.7",
"port-version": 0
},
"qcoro": {
"baseline": "0.9.0",
"port-version": 0
},
"qcustomplot": {
"baseline": "2.1.1",
"port-version": 1

9
versions/q-/qcoro.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "0b82c30bd542212b17946094149433dda747515f",
"version": "0.9.0",
"port-version": 0
}
]
}