The function sets the required CMake variables and policies.
Pick-to: 6.5
Task-number: QTBUG-112685
Change-Id: Ib5c5673e7cdb7124ccfc49f452813eb181f7dd3c
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
The Qt6ProtobufTools and Qt6GrpcTools expose their dependencies to
a build tree. The created targets then are treated as the dependencies
for the target tools that cannot link to them. To avoid making these
dependencies visible for the whole project moving them to a
subdirectory that hides them from target tools. Also avoid using
cmake package registry when looking for these packages since cmake
knows nothing about the way we cheat when looking for the host tools,
and thinks that the packages were found previously are compatible with
target tools.
Fixes: QTBUG-111140
Task-number: 6.5
Change-Id: I25bc6c687af0be1f0549226eff556c22afc1b7f0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This also means adding another library; the Protobuf Well-Known types
library. No other types added from the collection at the moment.
The Any type is like QVariant or std::any in the sense that it can hold
any type. A small string is embedded along with the Any type upon
serializing. This corresponds to some URL, that can be used for
dynamically looking up definitions of types if wanted
(we don't support this), plus the object name.
We use the embedded object name to verify, upon attempting to
deserialize, that the objects are the same. The function is called
as<T>.
Some users may want a as_unchecked<T>, in the future, where we don't do
this, since different messages may be binary compatible but miss some
fields. And this is fine.
Further, the class also contains the raw bytes of its contained message.
We, quite simply, need to deserialize it to some type when requested.
Implementation consists of a helper-class which uses the "real class" we
generate when serializing or deserializing. At some point they could
potentially be collapsed together to avoid extra overhead. But then
the metadata fields need to be dynamically created or manually
maintained.
When asked to serialize/deserialize the class simply proxies calls to
the "real class" underneath
Fixes: QTBUG-103982
Change-Id: Ie9e833cd30aa58afbd5bdd1a9e9c83bdece6f685
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Add the protobuf example that emulates the work of dummy sensors that
send data to the sensor client. The example uses UDP sockets to send
datagrams that contain protobuf messages. Messages consist of two
layers:
- The Type-Length-Value wrapping message that specifies the the
message type and allows to verify the message size.
- Sensor message that contains a sensor data.
The example intends to show how to generate the code from the protobuf
schema and use it in simple UDP signalling protocol on both sender and
receiver sides.
Both client and emulator have simple UI implemented using QtWidgets.
Task-number: QTBUG-109598
Pick-to: 6.5
Change-Id: I13e2c5bcd995b8aa6d873c495a7bd83f6651a061
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
These features should only be enabled when the corresponding tools
should be built. Currently features are enabled even if tools won't
be built. This leads to the following issues when crosscompiling and
the host Qt lacks the qtprotobufgen/qtgrpcgen targets:
Failed to find the host tool "Qt6::qtprotobufgen". It is part of the
Qt6ProtobufTools package, but the package could not be found.
Instead of enabling features when crosscompiling by default, search for
the module host tool targets first in top-level CMakeLists.txt and
next check if respective tools can be found. Make the
qt_internal_add_tool calls dependent on either the
qtprotobufgen/qtgrpcgen features or the host tools lookup results.
This also adds the qtgrpcgen feature since it makes sense to skip
building the gRPC generator using separate feature.
Add the missing dependencies on qtgrpc to the qtgrpcgen and native_grpc
features. Both features now are disabled if the grpc feature is OFF.
Remove redundant feature checks and replace them with tool target check
where is necessary.
TODO: QT_FORCE_BUILD_TOOLS doesn't lead to the error if the
dependencies of the repo tools are not satisfied. See QTBUG-110849
for details.
Amends 326ebfaadb
Fixes: QTBUG-110704
Pick-to: 6.5
Change-Id: Ib29c4b24bc3e8c5147bf40332909bd8d44664699
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add QtGrpc index and classes documentation pages.
Fix missing links to QtGrpc documentation.
The modules are now consistently named 'Qt GRPC', 'Qt Protobuf'.
Pick-to: 6.5
Change-Id: Iabd91336c871e43c97c49712a52f3aa82f7e75a5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The function now accepts the list of .proto files as an argument and
calls 'qt6_add_protobuf' implictly. .proto files are treated as an
interface of the module and installed to the module include path.
The respective module include path is added to the target's
QT_PROTO_INCLUDES property for the further use in user projects as
PROTO_INCLUDES argument of 'qt_add_protobuf' and 'qt_add_grpc'
functions.
QtProtobufBuildInternals.cmake is renamed and moved to the correct
directory for the implicit processing by qt_internal_add_module
function.
Pick-to: 6.5
Change-Id: I3322a18a6c487bb8dd0165ce9bca5f84c89cbbd5
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
QtGrpc provides support for serializing and deserializing
gRPC services using Qt.
The tool was originally written by Alexey Edelev, along with various
contributors, on GitHub. Originally under MIT license, but major
contributors have agreed to relicense the code under GPL/commercial for
inclusion in tools for Qt. Their copyright notice is retained and
the original source code, still licensed as MIT, can be found in its
original repository[0].
[0]: https://github.com/semlanik/qtprotobuf
Change-Id: Id29e70df1249e9369fbfaa2c543f3ff29efbdbea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The generator generates Qt-based classes to be used in conjunction with
'QProtobuf' (separate patch).
qtprotobufgen works as an extension to the protoc tool from Google, and
thus also depends on its libraries for building.
The tool was originally written by Alexey Edelev, along with various
contributors, on GitHub. Originally under MIT license, but major
contributors have agreed to relicense the code under GPL/commercial for
inclusion in tools for Qt. Their copyright notice is retained and
the original source code, still licensed as MIT, can be found in its
original repository[0].
[0]: https://github.com/semlanik/qtprotobuf
Done-with: Alexey Edelev <alexey.edelev@qt.io>
Change-Id: I0d5f3d722cb98bca70fc0d4544ed840edb27430c
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>