CMakeLists.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. cmake_minimum_required(VERSION 3.16)
  2. project(grpcaddressbook LANGUAGES CXX)
  3. set(CMAKE_AUTOMOC ON)
  4. set(CMAKE_AUTOUIC ON)
  5. if(NOT DEFINED INSTALL_EXAMPLESDIR)
  6. set(INSTALL_EXAMPLESDIR "examples")
  7. endif()
  8. set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/grpc/addressbook")
  9. find_package(Qt6 REQUIRED COMPONENTS Core Quick Protobuf Grpc)
  10. qt_add_executable(grpcaddressbook
  11. main.cpp
  12. addressbookengine.cpp addressbookengine.h
  13. ../examples_common/universallistmodel.cpp ../examples_common/universallistmodel.h
  14. ../examples_common/universallistmodelbase.cpp ../examples_common/universallistmodel.h
  15. )
  16. target_include_directories(grpcaddressbook PRIVATE ../examples_common)
  17. target_link_libraries(grpcaddressbook PRIVATE
  18. Qt::Core
  19. Qt::Quick
  20. Qt::Protobuf
  21. Qt::Grpc
  22. Qt::Quick
  23. )
  24. qt_add_qml_module(grpcaddressbook
  25. URI examples.grpc.addressbook
  26. VERSION 1.0
  27. QML_FILES
  28. qml/AddContactView.qml
  29. qml/CallPopup.qml
  30. qml/ContactDetails.qml
  31. qml/ContactList.qml
  32. qml/CountryCodesModel.qml
  33. qml/DropDownColumn.qml
  34. qml/FloatingRoundButton.qml
  35. qml/InputRow.qml
  36. qml/main.qml
  37. qml/PhoneInput.qml
  38. qml/PrimaryText.qml
  39. qml/SecondaryText.qml
  40. qml/StackItem.qml
  41. qml/TextInputRow.qml
  42. qml/TextRow.qml
  43. RESOURCES
  44. images/arrow.png
  45. images/back.png
  46. images/call.png
  47. images/check.png
  48. images/drop.png
  49. images/minus.png
  50. images/plus.png
  51. NO_RESOURCE_TARGET_PATH
  52. )
  53. qt_protobuf_generate(TARGET grpcaddressbook
  54. PROTO_FILES
  55. proto/addressbook.proto
  56. QML
  57. )
  58. install(TARGETS grpcaddressbook
  59. RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
  60. BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
  61. LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
  62. )
  63. add_custom_command(TARGET grpcaddressbook
  64. COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/../ssl/cert.pem"
  65. "$<TARGET_FILE_DIR:grpcaddressbook>"
  66. )
  67. install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../ssl/cert.pem"
  68. DESTINATION "${INSTALL_EXAMPLEDIR}"
  69. )