CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. qt_protobuf_internal_find_dependencies()
  2. set(CMAKE_AUTOMOC OFF)
  3. file(GLOB QML_FILES qml/tst_grpc.qml)
  4. qt5_wrap_cpp(MOC_SOURCES test.h)
  5. add_executable(qtgrpc_qml_test_http2 ${MOC_SOURCES} http2.cpp ${QML_FILES})
  6. target_link_libraries(qtgrpc_qml_test_http2
  7. PRIVATE
  8. ${QT_VERSIONED_PREFIX}::Qml
  9. ${QT_VERSIONED_PREFIX}::Quick
  10. ${QT_VERSIONED_PREFIX}::Test
  11. ${QT_VERSIONED_PREFIX}::QuickTest
  12. ${QT_PROTOBUF_NAMESPACE}::Grpc
  13. )
  14. qtprotobuf_link_target(qtgrpc_qml_test_http2 qtgrpc_test_qtprotobuf_gen)
  15. if(QT_PROTOBUF_STATIC)
  16. target_link_libraries(qtgrpc_qml_test_http2 PRIVATE
  17. ${QT_PROTOBUF_NAMESPACE}::${PROTOBUF_QUICK_PLUGIN_NAME}
  18. ${QT_PROTOBUF_NAMESPACE}::${GRPC_QUICK_PLUGIN_NAME}
  19. )
  20. endif()
  21. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../test_grpc/${TEST_DRIVER_NAME}.in ${TEST_DRIVER_NAME} @ONLY)
  22. add_test(NAME qtgrpc_qml_test_http2
  23. COMMAND ${TEST_DRIVER_NAME}
  24. $<TARGET_FILE:qtgrpc_qml_test_http2>
  25. $<TARGET_FILE:echoserver>
  26. $<TARGET_FILE_NAME:qtgrpc_qml_test_http2>
  27. $<TARGET_FILE_NAME:echoserver>
  28. )
  29. qt_protobuf_internal_add_target_qml(TARGET qtgrpc_qml_test_http2 QML_FILES ${QML_FILES})
  30. qt_protobuf_internal_add_target_windeployqt(TARGET qtgrpc_qml_test_http2 QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  31. if(NOT QT_PROTOBUF_STATIC AND NOT QT_PROTOBUF_STANDALONE_TESTS)
  32. set(path_separator ":")
  33. if(WIN32)
  34. set(path_separator "$<SEMICOLON>")
  35. endif()
  36. set_tests_properties(qtgrpc_qml_test_http2 PROPERTIES
  37. ENVIRONMENT "QML2_IMPORT_PATH=$ENV{QML2_IMPORT_PATH}${path_separator}\
  38. $<TARGET_FILE_DIR:${QT_PROTOBUF_NAMESPACE}::${PROTOBUF_QUICK_PLUGIN_NAME}>/..${path_separator}\
  39. $<TARGET_FILE_DIR:${QT_PROTOBUF_NAMESPACE}::${GRPC_QUICK_PLUGIN_NAME}>/.."
  40. )
  41. endif()
  42. if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
  43. include("${CMAKE_CURRENT_LIST_DIR}/native_grpc_channel_tests.cmake")
  44. endif()