CMakeLists.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. unset(extra_generator_args)
  2. if(TARGET Qt::Qml)
  3. list(APPEND extra_generator_args QML)
  4. endif()
  5. qt6_protobuf_generate(GENERATED_TARGET tst_protobuf_basictypes_gen
  6. PROTO_FILES
  7. proto/basicmessages.proto
  8. FIELDENUM
  9. ${extra_generator_args}
  10. OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated"
  11. )
  12. qt_internal_add_test(tst_protobuf_basictypes
  13. SOURCES
  14. basictypes.cpp
  15. INCLUDE_DIRECTORIES
  16. ../../shared
  17. LIBRARIES
  18. Qt::Test
  19. Qt::Protobuf
  20. )
  21. _qt_internal_link_protobuf_objects(tst_protobuf_basictypes tst_protobuf_basictypes_gen)
  22. qt6_protobuf_generate(GENERATED_TARGET tst_protobuf_repeatedtypes_gen
  23. PROTO_FILES
  24. proto/repeatedmessages.proto
  25. FIELDENUM
  26. ${extra_generator_args}
  27. OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated"
  28. )
  29. qt_internal_add_test(tst_protobuf_repeatedtypes
  30. SOURCES
  31. repeatedtypes.cpp
  32. INCLUDE_DIRECTORIES
  33. ../../shared
  34. LIBRARIES
  35. Qt::Test
  36. Qt::Protobuf
  37. )
  38. _qt_internal_link_protobuf_objects(tst_protobuf_repeatedtypes
  39. tst_protobuf_basictypes_gen
  40. tst_protobuf_repeatedtypes_gen
  41. )
  42. qt6_protobuf_generate(GENERATED_TARGET tst_protobuf_maptypes_gen
  43. PROTO_FILES
  44. proto/mapmessages.proto
  45. FIELDENUM
  46. ${extra_generator_args}
  47. OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated"
  48. )
  49. qt_internal_add_test(tst_protobuf_maptypes
  50. SOURCES
  51. maptypes.cpp
  52. INCLUDE_DIRECTORIES
  53. ../../shared
  54. LIBRARIES
  55. Qt::Test
  56. Qt::Protobuf
  57. )
  58. _qt_internal_link_protobuf_objects(tst_protobuf_maptypes
  59. tst_protobuf_basictypes_gen
  60. tst_protobuf_maptypes_gen
  61. )
  62. qt6_protobuf_generate(GENERATED_TARGET tst_protobuf_fieldindexrange_gen
  63. PROTO_FILES
  64. proto/fieldindexrange.proto
  65. FIELDENUM
  66. ${extra_generator_args}
  67. OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated"
  68. )
  69. qt_internal_add_test(tst_protobuf_serialization_basictypes
  70. SOURCES
  71. serializationbasictypes.cpp
  72. LIBRARIES
  73. Qt::Test
  74. Qt::Protobuf
  75. )
  76. _qt_internal_link_protobuf_objects(tst_protobuf_serialization_basictypes
  77. tst_protobuf_basictypes_gen
  78. tst_protobuf_fieldindexrange_gen
  79. )
  80. qt_internal_add_test(tst_protobuf_serialization_repeatedtypes
  81. SOURCES
  82. serializationrepeatedtypes.cpp
  83. LIBRARIES
  84. Qt::Test
  85. Qt::Protobuf
  86. )
  87. _qt_internal_link_protobuf_objects(tst_protobuf_serialization_repeatedtypes
  88. tst_protobuf_basictypes_gen
  89. tst_protobuf_repeatedtypes_gen
  90. )
  91. qt_internal_add_test(tst_protobuf_serialization_maptypes
  92. SOURCES
  93. serializationmaptypes.cpp serializationmaptypes.h
  94. serializationcomplexmaptypes.cpp
  95. LIBRARIES
  96. Qt::Test
  97. Qt::Protobuf
  98. )
  99. _qt_internal_link_protobuf_objects(tst_protobuf_serialization_maptypes
  100. tst_protobuf_basictypes_gen
  101. tst_protobuf_maptypes_gen
  102. )
  103. qt_internal_add_test(tst_protobuf_deserialization_basictypes
  104. SOURCES
  105. deserializationbasictypes.cpp
  106. LIBRARIES
  107. Qt::Test
  108. Qt::Protobuf
  109. )
  110. _qt_internal_link_protobuf_objects(tst_protobuf_deserialization_basictypes
  111. tst_protobuf_basictypes_gen
  112. tst_protobuf_fieldindexrange_gen
  113. )
  114. qt_internal_add_test(tst_protobuf_deserialization_repeatedtypes
  115. SOURCES
  116. deserializationrepeatedtypes.cpp
  117. LIBRARIES
  118. Qt::Test
  119. Qt::Protobuf
  120. )
  121. _qt_internal_link_protobuf_objects(tst_protobuf_deserialization_repeatedtypes
  122. tst_protobuf_basictypes_gen
  123. tst_protobuf_repeatedtypes_gen
  124. )
  125. qt_internal_add_test(tst_protobuf_deserialization_maptypes
  126. SOURCES
  127. deserializationmaptypes.cpp deserializationmaptypes.h
  128. deserializationcomplexmaptypes.cpp
  129. LIBRARIES
  130. Qt::Test
  131. Qt::Protobuf
  132. )
  133. _qt_internal_link_protobuf_objects(tst_protobuf_deserialization_maptypes
  134. tst_protobuf_basictypes_gen
  135. tst_protobuf_maptypes_gen
  136. )
  137. if(UNIX AND NOT CMAKE_CROSSCOMPILING)
  138. qt_internal_add_test(tst_protobuf_internals
  139. SOURCES
  140. internalstest.cpp
  141. LIBRARIES
  142. Qt::Test
  143. Qt::Protobuf
  144. )
  145. _qt_internal_link_protobuf_objects(tst_protobuf_internals tst_protobuf_basictypes_gen)
  146. endif()
  147. #if(QT_FEATURE_protobuf_json_serializer)
  148. add_subdirectory(json)
  149. #endif()
  150. if(TARGET Qt::QuickTest)
  151. add_subdirectory(qml)
  152. endif()