CMakeLists.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 ${PROTOBUF_QUICK_PLUGIN_NAME} ${GRPC_QUICK_PLUGIN_NAME})
  17. endif()
  18. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../test_grpc/${TEST_DRIVER_NAME}.in ${TEST_DRIVER_NAME} @ONLY)
  19. add_test(NAME qtgrpc_qml_test_http2
  20. COMMAND ${TEST_DRIVER_NAME}
  21. $<TARGET_FILE:qtgrpc_qml_test_http2>
  22. $<TARGET_FILE:echoserver>
  23. $<TARGET_FILE_NAME:qtgrpc_qml_test_http2>
  24. $<TARGET_FILE_NAME:echoserver>
  25. )
  26. qt_protobuf_internal_add_target_qml(TARGET qtgrpc_qml_test_http2 QML_FILES ${QML_FILES})
  27. qt_protobuf_internal_add_target_windeployqt(TARGET qtgrpc_qml_test_http2 QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  28. if(WIN32)
  29. set_tests_properties(qtgrpc_qml_test_http2 PROPERTIES
  30. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..\;$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
  31. else()
  32. set_tests_properties(qtgrpc_qml_test_http2 PROPERTIES
  33. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..:$<TARGET_FILE_DIR:${GRPC_QUICK_PLUGIN_NAME}>/..)
  34. endif()
  35. if(QT_PROTOBUF_NATIVE_GRPC_CHANNEL)
  36. include("${CMAKE_CURRENT_LIST_DIR}/native_grpc_channel_tests.cmake")
  37. endif()