Advertisement
AntonyZhilin

Untitled

Jun 1st, 2023 (edited)
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.17 KB | None | 0 0
  1. ---
  2. Index: userver/cmake/SetupGoogleProtoApis.cmake
  3. IDEA additional info:
  4. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  5. <+>UTF-8
  6. ===================================================================
  7. diff --git a/userver/cmake/SetupGoogleProtoApis.cmake b/userver/cmake/SetupGoogleProtoApis.cmake
  8. --- a/userver/cmake/SetupGoogleProtoApis.cmake  (revision b48f3298f1f418c49e80c15a88ad545ae585539c)
  9. +++ b/userver/cmake/SetupGoogleProtoApis.cmake  (date 1685610867002)
  10. @@ -52,7 +52,7 @@
  11.  add_library(userver-api-common-protos STATIC ${generated_sources})
  12.  target_compile_options(userver-api-common-protos PUBLIC -Wno-unused-parameter)
  13.  target_include_directories(userver-api-common-protos SYSTEM PUBLIC ${include_paths})
  14. -target_link_libraries(userver-api-common-protos PUBLIC userver-core userver-grpc-internal-deps)
  15. +target_link_libraries(userver-api-common-protos PUBLIC userver-core userver-grpc-deps)
  16.  
  17.  set(api-common-proto_LIBRARY userver-api-common-protos)
  18.  set(api-common-proto_USRV_SOURCES ${generated_usrv_sources})
  19. Index: userver/grpc/CMakeLists.txt
  20. IDEA additional info:
  21. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  22. <+>UTF-8
  23. ===================================================================
  24. diff --git a/userver/grpc/CMakeLists.txt b/userver/grpc/CMakeLists.txt
  25. --- a/userver/grpc/CMakeLists.txt   (revision b48f3298f1f418c49e80c15a88ad545ae585539c)
  26. +++ b/userver/grpc/CMakeLists.txt   (date 1685610632747)
  27. @@ -1,5 +1,6 @@
  28. -project(userver-grpc-internal CXX)
  29. +project(userver-grpc CXX)
  30.  
  31. +include(SetupProtobuf)
  32.  include(GrpcTargets)
  33.  
  34.  add_library(${PROJECT_NAME}-deps INTERFACE)
  35. @@ -43,11 +45,11 @@
  36.    list(APPEND SOURCES ${api-common-proto_USRV_SOURCES})
  37.  endif()
  38.  
  39. -add_library(${PROJECT_NAME} STATIC ${SOURCES})
  40. +add_library(${PROJECT_NAME}-internal STATIC ${SOURCES})
  41.  
  42. -set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
  43. +set_target_properties(${PROJECT_NAME}-internal PROPERTIES LINKER_LANGUAGE CXX)
  44.  
  45. -target_include_directories(${PROJECT_NAME}
  46. +target_include_directories(${PROJECT_NAME}-internal
  47.    PUBLIC
  48.      ${CMAKE_CURRENT_SOURCE_DIR}/include
  49.    PRIVATE
  50. @@ -55,10 +57,10 @@
  51.  )
  52.  
  53.  if (DEFINED api-common-proto_LIBRARY)
  54. -  target_link_libraries(${PROJECT_NAME} PUBLIC ${api-common-proto_LIBRARY})
  55. +  target_link_libraries(${PROJECT_NAME}-internal PUBLIC ${api-common-proto_LIBRARY})
  56.  endif()
  57.  
  58. -target_link_libraries(${PROJECT_NAME} PUBLIC userver-core)
  59. +target_link_libraries(${PROJECT_NAME}-internal PUBLIC userver-core)
  60.  
  61.  set(CHANNELZ_MIN_VERSION "1.17.0")
  62.  if (${gRPC_VERSION} VERSION_GREATER_EQUAL ${CHANNELZ_MIN_VERSION})
  63. @@ -81,15 +83,15 @@
  64.              add_library(gRPC::grpcpp_channelz ALIAS GrpcChannelz)
  65.          endif()
  66.      endif()
  67. -    target_link_libraries(${PROJECT_NAME} PUBLIC gRPC::grpcpp_channelz)
  68. +    target_link_libraries(${PROJECT_NAME}-internal PUBLIC gRPC::grpcpp_channelz)
  69.  else()
  70.      message(STATUS "gRPC Channelz disabled, install gRPC >= ${CHANNELZ_MIN_VERSION} to enable")
  71. -    target_compile_definitions(${PROJECT_NAME} PRIVATE
  72. +    target_compile_definitions(${PROJECT_NAME}-internal PRIVATE
  73.          "USERVER_DISABLE_GRPC_CHANNELZ=1"
  74.      )
  75.  endif()
  76.  
  77. -target_link_libraries(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}-deps)
  78. +target_link_libraries(${PROJECT_NAME}-internal PUBLIC ${PROJECT_NAME}-deps)
  79.  
  80.  if (USERVER_IS_THE_ROOT_PROJECT)
  81.      add_executable(${PROJECT_NAME}_unittest ${UNIT_TEST_SOURCES})
  82. @@ -99,7 +101,7 @@
  83.      )
  84.      target_link_libraries(${PROJECT_NAME}_unittest
  85.        PUBLIC
  86. -        ${PROJECT_NAME}
  87. +        ${PROJECT_NAME}-internal
  88.          userver-utest
  89.        PRIVATE
  90.          ${PROJECT_NAME}_unittest_proto
  91. @@ -113,6 +115,6 @@
  92.  
  93.  add_subdirectory(handlers)
  94.  
  95. -add_library(userver-grpc INTERFACE)
  96. -target_link_libraries(userver-grpc INTERFACE userver-grpc-handlers)
  97. -target_link_libraries(userver-grpc INTERFACE userver-grpc-internal)
  98. +add_library(${PROJECT_NAME} INTERFACE)
  99. +target_link_libraries(${PROJECT_NAME} INTERFACE ${PROJECT_NAME}-handlers)
  100. +target_link_libraries(${PROJECT_NAME} INTERFACE ${PROJECT_NAME}-internal)
  101. Index: userver/cmake/GrpcTargets.cmake
  102. IDEA additional info:
  103. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  104. <+>UTF-8
  105. ===================================================================
  106. diff --git a/userver/cmake/GrpcTargets.cmake b/userver/cmake/GrpcTargets.cmake
  107. --- a/userver/cmake/GrpcTargets.cmake   (revision b48f3298f1f418c49e80c15a88ad545ae585539c)
  108. +++ b/userver/cmake/GrpcTargets.cmake   (date 1685610463897)
  109. @@ -4,17 +4,21 @@
  110.  
  111.  if (USERVER_CONAN)
  112.    find_package(gRPC REQUIRED)
  113. -  set(GRPC_PROTOBUF_INCLUDE_DIRS "${protobuf_INCLUDE_DIR}")
  114. +  set(USERVER_PROTOBUF_IMPORT_DIR "${protobuf_INCLUDE_DIR}")
  115.    get_target_property(PROTO_GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)
  116.    get_target_property(PROTO_GRPC_PYTHON_PLUGIN gRPC::grpc_python_plugin LOCATION)
  117.  else()
  118. -  # Use the builtin CMake FindProtobuf
  119. -  set(GRPC_PROTOBUF_INCLUDE_DIRS "${Protobuf_INCLUDE_DIRS}")
  120. +  # Relying on having found Protobuf in root userver CMakeLists.txt
  121. +  if(Protobuf_INCLUDE_DIR)
  122. +    set(USERVER_PROTOBUF_IMPORT_DIR "${Protobuf_INCLUDE_DIR}")
  123. +  else()
  124. +    set(USERVER_PROTOBUF_IMPORT_DIR "${Protobuf_INCLUDE_DIRS}")
  125. +  endif()
  126.  
  127.    include(SetupGrpc)
  128.  endif()
  129.  
  130. -if (NOT GRPC_PROTOBUF_INCLUDE_DIRS)
  131. +if (NOT USERVER_PROTOBUF_IMPORT_DIR)
  132.    message(FATAL_ERROR "Invalid Protobuf package")
  133.  endif()
  134.  if (NOT gRPC_VERSION)
  135. @@ -110,7 +114,7 @@
  136.    list(TRANSFORM proto_dependencies_globs APPEND "/*.proto")
  137.    list(APPEND proto_dependencies_globs
  138.      "${root_path}/*.proto"
  139. -    "${GRPC_PROTOBUF_INCLUDE_DIRS}/*.proto"
  140. +    "${USERVER_PROTOBUF_IMPORT_DIR}/*.proto"
  141.      "${USERVER_DIR}/scripts/grpc/*"
  142.    )
  143.    file(GLOB_RECURSE proto_dependencies ${proto_dependencies_globs})
  144. @@ -151,7 +155,7 @@
  145.                --grpc_python_out=${GENERATED_PROTO_DIR}
  146.                ${pyi_out_param}
  147.                -I ${root_path}
  148. -              -I ${GRPC_PROTOBUF_INCLUDE_DIRS}
  149. +              -I ${USERVER_PROTOBUF_IMPORT_DIR}
  150.                --plugin=protoc-gen-grpc=${PROTO_GRPC_CPP_PLUGIN}
  151.                --plugin=protoc-gen-usrv=${PROTO_GRPC_USRV_PLUGIN}
  152.                --plugin=protoc-gen-grpc_python=${PROTO_GRPC_PYTHON_PLUGIN}
  153.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement