native_grpc_channel_tests.cmake 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. add_executable(qtgrpc_qml_test_grpc_http ${MOC_SOURCES} grpc_http.cpp ${QML_FILES})
  2. add_executable(qtgrpc_qml_test_grpc_socket ${MOC_SOURCES} grpc_socket.cpp ${QML_FILES})
  3. target_link_libraries(qtgrpc_qml_test_grpc_http
  4. PRIVATE
  5. ${QT_VERSIONED_PREFIX}::Qml
  6. ${QT_VERSIONED_PREFIX}::Quick
  7. ${QT_VERSIONED_PREFIX}::Test
  8. ${QT_VERSIONED_PREFIX}::QuickTest
  9. ${QT_PROTOBUF_NAMESPACE}::Grpc
  10. )
  11. target_link_libraries(qtgrpc_qml_test_grpc_socket
  12. PRIVATE
  13. ${QT_VERSIONED_PREFIX}::Qml
  14. ${QT_VERSIONED_PREFIX}::Quick
  15. ${QT_VERSIONED_PREFIX}::Test
  16. ${QT_VERSIONED_PREFIX}::QuickTest
  17. ${QT_PROTOBUF_NAMESPACE}::Grpc
  18. )
  19. _qt_internal_link_protobuf_objects(qtgrpc_qml_test_grpc_http qtgrpc_test_qtprotobuf_gen)
  20. _qt_internal_link_protobuf_objects(qtgrpc_qml_test_grpc_socket qtgrpc_test_qtprotobuf_gen)
  21. if(QT_PROTOBUF_STATIC)
  22. target_link_libraries(qtgrpc_qml_test_grpc_http PRIVATE ${PROTOBUF_QUICK_PLUGIN_NAME} ${GRPC_QUICK_PLUGIN_NAME})
  23. target_link_libraries(qtgrpc_qml_test_grpc_socket PRIVATE ${PROTOBUF_QUICK_PLUGIN_NAME} ${GRPC_QUICK_PLUGIN_NAME})
  24. endif()
  25. add_test(NAME qtgrpc_qml_test_grpc_http
  26. 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>
  27. )
  28. add_test(NAME qtgrpc_qml_test_grpc_socket
  29. COMMAND ${TEST_DRIVER_NAME} $<TARGET_FILE:qtgrpc_qml_test_grpc_socket> $<TARGET_FILE:echoserver> $<TARGET_FILE_NAME:qtgrpc_qml_test_grpc_socket> $<TARGET_FILE_NAME:echoserver>
  30. )
  31. qt_protobuf_internal_add_target_qml(TARGET qtgrpc_qml_test_grpc_http QML_FILES ${QML_FILES})
  32. qt_protobuf_internal_add_target_windeployqt(TARGET qtgrpc_qml_test_grpc_http QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  33. qt_protobuf_internal_add_target_qml(TARGET qtgrpc_qml_test_grpc_socket QML_FILES ${QML_FILES})
  34. qt_protobuf_internal_add_target_windeployqt(TARGET qtgrpc_qml_test_grpc_socket QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  35. if(WIN32)
  36. set_tests_properties(qtgrpc_qml_test_grpc_http PROPERTIES
  37. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..\;$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
  38. set_tests_properties(qtgrpc_qml_test_grpc_socket PROPERTIES
  39. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..\;$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
  40. else()
  41. set_tests_properties(qtgrpc_qml_test_grpc_http PROPERTIES
  42. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..:$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
  43. set_tests_properties(qtgrpc_qml_test_grpc_socket PROPERTIES
  44. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..:$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
  45. endif()