|
@@ -74,68 +74,75 @@ set(PROTOBUF_QUICK_PLUGIN_NAME protobufquickplugin)
|
|
set(GRPC_QUICK_PLUGIN_NAME grpcquickplugin)
|
|
set(GRPC_QUICK_PLUGIN_NAME grpcquickplugin)
|
|
|
|
|
|
set(QT_PROTOBUF_MAKE_TESTS ON CACHE BOOL "Enable QtProtobuf tests build")
|
|
set(QT_PROTOBUF_MAKE_TESTS ON CACHE BOOL "Enable QtProtobuf tests build")
|
|
|
|
+set(QT_PROTOBUF_STANDALONE_TESTS OFF CACHE BOOL "Enable QtProtobuf tests build")
|
|
set(QT_PROTOBUF_MAKE_EXAMPLES ON CACHE BOOL "Enable QtProtobuf examples build")
|
|
set(QT_PROTOBUF_MAKE_EXAMPLES ON CACHE BOOL "Enable QtProtobuf examples build")
|
|
set(QT_PROTOBUF_MAKE_COVERAGE OFF CACHE BOOL "Enable QtProtobuf build for profiler (gcov)")
|
|
set(QT_PROTOBUF_MAKE_COVERAGE OFF CACHE BOOL "Enable QtProtobuf build for profiler (gcov)")
|
|
set(QT_PROTOBUF_FIELD_ENUM OFF CACHE BOOL "Enable generation of enumeration with fields numbers for well-known and Qt types libraries")
|
|
set(QT_PROTOBUF_FIELD_ENUM OFF CACHE BOOL "Enable generation of enumeration with fields numbers for well-known and Qt types libraries")
|
|
set(QT_PROTOBUF_NATIVE_GRPC_CHANNEL OFF CACHE BOOL "Enable native gRPC channel implementation")
|
|
set(QT_PROTOBUF_NATIVE_GRPC_CHANNEL OFF CACHE BOOL "Enable native gRPC channel implementation")
|
|
|
|
|
|
-if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
|
|
|
|
- if(NOT WrapgRPC_FOUND OR NOT Threads_FOUND)
|
|
|
|
- message("QT_PROTOBUF_NATIVE_GRPC_CHANNEL is ON, but required dependencies are not found.")
|
|
|
|
- set(QT_PROTOBUF_NATIVE_GRPC_CHANNEL OFF)
|
|
|
|
|
|
+if(NOT QT_PROTOBUF_STANDALONE_TESTS)
|
|
|
|
+ if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
|
|
|
|
+ if(NOT WrapgRPC_FOUND OR NOT Threads_FOUND)
|
|
|
|
+ message("QT_PROTOBUF_NATIVE_GRPC_CHANNEL is ON, but required dependencies are not found.")
|
|
|
|
+ set(QT_PROTOBUF_NATIVE_GRPC_CHANNEL OFF)
|
|
|
|
+ endif()
|
|
endif()
|
|
endif()
|
|
-endif()
|
|
|
|
|
|
|
|
-if(CMAKE_CROSSCOMPILING)
|
|
|
|
- set(QT_PROTOBUF_MAKE_TESTS OFF)
|
|
|
|
- set(QT_PROTOBUF_MAKE_EXAMPLES OFF)
|
|
|
|
-endif()
|
|
|
|
|
|
+ if(CMAKE_CROSSCOMPILING)
|
|
|
|
+ set(QT_PROTOBUF_MAKE_TESTS OFF)
|
|
|
|
+ set(QT_PROTOBUF_MAKE_EXAMPLES OFF)
|
|
|
|
+ endif()
|
|
|
|
|
|
-set(QT_PROTOBUF_STATIC OFF CACHE INTERNAL "")
|
|
|
|
-if(NOT BUILD_SHARED_LIBS)
|
|
|
|
- set(QT_PROTOBUF_STATIC ON CACHE INTERNAL "" FORCE)
|
|
|
|
-endif()
|
|
|
|
|
|
+ set(QT_PROTOBUF_STATIC OFF CACHE INTERNAL "" FORCE)
|
|
|
|
+ if(NOT BUILD_SHARED_LIBS)
|
|
|
|
+ set(QT_PROTOBUF_STATIC ON CACHE INTERNAL "" FORCE)
|
|
|
|
+ endif()
|
|
|
|
|
|
-set(extra_type_libraries_options "") #Prevent to set from outside
|
|
|
|
-if(QT_PROTOBUF_FIELD_ENUM)
|
|
|
|
- set(extra_type_libraries_options "FIELDENUM ${extra_type_libraries_options}")
|
|
|
|
-endif()
|
|
|
|
|
|
+ set(extra_type_libraries_options "") #Prevent to set from outside
|
|
|
|
+ if(QT_PROTOBUF_FIELD_ENUM)
|
|
|
|
+ set(extra_type_libraries_options "FIELDENUM ${extra_type_libraries_options}")
|
|
|
|
+ endif()
|
|
|
|
|
|
-configure_package_config_file(
|
|
|
|
- "${CMAKE_CURRENT_SOURCE_DIR}/ProjectConfig.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${QT_PROTOBUF_NAMESPACE}Config.cmake"
|
|
|
|
- INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")
|
|
|
|
|
|
+ configure_package_config_file(
|
|
|
|
+ "${CMAKE_CURRENT_SOURCE_DIR}/ProjectConfig.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${QT_PROTOBUF_NAMESPACE}Config.cmake"
|
|
|
|
+ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")
|
|
|
|
|
|
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/${QT_PROTOBUF_NAMESPACE}Config.cmake"
|
|
|
|
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${QT_PROTOBUF_NAMESPACE}"
|
|
|
|
- COMPONENT dev
|
|
|
|
-)
|
|
|
|
-export(PACKAGE ${QT_PROTOBUF_NAMESPACE})
|
|
|
|
-install(FILES "${QT_PROTOBUF_CMAKE_DIR}/FindWrapProtobuf.cmake"
|
|
|
|
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${QT_PROTOBUF_NAMESPACE}"
|
|
|
|
- COMPONENT dev
|
|
|
|
-)
|
|
|
|
|
|
+ install(FILES "${QT_PROTOBUF_BINARY_DIR}/${QT_PROTOBUF_NAMESPACE}Config.cmake"
|
|
|
|
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${QT_PROTOBUF_NAMESPACE}"
|
|
|
|
+ COMPONENT dev
|
|
|
|
+ )
|
|
|
|
+ export(PACKAGE ${QT_PROTOBUF_NAMESPACE})
|
|
|
|
+ install(FILES "${QT_PROTOBUF_CMAKE_DIR}/FindWrapProtobuf.cmake"
|
|
|
|
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${QT_PROTOBUF_NAMESPACE}"
|
|
|
|
+ COMPONENT dev
|
|
|
|
+ )
|
|
|
|
|
|
-if(NOT CMAKE_CROSSCOMPILING)
|
|
|
|
- add_subdirectory("src/generator")
|
|
|
|
-endif()
|
|
|
|
|
|
+ if(NOT CMAKE_CROSSCOMPILING)
|
|
|
|
+ add_subdirectory("src/generator")
|
|
|
|
+ endif()
|
|
|
|
|
|
-add_subdirectory("src/protobuf")
|
|
|
|
-if(TARGET ${QT_VERSIONED_PREFIX}::Network)
|
|
|
|
- if(${QT_VERSIONED_PREFIX}Core_VERSION VERSION_LESS "5.12.4")
|
|
|
|
- # grpc target requires QT version not less than 5.12.4
|
|
|
|
- # earlier versions Http2DirectAttribute is broken: https://doc.qt.io/qt-5/whatsnew511.html
|
|
|
|
- # https://bugreports.qt.io/browse/QTBUG-74765
|
|
|
|
- message(WARNING "QtGrpc requires the Qt framework version 5.12.4 or higher")
|
|
|
|
- else()
|
|
|
|
- add_subdirectory("src/grpc")
|
|
|
|
|
|
+ add_subdirectory("src/protobuf")
|
|
|
|
+ if(TARGET ${QT_VERSIONED_PREFIX}::Network)
|
|
|
|
+ if(${QT_VERSIONED_PREFIX}Core_VERSION VERSION_LESS "5.12.4")
|
|
|
|
+ # grpc target requires QT version not less than 5.12.4
|
|
|
|
+ # earlier versions Http2DirectAttribute is broken: https://doc.qt.io/qt-5/whatsnew511.html
|
|
|
|
+ # https://bugreports.qt.io/browse/QTBUG-74765
|
|
|
|
+ message(WARNING "QtGrpc requires the Qt framework version 5.12.4 or higher")
|
|
|
|
+ else()
|
|
|
|
+ add_subdirectory("src/grpc")
|
|
|
|
+ endif()
|
|
endif()
|
|
endif()
|
|
-endif()
|
|
|
|
|
|
|
|
-if(TARGET protobuf::libprotobuf AND TARGET protobuf::protoc)
|
|
|
|
- add_subdirectory("src/wellknowntypes")
|
|
|
|
-endif()
|
|
|
|
-if(TARGET ${QT_VERSIONED_PREFIX}::Gui AND TARGET protobuf::protoc)
|
|
|
|
- add_subdirectory("src/qttypes")
|
|
|
|
|
|
+ if(TARGET protobuf::libprotobuf AND TARGET protobuf::protoc)
|
|
|
|
+ add_subdirectory("src/wellknowntypes")
|
|
|
|
+ endif()
|
|
|
|
+ if(TARGET ${QT_VERSIONED_PREFIX}::Gui AND TARGET protobuf::protoc)
|
|
|
|
+ add_subdirectory("src/qttypes")
|
|
|
|
+ endif()
|
|
|
|
+else()
|
|
|
|
+ # Disable any installtion rules if build tests only
|
|
|
|
+ set(QT_PROTOBUF_INSTALL FALSE CACHE INTERNAL "" FORCE)
|
|
|
|
+ set(QT_PROTOBUF_MAKE_TESTS TRUE)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
if(QT_PROTOBUF_MAKE_TESTS)
|
|
if(QT_PROTOBUF_MAKE_TESTS)
|
|
@@ -149,7 +156,7 @@ if(QT_PROTOBUF_MAKE_TESTS)
|
|
endif()
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
|
|
-if(QT_PROTOBUF_MAKE_EXAMPLES)
|
|
|
|
|
|
+if(QT_PROTOBUF_MAKE_EXAMPLES AND NOT QT_PROTOBUF_STANDALONE_TESTS)
|
|
if(TARGET ${QT_VERSIONED_PREFIX}::Quick)
|
|
if(TARGET ${QT_VERSIONED_PREFIX}::Quick)
|
|
add_subdirectory("examples")
|
|
add_subdirectory("examples")
|
|
else()
|
|
else()
|