|
|
|
@ -122,6 +122,9 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") |
|
|
|
|
if(TARGET libprotoc) |
|
|
|
|
set(_gRPC_PROTOBUF_PROTOC_LIBRARIES libprotoc) |
|
|
|
|
endif() |
|
|
|
|
if(TARGET protoc) |
|
|
|
|
set(_gRPC_PROTOBUF_PROTOC protoc) |
|
|
|
|
endif() |
|
|
|
|
else() |
|
|
|
|
message(WARNING "gRPC_PROTOBUF_PROVIDER is \"module\" but PROTOBUF_ROOT_DIR is wrong") |
|
|
|
|
endif() |
|
|
|
@ -134,6 +137,9 @@ elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") |
|
|
|
|
if(TARGET protobuf::libprotoc) |
|
|
|
|
set(_gRPC_PROTOBUF_PROTOC_LIBRARIES protobuf::libprotoc) |
|
|
|
|
endif() |
|
|
|
|
if(TARGET protobuf::protoc) |
|
|
|
|
set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) |
|
|
|
|
endif() |
|
|
|
|
set(_gRPC_FIND_PROTOBUF "if(NOT protobuf_FOUND)\n find_package(protobuf CONFIG)\nendif()") |
|
|
|
|
else() |
|
|
|
|
find_package(Protobuf MODULE) |
|
|
|
@ -175,6 +181,55 @@ if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) |
|
|
|
|
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/gRPC") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# Create directory for generated .proto files |
|
|
|
|
set(_gRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens) |
|
|
|
|
file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR}) |
|
|
|
|
|
|
|
|
|
# protobuf_generate_grpc_cpp |
|
|
|
|
# -------------------------- |
|
|
|
|
# |
|
|
|
|
# Add custom commands to process ``.proto`` files to C++ using protoc and |
|
|
|
|
# GRPC plugin:: |
|
|
|
|
# |
|
|
|
|
# protobuf_generate_grpc_cpp [<ARGN>...] |
|
|
|
|
# |
|
|
|
|
# ``ARGN`` |
|
|
|
|
# ``.proto`` files |
|
|
|
|
# |
|
|
|
|
function(protobuf_generate_grpc_cpp) |
|
|
|
|
if(NOT ARGN) |
|
|
|
|
message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files") |
|
|
|
|
return() |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
set(_protobuf_include_path -I .) |
|
|
|
|
foreach(FIL ${ARGN}) |
|
|
|
|
get_filename_component(ABS_FIL ${FIL} ABSOLUTE) |
|
|
|
|
get_filename_component(FIL_WE ${FIL} NAME_WE) |
|
|
|
|
file(RELATIVE_PATH REL_FIL ${CMAKE_SOURCE_DIR} ${ABS_FIL}) |
|
|
|
|
get_filename_component(REL_DIR ${REL_FIL} DIRECTORY) |
|
|
|
|
set(RELFIL_WE "${REL_DIR}/${FIL_WE}") |
|
|
|
|
|
|
|
|
|
add_custom_command( |
|
|
|
|
OUTPUT "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc" |
|
|
|
|
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h" |
|
|
|
|
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc" |
|
|
|
|
"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h" |
|
|
|
|
COMMAND ${_gRPC_PROTOBUF_PROTOC} |
|
|
|
|
ARGS --grpc_out=${_gRPC_PROTO_GENS_DIR} |
|
|
|
|
--cpp_out=${_gRPC_PROTO_GENS_DIR} |
|
|
|
|
--plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> |
|
|
|
|
${_protobuf_include_path} |
|
|
|
|
${REL_FIL} |
|
|
|
|
DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin |
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
|
|
|
|
COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" |
|
|
|
|
VERBATIM) |
|
|
|
|
|
|
|
|
|
set_source_files_properties("${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc" "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h" "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc" "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h" PROPERTIES GENERATED TRUE) |
|
|
|
|
endforeach() |
|
|
|
|
endfunction() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_library(gpr |
|
|
|
|
src/core/lib/profiling/basic_timers.c |
|
|
|
@ -223,6 +278,7 @@ add_library(gpr |
|
|
|
|
src/core/lib/support/wrap_memcpy.c |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(gpr |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
@ -510,6 +566,7 @@ add_library(grpc |
|
|
|
|
src/core/plugin_registry/grpc_plugin_registry.c |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(grpc |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
@ -766,6 +823,7 @@ add_library(grpc_cronet |
|
|
|
|
src/core/plugin_registry/grpc_cronet_plugin_registry.c |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(grpc_cronet |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
@ -1022,6 +1080,7 @@ add_library(grpc_unsecure |
|
|
|
|
src/core/plugin_registry/grpc_unsecure_plugin_registry.c |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(grpc_unsecure |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
@ -1124,6 +1183,7 @@ add_library(grpc++ |
|
|
|
|
src/cpp/codegen/codegen_init.cc |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(grpc++ |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
@ -1461,6 +1521,7 @@ add_library(grpc++_cronet |
|
|
|
|
third_party/nanopb/pb_encode.c |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(grpc++_cronet |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
@ -1595,6 +1656,53 @@ if (gRPC_INSTALL) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_library(grpc++_reflection |
|
|
|
|
src/cpp/ext/proto_server_reflection.cc |
|
|
|
|
src/cpp/ext/proto_server_reflection_plugin.cc |
|
|
|
|
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.pb.cc |
|
|
|
|
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc |
|
|
|
|
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.pb.h |
|
|
|
|
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
protobuf_generate_grpc_cpp( |
|
|
|
|
src/proto/grpc/reflection/v1alpha/reflection.proto |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
target_include_directories(grpc++_reflection |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
|
PRIVATE ${BORINGSSL_ROOT_DIR}/include |
|
|
|
|
PRIVATE ${PROTOBUF_ROOT_DIR}/src |
|
|
|
|
PRIVATE ${ZLIB_INCLUDE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib |
|
|
|
|
PRIVATE ${_gRPC_PROTO_GENS_DIR} |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
target_link_libraries(grpc++_reflection |
|
|
|
|
grpc++ |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
foreach(_hdr |
|
|
|
|
include/grpc++/ext/proto_server_reflection_plugin.h |
|
|
|
|
) |
|
|
|
|
string(REPLACE "include/" "" _path ${_hdr}) |
|
|
|
|
get_filename_component(_path ${_path} PATH) |
|
|
|
|
install(FILES ${_hdr} |
|
|
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" |
|
|
|
|
) |
|
|
|
|
endforeach() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gRPC_INSTALL) |
|
|
|
|
install(TARGETS grpc++_reflection EXPORT gRPCTargets |
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
|
|
|
|
) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_library(grpc++_unsecure |
|
|
|
|
src/cpp/client/insecure_credentials.cc |
|
|
|
|
src/cpp/common/insecure_create_auth_context.cc |
|
|
|
@ -1630,6 +1738,7 @@ add_library(grpc++_unsecure |
|
|
|
|
src/cpp/codegen/codegen_init.cc |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(grpc++_unsecure |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
@ -1764,6 +1873,7 @@ add_library(grpc_plugin_support |
|
|
|
|
src/compiler/ruby_generator.cc |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(grpc_plugin_support |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} |
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include |
|
|
|
|