Browse Source

Rework all-in-one build

- Make project dependencies more target-oriented
- Disable install rules in case of sub-project and all-in-one builds
- Fix build with QT_PROTOBUF_NATIVE_GRPC_CHANNEL enabled for all-in-one
  build
Alexey Edelev 4 years ago
parent
commit
facaba67f2

+ 2 - 2
.github/workflows/tagadd.yml

@@ -5,7 +5,7 @@ on:
     branches:
       - ci_check
     tags:
-      - 'v*'
+      - 'v0.6*'
 jobs:
   build-packages:
     name: Build release packages
@@ -13,7 +13,7 @@ jobs:
     steps:
     - uses: actions/checkout@v2
     - name: Init submodules
-      run: git submodule update --init 3rdparty/microjson
+      run: git submodule update --init src/protobuf/3rdparty/microjson
     - name: Build release packages on ubuntu and opensuse latest
       id: build_release
       run: |

+ 82 - 0
.github/workflows/tagadd_old.yml

@@ -0,0 +1,82 @@
+name: Release build
+
+on:
+  push:
+    tags:
+      - 'v0.1*'
+      - 'v0.2*'
+      - 'v0.3*'
+      - 'v0.4*'
+      - 'v0.5*'
+jobs:
+  build-packages:
+    name: Build release packages
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Init submodules
+      run: git submodule update --init 3rdparty/microjson
+    - name: Build release packages on ubuntu and opensuse latest
+      id: build_release
+      run: |
+        mkdir artifacts
+        docker build . --file .ci/Dockerfile.ubuntu_deb --tag ubuntu_debimage:latest
+        docker run --mount type=bind,source="$(pwd)"/artifacts,target=/artifacts ubuntu_debimage:latest sh -c "mv /build/*.deb /artifacts"
+        docker build . --file .ci/Dockerfile.opensuse_rpm --tag opensuse_rpmimage:latest
+        docker run --mount type=bind,source="$(pwd)"/artifacts,target=/artifacts opensuse_rpmimage:latest sh -c "mv /build/*.rpm /artifacts"
+        ls artifacts/*
+        cd artifacts
+        echo "##[set-output name=libpackage;]$(ls -1 libqtprotobuf_*.deb)"
+        echo "##[set-output name=devpackage;]$(ls -1 libqtprotobuf-dev_*.deb)"
+        echo "##[set-output name=devrpmpackage;]$(ls -1 libqtprotobuf-*-devel.rpm)"
+        echo "##[set-output name=librpmpackage;]$(ls -1 libqtprotobuf-*.rpm | grep -v 'devel')"
+    - name: Create Release
+      id: create_release
+      uses: actions/create-release@v1
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      with:
+        tag_name: ${{ github.ref }}
+        release_name: Release ${{ github.ref }}
+        draft: false
+        prerelease: false
+    - name: Upload release lib .deb package
+      id: upload_lib
+      uses: actions/upload-release-asset@v1
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      with:
+        upload_url: ${{ steps.create_release.outputs.upload_url }}
+        asset_path: artifacts/${{ steps.build_release.outputs.libpackage }}
+        asset_name: ${{ steps.build_release.outputs.libpackage }}
+        asset_content_type: application/x-debian-package
+    - name: Upload release develop .deb package
+      id: upload_dev
+      uses: actions/upload-release-asset@v1
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      with:
+        upload_url: ${{ steps.create_release.outputs.upload_url }}
+        asset_path: artifacts/${{ steps.build_release.outputs.devpackage }}
+        asset_name: ${{ steps.build_release.outputs.devpackage }}
+        asset_content_type: application/x-debian-package
+    - name: Upload release .rpm package
+      id: upload_rpm_lib
+      uses: actions/upload-release-asset@v1
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      with:
+        upload_url: ${{ steps.create_release.outputs.upload_url }}
+        asset_path: artifacts/${{ steps.build_release.outputs.librpmpackage }}
+        asset_name: ${{ steps.build_release.outputs.librpmpackage }}
+        asset_content_type: application/x-rpm
+    - name: Upload release develop .rpm package
+      id: upload_rpm_dev
+      uses: actions/upload-release-asset@v1
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      with:
+        upload_url: ${{ steps.create_release.outputs.upload_url }}
+        asset_path: artifacts/${{ steps.build_release.outputs.devrpmpackage }}
+        asset_name: ${{ steps.build_release.outputs.devrpmpackage }}
+        asset_content_type: application/x-rpm

+ 19 - 61
CMakeLists.txt

@@ -12,32 +12,28 @@ if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
 endif()
 
 include(GNUInstallDirs)
+include(CMakePackageConfigHelpers)
 
 set(QT_PROTOBUF_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 set(QT_PROTOBUF_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 set(QT_PROTOBUF_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
 
-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/grpc/CMakeLists.txt")
-    message(STATUS "Found local gRPC sources directory. Perform all-in-one build")
-    set(gRPC_BUILD_TESTS FALSE)
-    set(protobuf_BUILD_TESTS FALSE)
-    add_subdirectory("3rdparty/grpc" EXCLUDE_FROM_ALL)
-    if(TARGET grpc AND TARGET grpc++ AND TARGET grpc_cpp_plugin)
-        add_library(gRPC::grpc ALIAS grpc)
-        add_library(gRPC::grpc++ ALIAS grpc++)
-        add_executable(gRPC::grpc_cpp_plugin ALIAS grpc_cpp_plugin)
-        set(gRPC_FOUND TRUE)
-    endif()
-else()
-    include("${QT_PROTOBUF_CMAKE_DIR}/ProtobufLookup.cmake")
-    include("${QT_PROTOBUF_CMAKE_DIR}/gRPCLookup.cmake")
-endif()
+include("${QT_PROTOBUF_CMAKE_DIR}/dependencies.cmake")
 
-set(gtest_force_shared_crt OFF)
 set(GENERATOR_TARGET qtprotobufgen)
 set(PROTOBUF_QUICK_PLUGIN_NAME protobufquickplugin)
 set(GRPC_QUICK_PLUGIN_NAME grpcquickplugin)
 
+set(QT_PROTOBUF_MAKE_TESTS ON CACHE BOOL "Enable QtProtobuf tests 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(BUILD_SHARED_LIBS ON CACHE BOOL "Enable QtProtobuf static library build (disables shared library build)")
+
+if(CMAKE_CROSSCOMPILING)
+    set(QT_PROTOBUF_MAKE_TESTS OFF)
+    set(QT_PROTOBUF_MAKE_EXAMPLES OFF)
+endif()
+
 if(UNIX)
     if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
         # using Clang
@@ -59,7 +55,6 @@ elseif(WIN32)
     endif()
 endif()
 
-include(CMakePackageConfigHelpers)
 configure_package_config_file(
     "${CMAKE_CURRENT_SOURCE_DIR}/ProjectConfig.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
     INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")
@@ -75,50 +70,10 @@ if(NOT WIN32)#TODO: There are linking issues with windows build of well-known ty
 endif()
 add_subdirectory("src/qttypes")
 
-# add a target to generate API documentation with Doxygen
-find_package(Doxygen)
-if(NOT DOXYGEN_FOUND)
-    find_program(DOXYGEN_EXECUTABLE doxygen)
-endif()
-if(DEFINED DOXYGEN_EXECUTABLE)
-    message(STATUS "Using doxygen to generate documenation: ${DOXYGEN_EXECUTABLE}")
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/customdoxygen.css ${CMAKE_CURRENT_BINARY_DIR}/customdoxygen.css COPYONLY)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/header.html ${CMAKE_CURRENT_BINARY_DIR}/header.html COPYONLY)
-    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/TitilliumWeb.woff2 ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html/TitilliumWeb.woff2 COPYONLY)
-
-    add_custom_target(doc
-        ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        COMMENT "Generating API documentation with Doxygen" VERBATIM
-    )
-endif()
-
-set(QT_PROTOBUF_MAKE_TESTS ON CACHE BOOL "Enable QtProtobuf tests 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(BUILD_SHARED_LIBS ON CACHE BOOL "Enable QtProtobuf static library build (disables shared library build)")
-
-if(CMAKE_CROSSCOMPILING)
-    set(QT_PROTOBUF_MAKE_TESTS OFF)
-    set(QT_PROTOBUF_MAKE_EXAMPLES OFF)
-else()
-    if(NOT gRPC_FOUND)
-        message(WARNING "gRPC not found: some tests and examples cannot be built.")
-        message(STATUS "Force disable test")
-        set(QT_PROTOBUF_MAKE_TESTS OFF)
-        message(STATUS "Force disable examples")
-        set(QT_PROTOBUF_MAKE_EXAMPLES OFF)
-    endif()
-endif()
-
-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtProtobufCommon.cmake")
-
 if(QT_PROTOBUF_MAKE_TESTS)
     if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/googletest/CMakeLists.txt")
-        set(BUILD_GMOCK OFF CACHE BOOL "Disable gmock build functionality" FORCE)
-        set(gtest_force_shared_crt ON CACHE BOOL "Enable shared crt" FORCE)
+        set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
+        set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
         add_subdirectory("3rdparty/googletest" EXCLUDE_FROM_ALL)
         set(GTest_FOUND TRUE)
     else()
@@ -128,7 +83,7 @@ if(QT_PROTOBUF_MAKE_TESTS)
         enable_testing()
         add_subdirectory("tests")
     else()
-        message(STATUS "Force disable test")
+        message(STATUS "googletest not found. Force disable tests.")
     endif()
 endif()
 
@@ -136,5 +91,8 @@ if(QT_PROTOBUF_MAKE_EXAMPLES)
     add_subdirectory("examples")
 endif()
 
-include("${QT_PROTOBUF_CMAKE_DIR}/packaging.cmake")
+if(QT_PROTOBUF_INSTALL)
+    include("${QT_PROTOBUF_CMAKE_DIR}/packaging.cmake")
+endif()
 
+include("${QT_PROTOBUF_CMAKE_DIR}/doxygen.cmake")

+ 32 - 0
cmake/dependencies.cmake

@@ -0,0 +1,32 @@
+set(QT_PROTOBUF_INSTALL TRUE)
+
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/grpc/CMakeLists.txt")
+    message(STATUS "Found gRPC sub-project. Perform all-in-one build.")
+    set(QT_PROTOBUF_INSTALL FALSE)
+
+    set(gRPC_BUILD_TESTS FALSE)
+    set(protobuf_BUILD_TESTS FALSE)
+    add_subdirectory("3rdparty/grpc" EXCLUDE_FROM_ALL)
+    if(TARGET grpc AND TARGET grpc++ AND TARGET grpc_cpp_plugin)
+        add_library(gRPC::grpc ALIAS grpc)
+        add_library(gRPC::grpc++ ALIAS grpc++)
+        add_executable(gRPC::grpc_cpp_plugin ALIAS grpc_cpp_plugin)
+        if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+            export(TARGETS grpc++ grpc gpr NAMESPACE gRPC:: FILE gRPCTargets.cmake)
+            export(TARGETS ssl crypto zlibstatic c-ares address_sorting FILE gRPCDepsTargets.cmake)
+        endif()
+        set(gRPC_FOUND TRUE)
+    endif()
+else()
+    include("${QT_PROTOBUF_CMAKE_DIR}/ProtobufLookup.cmake")
+    include("${QT_PROTOBUF_CMAKE_DIR}/gRPCLookup.cmake")
+endif()
+
+if(NOT "${QT_PROTOBUF_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
+    message(STATUS "QtProtobuf configured as sub-project.")
+    set(QT_PROTOBUF_INSTALL FALSE)
+endif()
+
+if(NOT QT_PROTOBUF_INSTALL)
+    message(STATUS "All install rules are disabled.")
+endif()

+ 19 - 0
cmake/doxygen.cmake

@@ -0,0 +1,19 @@
+# add a target to generate API documentation with Doxygen
+find_package(Doxygen)
+if(NOT DOXYGEN_FOUND)
+    find_program(DOXYGEN_EXECUTABLE doxygen)
+endif()
+if(DEFINED DOXYGEN_EXECUTABLE)
+    message(STATUS "Using doxygen to generate documenation: ${DOXYGEN_EXECUTABLE}")
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/customdoxygen.css ${CMAKE_CURRENT_BINARY_DIR}/customdoxygen.css COPYONLY)
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/header.html ${CMAKE_CURRENT_BINARY_DIR}/header.html COPYONLY)
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html)
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/TitilliumWeb.woff2 ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html/TitilliumWeb.woff2 COPYONLY)
+
+    add_custom_target(doc
+        ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        COMMENT "Generating API documentation with Doxygen" VERBATIM
+    )
+endif()

+ 12 - 8
examples/CMakeLists.txt

@@ -1,11 +1,15 @@
-add_subdirectory("examples_common")
+if(gRPC_FOUND)
+    add_subdirectory("examples_common")
 
-add_subdirectory("addressbook")
-add_subdirectory("addressbookserver")
-configure_file(client_server_driver.sh.in addressbook_driver.sh @ONLY)
+    add_subdirectory("addressbook")
+    add_subdirectory("addressbookserver")
+    configure_file(client_server_driver.sh.in addressbook_driver.sh @ONLY)
 
-add_subdirectory("simplechat")
-add_subdirectory("simplechatserver")
-configure_file(client_server_driver.sh.in simplechat_driver.sh @ONLY)
+    add_subdirectory("simplechat")
+    add_subdirectory("simplechatserver")
+    configure_file(client_server_driver.sh.in simplechat_driver.sh @ONLY)
 
-add_subdirectory("clienttutorial")
+    add_subdirectory("clienttutorial")
+else()
+    message(WARNING "gRPC not found: disable examples")
+endif()

+ 14 - 15
src/generator/CMakeLists.txt

@@ -50,25 +50,24 @@ endif()
 
 target_link_libraries(${TARGET} protobuf::libprotobuf protobuf::libprotoc)
 
-install(TARGETS ${TARGET}
-    EXPORT ${TARGET_EXPORT} COMPONENT dev
-    RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
-
-install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
-
 include(CMakePackageConfigHelpers)
 configure_package_config_file(
     "${TARGET_CONFIG}.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake"
     INSTALL_DESTINATION "${TARGET_CMAKE_DIR}")
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
-
-export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
-
 configure_file("${QT_PROTOBUF_CMAKE_DIR}/QtProtobufGen.cmake" "${QT_PROTOBUF_BINARY_DIR}/QtProtobufGen.cmake" COPYONLY)
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/QtProtobufGen.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
-
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/parsemessages.go" "${QT_PROTOBUF_BINARY_DIR}/parsemessages.go" COPYONLY)
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/parsemessages.go" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
-
 configure_file("${QT_PROTOBUF_CMAKE_DIR}/ProtobufLookup.cmake" "${QT_PROTOBUF_BINARY_DIR}/ProtobufLookup.cmake" COPYONLY)
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/ProtobufLookup.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+
+if(QT_PROTOBUF_INSTALL)
+    install(TARGETS ${TARGET}
+        EXPORT ${TARGET_EXPORT} COMPONENT dev
+        RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
+    install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake"
+        "${QT_PROTOBUF_BINARY_DIR}/QtProtobufGen.cmake"
+        "${QT_PROTOBUF_BINARY_DIR}/parsemessages.go"
+        "${QT_PROTOBUF_BINARY_DIR}/ProtobufLookup.cmake"
+        DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+endif()
+
+export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)

+ 23 - 19
src/grpc/CMakeLists.txt

@@ -11,6 +11,9 @@ set(CMAKE_AUTOMOC ON)
 set(CMAKE_AUTORCC ON)
 
 find_package(Qt5 COMPONENTS Core Network Qml CONFIG REQUIRED)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+    find_package(Threads REQUIRED)
+endif()
 
 if(Qt5Core_VERSION VERSION_LESS "5.12.4")
     # grpc target requires QT version not less than 5.12.4
@@ -56,7 +59,7 @@ file(GLOB HEADERS qgrpcasyncoperationbase_p.h
     qgrpcuserpasswordcredentials.h
     qtgrpcglobal.h)
 
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
     list(APPEND SOURCES qgrpcchannel.cpp)
     list(APPEND HEADERS qgrpcchannel.h qgrpcchannel_p.h)
 endif()
@@ -85,8 +88,9 @@ target_include_directories(${TARGET} PUBLIC
 )
 target_link_libraries(${TARGET} PUBLIC ${QT_PROTOBUF_PROJECT}::QtProtobuf Qt5::Core Qt5::Network)
 
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
-    target_link_libraries(${TARGET} PUBLIC gRPC::grpc++)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+    target_compile_definitions(${TARGET} PUBLIC QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+    target_link_libraries(${TARGET} PUBLIC gRPC::grpc++ ${CMAKE_THREAD_LIBS_INIT})
 endif()
 
 target_compile_features(${TARGET} PUBLIC cxx_std_14
@@ -100,29 +104,29 @@ target_compile_features(${TARGET} PUBLIC cxx_std_14
 
 add_library(${QT_PROTOBUF_PROJECT}::${TARGET} ALIAS ${TARGET})
 
-install(TARGETS ${TARGET}
-    EXPORT ${TARGET_EXPORT} COMPONENT dev
-    ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
-    LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
-
-install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
-
 include(CMakePackageConfigHelpers)
 configure_package_config_file(
     "${TARGET_CONFIG}.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake"
     INSTALL_DESTINATION "${TARGET_CMAKE_DIR}")
 
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
-
-export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
-
 configure_file("${QT_PROTOBUF_CMAKE_DIR}/gRPCLookup.cmake" "${QT_PROTOBUF_BINARY_DIR}/gRPCLookup.cmake" COPYONLY)
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/gRPCLookup.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
-
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/qt_lib_grpc.pri.in" "${QT_PROTOBUF_BINARY_DIR}/qt_lib_grpc.pri" @ONLY)
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/qt_lib_grpc.pri" DESTINATION "${QT_HOST_DATA}/mkspecs/modules" COMPONENT dev)
+
+if(QT_PROTOBUF_INSTALL)
+    install(TARGETS ${TARGET}
+        EXPORT ${TARGET_EXPORT} COMPONENT dev
+        ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
+        LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
+    install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake"
+        "${QT_PROTOBUF_BINARY_DIR}/gRPCLookup.cmake"
+        DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+    install(FILES "${QT_PROTOBUF_BINARY_DIR}/qt_lib_grpc.pri" DESTINATION "${QT_HOST_DATA}/mkspecs/modules" COMPONENT dev)
+endif()
+
+export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
 
 add_subdirectory("quick")
 

+ 5 - 2
src/grpc/QtGrpcConfig.cmake.in

@@ -1,9 +1,12 @@
-include("${CMAKE_CURRENT_LIST_DIR}/gRPCLookup.cmake")
-
 include(CMakeFindDependencyMacro)
 
 find_dependency(QtProtobufProject COMPONENTS QtProtobuf REQUIRED CONFIG)
 
+set(QT_PROTOBUF_NATIVE_GRPC_CHANNEL @QT_PROTOBUF_NATIVE_GRPC_CHANNEL@)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+    include("${CMAKE_CURRENT_LIST_DIR}/gRPCLookup.cmake")
+endif()
+
 if(NOT TARGET @TARGET@ AND NOT @TARGET@_BINARY_DIR)
     include("${CMAKE_CURRENT_LIST_DIR}/@TARGET_EXPORT@.cmake")
 endif()

+ 17 - 11
src/grpc/quick/CMakeLists.txt

@@ -43,22 +43,28 @@ target_compile_definitions(${TARGET} PRIVATE QT_GRPC_QUICK_LIB)
 
 if(NOT BUILD_SHARED_LIBS)
     add_library(${QT_PROTOBUF_PROJECT}::${TARGET} ALIAS ${TARGET})
-    install(TARGETS ${TARGET} COMPONENT lib
-        EXPORT ${TARGET_EXPORT} COMPONENT dev
-        ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
-    install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    if(QT_PROTOBUF_INSTALL)
+        install(TARGETS ${TARGET} COMPONENT lib
+            EXPORT ${TARGET_EXPORT} COMPONENT dev
+            ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+        install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    endif()
     export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
 else()
-    install(TARGETS ${TARGET} COMPONENT lib
-        ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+    if(QT_PROTOBUF_INSTALL)
+        install(TARGETS ${TARGET} COMPONENT lib
+            ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+    endif()
 endif()
 
 add_custom_command(TARGET ${TARGET}
     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir $<TARGET_FILE_DIR:${TARGET}>/qmldir
     COMMENT "Copying qmldir to binary directory")
 
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/qmldir DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+if(QT_PROTOBUF_INSTALL)
+    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/qmldir DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+endif()

+ 19 - 24
src/protobuf/CMakeLists.txt

@@ -12,21 +12,16 @@ set(CMAKE_AUTORCC ON)
 
 find_package(Qt5 COMPONENTS Core Qml REQUIRED)
 
-if(Qt5Core_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(FATAL_ERROR "Required Qt version is 5.12.4+")
-endif()
-
 if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/3rdparty/microjson/CMakeLists.txt")
     set(MICROJSON_MAKE_TESTS OFF)
-    add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/microjson" EXCLUDE_FROM_ALL)
+    add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/microjson")
     message(STATUS "Using microjson from 3rdparty")
+    message("Note: microjson will be added to install set")
+else()
+    find_package(microjson CONFIG REQUIRED)
 endif()
-
 if(NOT TARGET microjson)
-    find_package(microjson CONFIG REQUIRED)
+    message(FATAL_ERROR "microjson is not found.")
 endif()
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
@@ -137,28 +132,28 @@ target_link_libraries(${TARGET} PUBLIC Qt5::Core Qt5::Qml microjson)
 
 add_library(${QT_PROTOBUF_PROJECT}::${TARGET} ALIAS ${TARGET})
 
-install(TARGETS ${TARGET}
-    EXPORT ${TARGET_EXPORT} COMPONENT dev
-    ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
-    LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
-
-install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
-
 include(CMakePackageConfigHelpers)
 configure_package_config_file(
     "${TARGET_CONFIG}.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake"
     INSTALL_DESTINATION "${TARGET_CMAKE_DIR}")
 
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
-
-export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
-
 set(QT_PROTOBUF_EXECUTABLE_INSTALL ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${GENERATOR_TARGET})
 
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/qt_lib_protobuf.pri.in" "${QT_PROTOBUF_BINARY_DIR}/qt_lib_protobuf.pri" @ONLY)
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/qt_lib_protobuf.pri" DESTINATION "${QT_HOST_DATA}/mkspecs/modules" COMPONENT dev)
+
+if(QT_PROTOBUF_INSTALL)
+    install(TARGETS ${TARGET}
+        EXPORT ${TARGET_EXPORT} COMPONENT dev
+        ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
+        LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
+    install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+    install(FILES "${QT_PROTOBUF_BINARY_DIR}/qt_lib_protobuf.pri" DESTINATION "${QT_HOST_DATA}/mkspecs/modules" COMPONENT dev)
+endif()
+
+export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
 
 add_subdirectory("quick")
 

+ 17 - 12
src/protobuf/quick/CMakeLists.txt

@@ -56,22 +56,27 @@ target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../ ${Q
 
 if(NOT BUILD_SHARED_LIBS)
     add_library(${QT_PROTOBUF_PROJECT}::${TARGET} ALIAS ${TARGET})
-    install(TARGETS ${TARGET} COMPONENT lib
-        EXPORT ${TARGET_EXPORT} COMPONENT dev
-        ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
-    install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    if(QT_PROTOBUF_INSTALL)
+        install(TARGETS ${TARGET} COMPONENT lib
+            EXPORT ${TARGET_EXPORT} COMPONENT dev
+            ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+        install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    endif()
     export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
 else()
-    install(TARGETS ${TARGET} COMPONENT lib
-        ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
-        LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+    if(QT_PROTOBUF_INSTALL)
+        install(TARGETS ${TARGET} COMPONENT lib
+            ARCHIVE DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            RUNTIME DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib
+            LIBRARY DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+    endif()
 endif()
 
 add_custom_command(TARGET ${TARGET}
     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir $<TARGET_FILE_DIR:${TARGET}>/qmldir
     COMMENT "Copying qmldir to binary directory")
-
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/qmldir DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+if(QT_PROTOBUF_INSTALL)
+    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/qmldir DESTINATION "${TARGET_IMPORTS_DIR}" COMPONENT lib)
+endif()

+ 17 - 12
src/qttypes/CMakeLists.txt

@@ -12,7 +12,12 @@ set(CMAKE_AUTORCC ON)
 
 find_package(Qt5 COMPONENTS Core Gui Qml REQUIRED)
 find_package(Protobuf QUIET)
-find_package(QtProtobufProject COMPONENTS Generator CONFIG REQUIRED)
+if(NOT TARGET ${GENERATOR_TARGET})
+    find_package(QtProtobufProject COMPONENTS Generator CONFIG REQUIRED)
+else()
+    set(PROTO_PARSER ${QT_PROTOBUF_BINARY_DIR}/parsemessages.go)
+    include(${QT_PROTOBUF_CMAKE_DIR}/QtProtobufGen.cmake)
+endif()
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
 set(CMAKE_CXX_STANDARD 14)
@@ -65,22 +70,22 @@ add_library(${QT_PROTOBUF_PROJECT}::${TARGET} ALIAS ${TARGET})
 
 target_link_libraries(${TARGET} PUBLIC Qt5::Core Qt5::Gui Qt5::Qml ${QT_PROTOBUF_PROJECT}::QtProtobuf)
 
-install(TARGETS ${TARGET}
-    EXPORT ${TARGET_EXPORT} COMPONENT dev
-    ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
-    LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
-
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/QtProtobuf/QtCore.proto ${CMAKE_CURRENT_SOURCE_DIR}/QtProtobuf/QtGui.proto DESTINATION "${TARGET_INCLUDE_DIR}" COMPONENT dev)
-install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
-
 include(CMakePackageConfigHelpers)
 configure_package_config_file(
     "${TARGET_CONFIG}.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake"
     INSTALL_DESTINATION "${TARGET_CMAKE_DIR}")
 
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+if(QT_PROTOBUF_INSTALL)
+    install(TARGETS ${TARGET}
+        EXPORT ${TARGET_EXPORT} COMPONENT dev
+        ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
+        LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
+    install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/QtProtobuf/QtCore.proto ${CMAKE_CURRENT_SOURCE_DIR}/QtProtobuf/QtGui.proto DESTINATION "${TARGET_INCLUDE_DIR}" COMPONENT dev)
+    install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+endif()
 
 export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
 

+ 16 - 11
src/wellknowntypes/CMakeLists.txt

@@ -12,7 +12,12 @@ set(CMAKE_AUTORCC ON)
 
 find_package(Qt5 COMPONENTS Core Qml REQUIRED)
 find_package(Protobuf QUIET)
-find_package(QtProtobufProject COMPONENTS Generator CONFIG REQUIRED)
+if(NOT TARGET ${GENERATOR_TARGET})
+    find_package(QtProtobufProject COMPONENTS Generator CONFIG REQUIRED)
+else()
+    set(PROTO_PARSER ${QT_PROTOBUF_BINARY_DIR}/parsemessages.go)
+    include(${QT_PROTOBUF_CMAKE_DIR}/QtProtobufGen.cmake)
+endif()
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
 set(CMAKE_CXX_STANDARD 14)
@@ -91,21 +96,21 @@ add_library(${QT_PROTOBUF_PROJECT}::${TARGET} ALIAS ${TARGET})
 
 target_link_libraries(${TARGET} PUBLIC Qt5::Core Qt5::Qml ${QT_PROTOBUF_PROJECT}::QtProtobuf)
 
-install(TARGETS ${TARGET}
-    EXPORT ${TARGET_EXPORT} COMPONENT dev
-    ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
-    LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
-    RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
-
-install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
-
 include(CMakePackageConfigHelpers)
 configure_package_config_file(
     "${TARGET_CONFIG}.cmake.in" "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake"
     INSTALL_DESTINATION "${TARGET_CMAKE_DIR}")
 
-install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+if(QT_PROTOBUF_INSTALL)
+    install(TARGETS ${TARGET}
+        EXPORT ${TARGET_EXPORT} COMPONENT dev
+        ARCHIVE DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        PUBLIC_HEADER DESTINATION ${TARGET_INCLUDE_DIR} COMPONENT dev
+        LIBRARY DESTINATION ${TARGET_LIB_DIR} COMPONENT lib
+        RUNTIME DESTINATION ${TARGET_BINDIR} COMPONENT lib)
+    install(EXPORT ${TARGET_EXPORT} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake DESTINATION ${TARGET_CMAKE_DIR} COMPONENT dev)
+    install(FILES "${QT_PROTOBUF_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
+endif()
 
 export(TARGETS ${TARGET} NAMESPACE ${QT_PROTOBUF_PROJECT}:: FILE ${TARGET_EXPORT}.cmake)
 

+ 6 - 2
tests/CMakeLists.txt

@@ -1,6 +1,4 @@
 add_subdirectory("test_protobuf")
-add_subdirectory("test_grpc")
-add_subdirectory("test_grpc_qml")
 add_subdirectory("test_qml")
 add_subdirectory("test_protobuf_multifile")
 add_subdirectory("test_qprotobuf_serializer_plugin")
@@ -8,3 +6,9 @@ if(NOT WIN32)#TODO: There are linking issues with windows build of well-known ty
     add_subdirectory("test_wellknowntypes")
 endif()
 add_subdirectory("test_qttypes")
+if(gRPC_FOUND)
+    add_subdirectory("test_grpc")
+    add_subdirectory("test_grpc_qml")
+else()
+    message(WARNING "gRPC not found: some tests cannot be built.")
+endif()

+ 0 - 5
tests/test_grpc/CMakeLists.txt

@@ -11,11 +11,6 @@ add_test_target(TARGET qtgrpc_secure_test
 add_target_windeployqt(TARGET qtgrpc_secure_test
     QML_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
-    target_compile_definitions(qtgrpc_test PRIVATE QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
-    target_compile_definitions(qtgrpc_secure_test PRIVATE QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
-endif()
-
 # servers
 add_subdirectory(echoserver)
 add_subdirectory(secureechoserver)

+ 7 - 7
tests/test_grpc_qml/CMakeLists.txt

@@ -10,13 +10,13 @@ file(GLOB QML_FILES qml/tst_grpc.qml)
 qt5_wrap_cpp(MOC_SOURCES test.h)
 
 add_executable(qtgrpc_qml_test_http2 ${MOC_SOURCES} http2.cpp ${QML_FILES})
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
     add_executable(qtgrpc_qml_test_grpc_http ${MOC_SOURCES} grpc_http.cpp ${QML_FILES})
     add_executable(qtgrpc_qml_test_grpc_socket ${MOC_SOURCES} grpc_socket.cpp ${QML_FILES})
 endif()
 
 target_link_libraries(qtgrpc_qml_test_http2 PRIVATE Qt5::Qml Qt5::Quick Qt5::Test Qt5::QuickTest QtProtobufProject::QtGrpc)
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
     target_link_libraries(qtgrpc_qml_test_grpc_http PRIVATE Qt5::Qml Qt5::Quick Qt5::Test Qt5::QuickTest QtProtobufProject::QtGrpc)
     target_link_libraries(qtgrpc_qml_test_grpc_socket PRIVATE Qt5::Qml Qt5::Quick Qt5::Test Qt5::QuickTest QtProtobufProject::QtGrpc)
 endif()
@@ -30,7 +30,7 @@ if(QT_PROTOBUF_STATIC)
 endif()
 
 qtprotobuf_link_target(qtgrpc_qml_test_http2 qtgrpc_test_qtprotobuf_gen)
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
     qtprotobuf_link_target(qtgrpc_qml_test_grpc_http qtgrpc_test_qtprotobuf_gen)
     qtprotobuf_link_target(qtgrpc_qml_test_grpc_socket qtgrpc_test_qtprotobuf_gen)
 endif()
@@ -45,7 +45,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../test_grpc/${TEST_DRIVER_NAME}.in $
 add_test(NAME qtgrpc_qml_test_http2
          COMMAND ${TEST_DRIVER_NAME} $<TARGET_FILE:qtgrpc_qml_test_http2> $<TARGET_FILE:echoserver> $<TARGET_FILE_NAME:qtgrpc_qml_test_http2> $<TARGET_FILE_NAME:echoserver>
 )
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
     add_test(NAME qtgrpc_qml_test_grpc_http
             COMMAND ${TEST_DRIVER_NAME} $<TARGET_FILE:qtgrpc_qml_test_grpc_http> $<TARGET_FILE:echoserver> $<TARGET_FILE_NAME:qtgrpc_qml_test_grpc_http> $<TARGET_FILE_NAME:echoserver>
     )
@@ -56,7 +56,7 @@ endif()
 
 add_target_qml(TARGET qtgrpc_qml_test_http2 QML_FILES ${QML_FILES})
 add_target_windeployqt(TARGET qtgrpc_qml_test_http2 QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
-if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
     add_target_qml(TARGET qtgrpc_qml_test_grpc_http QML_FILES ${QML_FILES})
     add_target_windeployqt(TARGET qtgrpc_qml_test_grpc_http QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
     add_target_qml(TARGET qtgrpc_qml_test_grpc_socket QML_FILES ${QML_FILES})
@@ -67,7 +67,7 @@ endif()
 if(WIN32)
     set_tests_properties(qtgrpc_qml_test_http2 PROPERTIES
         ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..\;$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
-    if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+    if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
         set_tests_properties(qtgrpc_qml_test_grpc_http PROPERTIES
             ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..\;$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
         set_tests_properties(qtgrpc_qml_test_grpc_socket PROPERTIES
@@ -76,7 +76,7 @@ if(WIN32)
 else()
     set_tests_properties(qtgrpc_qml_test_http2 PROPERTIES
         ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..:$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
-    if (QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
+    if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
         set_tests_properties(qtgrpc_qml_test_grpc_http PROPERTIES
             ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..:$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
         set_tests_properties(qtgrpc_qml_test_grpc_socket PROPERTIES