vcpkg/ports/grpc/00013-build-upbdefs.patch

29 lines
1.3 KiB
Diff
Raw Normal View History

diff --git a/cmake/upb.cmake b/cmake/upb.cmake
index 59d6813..1ce8bce 100644
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -24,8 +24,21 @@ set(_gRPC_UPB_LIBRARIES upb)
elseif(gRPC_UPB_PROVIDER STREQUAL "package")
find_package(upb CONFIG REQUIRED)
- set(_gRPC_UPB_LIBRARIES upb::upb)
+ set(_gRPC_UPB_LIBRARIES upb)
set(_gRPC_UPB_INCLUDE_DIR)
- set(upb ${_gRPC_UPB_LIBRARIES})
+ add_library(upb STATIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c
+ )
+ set_target_properties(upb PROPERTIES OUTPUT_NAME grpc_upbdefs)
+ target_include_directories(upb PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-generated")
+ target_link_libraries(upb PUBLIC upb::all_libs)
+ if(gRPC_INSTALL)
+ install(TARGETS upb EXPORT gRPCTargets
+ RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
+ )
+ endif()
set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()")
endif()