2022-10-05 17:11:31 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
|
|
|
include(.cmake.conf)
|
|
|
|
project(QtGrpc
|
|
|
|
VERSION "${QT_REPO_MODULE_VERSION}"
|
2022-12-13 11:28:02 +00:00
|
|
|
DESCRIPTION "Qt GRPC and Protobuf generator and bindings."
|
2022-10-05 17:11:31 +00:00
|
|
|
HOMEPAGE_URL "https://qt.io"
|
|
|
|
LANGUAGES CXX C
|
|
|
|
)
|
|
|
|
|
2024-01-12 12:37:35 +00:00
|
|
|
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
|
|
|
|
|
2022-10-05 17:11:31 +00:00
|
|
|
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
|
2023-01-30 18:15:14 +00:00
|
|
|
# Try to find Qt6::qtprotobufgen and Qt6::qtgrpcgen targets from host tools
|
|
|
|
# when cross-compiling.
|
|
|
|
if(NOT "${QT_HOST_PATH}" STREQUAL "")
|
2023-02-14 14:09:27 +00:00
|
|
|
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/src/tools/host")
|
2023-01-30 18:15:14 +00:00
|
|
|
endif()
|
|
|
|
|
2023-07-26 11:09:02 +00:00
|
|
|
find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Network Gui Widgets Quick
|
2024-03-11 14:29:57 +00:00
|
|
|
QmlNetwork QuickControls2 QuickTest)
|
2023-07-26 11:09:02 +00:00
|
|
|
qt_internal_project_setup()
|
|
|
|
|
2022-11-21 17:31:49 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake")
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake")
|
2023-01-03 15:40:26 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/src/protobuf/Qt6ProtobufBuildInternals.cmake")
|
Add support for the google.protobuf.Any type
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>
2022-10-05 17:11:22 +00:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/src/wellknown/Qt6ProtobufWellKnownTypesBuildInternals.cmake")
|
2022-10-05 17:11:31 +00:00
|
|
|
|
|
|
|
qt_build_repo()
|