-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit upgrades gRPC from 1.37.x to the latest release version 1.48.0. Over the past ten versions of gRPC multiple optimizations and bug fixes have been introduced. Please see https://github.com/grpc/grpc/releases for the detailed breakdown of updates from 1.38.0 to 1.48.0. This upgrade would also allow for batching of updates natively via setting the buffer hint flag for improved performance. This change updates client and TRS CMakeLists files to account for the upgrade.
- Loading branch information
shgandhi
committed
Aug 29, 2022
1 parent
46d876f
commit d6c3236
Showing
6 changed files
with
298 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,105 @@ | ||
find_package(Protobuf REQUIRED) | ||
cmake_minimum_required(VERSION 3.5) | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
project(concord) | ||
|
||
find_package(absl CONFIG REQUIRED) | ||
find_package(GRPC REQUIRED) | ||
|
||
include_directories(${GRPC_INCLUDE_DIR}) | ||
|
||
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_CURRENT_BINARY_DIR} | ||
request/v1/request.proto | ||
event/v1/event.proto | ||
state_snapshot/v1/state_snapshot.proto | ||
../concordclient/proto/concord_client_request/v1/concord_client_request.proto | ||
) | ||
grpc_generate_cpp(GRPC_SRCS GRPC_HDRS ${CMAKE_CURRENT_BINARY_DIR} | ||
request/v1/request.proto | ||
event/v1/event.proto | ||
state_snapshot/v1/state_snapshot.proto | ||
../concordclient/proto/concord_client_request/v1/concord_client_request.proto | ||
) | ||
|
||
add_library(clientservice-proto STATIC ${PROTO_SRCS} ${GRPC_SRCS}) | ||
target_link_libraries(clientservice-proto PRIVATE protobuf::libprotobuf gRPC::grpc++) | ||
# Proto file | ||
get_filename_component(rs_proto "request/v1/request.proto" ABSOLUTE) | ||
get_filename_component(es_proto "event/v1/event.proto" ABSOLUTE) | ||
get_filename_component(ss_proto "state_snapshot/v1/state_snapshot.proto" ABSOLUTE) | ||
get_filename_component(ccr_proto "../concordclient/proto/concord_client_request/v1/concord_client_request.proto" ABSOLUTE) | ||
get_filename_component(rs_proto_path "${rs_proto}" PATH) | ||
get_filename_component(es_proto_path "${es_proto}" PATH) | ||
get_filename_component(ss_proto_path "${ss_proto}" PATH) | ||
get_filename_component(ccr_proto_path "${ccr_proto}" PATH) | ||
|
||
get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION) | ||
|
||
# Generated sources | ||
set(rs_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/request.pb.cc") | ||
set(rs_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/request.pb.h") | ||
set(rs_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/request.grpc.pb.cc") | ||
set(rs_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/request.grpc.pb.h") | ||
add_custom_command( | ||
OUTPUT "${rs_proto_srcs}" "${rs_proto_hdrs}" "${rs_grpc_srcs}" "${rs_grpc_hdrs}" | ||
COMMAND protoc | ||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
-I "${rs_proto_path}" | ||
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}" | ||
"${rs_proto}" | ||
DEPENDS "${rs_proto}") | ||
|
||
set(es_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/event.pb.cc") | ||
set(es_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/event.pb.h") | ||
set(es_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/event.grpc.pb.cc") | ||
set(es_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/event.grpc.pb.h") | ||
add_custom_command( | ||
OUTPUT "${es_proto_srcs}" "${es_proto_hdrs}" "${es_grpc_srcs}" "${es_grpc_hdrs}" | ||
COMMAND protoc | ||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
-I "${es_proto_path}" | ||
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}" | ||
"${es_proto}" | ||
DEPENDS "${es_proto}") | ||
|
||
set(ss_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.pb.cc") | ||
set(ss_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.pb.h") | ||
set(ss_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.grpc.pb.cc") | ||
set(ss_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.grpc.pb.h") | ||
add_custom_command( | ||
OUTPUT "${ss_proto_srcs}" "${ss_proto_hdrs}" "${ss_grpc_srcs}" "${ss_grpc_hdrs}" | ||
COMMAND protoc | ||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
-I "${ss_proto_path}" | ||
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}" | ||
"${ss_proto}" | ||
DEPENDS "${ss_proto}") | ||
|
||
set(ccr_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.pb.cc") | ||
set(ccr_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.pb.h") | ||
set(ccr_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.grpc.pb.cc") | ||
set(ccr_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.grpc.pb.h") | ||
add_custom_command( | ||
OUTPUT "${ccr_proto_srcs}" "${ccr_proto_hdrs}" "${ccr_grpc_srcs}" "${ccr_grpc_hdrs}" | ||
COMMAND protoc | ||
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
-I "${ccr_proto_path}" | ||
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}" | ||
"${ccr_proto}" | ||
DEPENDS "${ccr_proto}") | ||
|
||
|
||
# Include generated *.pb.h files | ||
include_directories("${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
# clientservice-proto | ||
add_library(clientservice-proto STATIC | ||
${rs_grpc_srcs} | ||
${rs_grpc_hdrs} | ||
${rs_proto_srcs} | ||
${rs_proto_hdrs} | ||
${es_grpc_srcs} | ||
${es_grpc_hdrs} | ||
${es_proto_srcs} | ||
${es_proto_hdrs} | ||
${ss_grpc_srcs} | ||
${ss_grpc_hdrs} | ||
${ss_proto_srcs} | ||
${ss_proto_hdrs} | ||
${ccr_grpc_srcs} | ||
${ccr_grpc_hdrs} | ||
${ccr_proto_srcs} | ||
${ccr_proto_hdrs}) | ||
target_link_libraries(clientservice-proto PRIVATE | ||
${_REFLECTION} | ||
${_GRPC_GRPCPP} | ||
${_PROTOBUF_LIBPROTOBUF} | ||
absl::synchronization) | ||
target_include_directories(clientservice-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
find_package(Threads REQUIRED) | ||
|
||
if(GRPC_AS_SUBMODULE) | ||
# One way to build a projects that uses gRPC is to just include the | ||
# entire gRPC project tree via "add_subdirectory". | ||
# This approach is very simple to use, but the are some potential | ||
# disadvantages: | ||
# * it includes gRPC's CMakeLists.txt directly into your build script | ||
# without and that can make gRPC's internal setting interfere with your | ||
# own build. | ||
# * depending on what's installed on your system, the contents of submodules | ||
# in gRPC's third_party/* might need to be available (and there might be | ||
# additional prerequisites required to build them). Consider using | ||
# the gRPC_*_PROVIDER options to fine-tune the expected behavior. | ||
# | ||
# A more robust approach to add dependency on gRPC is using | ||
# cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt). | ||
|
||
# Include the gRPC's cmake build (normally grpc source code would live | ||
# in a git submodule called "third_party/grpc", but this example lives in | ||
# the same repository as gRPC sources, so we just look a few directories up) | ||
add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) | ||
message(STATUS "Using gRPC via add_subdirectory.") | ||
|
||
# After using add_subdirectory, we can now use the grpc targets directly from | ||
# this build. | ||
set(_PROTOBUF_LIBPROTOBUF libprotobuf) | ||
set(_REFLECTION buf_protoc) | ||
if(CMAKE_CROSSCOMPILING) | ||
find_program(_PROTOBUF_PROTOC protoc) | ||
else() | ||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) | ||
endif() | ||
set(_GRPC_GRPCPP grpc++) | ||
if(CMAKE_CROSSCOMPILING) | ||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) | ||
else() | ||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>) | ||
endif() | ||
elseif(GRPC_FETCHCONTENT) | ||
# Another way is to use CMake's FetchContent module to clone gRPC at | ||
# configure time. This makes gRPC's source code available to your project, | ||
# similar to a git submodule. | ||
message(STATUS "Using gRPC via add_subdirectory (FetchContent).") | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
grpc | ||
GIT_REPOSITORY https://github.com/grpc/grpc.git | ||
# when using gRPC, you will actually set this to an existing tag, such as | ||
# v1.25.0, v1.26.0 etc.. | ||
# For the purpose of testing, we override the tag used to the commit | ||
# that's currently under test. | ||
GIT_TAG vGRPC_TAG_VERSION_OF_YOUR_CHOICE) | ||
FetchContent_MakeAvailable(grpc) | ||
|
||
# Since FetchContent uses add_subdirectory under the hood, we can use | ||
# the grpc targets directly from this build. | ||
set(_PROTOBUF_LIBPROTOBUF libprotobuf) | ||
set(_REFLECTION grpc++_reflection) | ||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>) | ||
set(_GRPC_GRPCPP grpc++) | ||
if(CMAKE_CROSSCOMPILING) | ||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) | ||
else() | ||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>) | ||
endif() | ||
else() | ||
# This branch assumes that gRPC and all its dependencies are already installed | ||
# on this system, so they can be located by find_package(). | ||
|
||
# Include Concord-bft CMake dependencies. | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake") | ||
|
||
# Find Protobuf installation | ||
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation. | ||
set(protobuf_MODULE_COMPATIBLE TRUE) | ||
find_package(Protobuf REQUIRED) | ||
message(STATUS "Using protobuf ${Protobuf_VERSION}") | ||
|
||
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) | ||
set(_REFLECTION gRPC::grpc++_reflection) | ||
if(CMAKE_CROSSCOMPILING) | ||
find_program(_PROTOBUF_PROTOC protoc) | ||
else() | ||
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) | ||
endif() | ||
|
||
# Find gRPC installation | ||
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. | ||
find_package(GRPC REQUIRED) | ||
include_directories(${GRPC_INCLUDE_DIR}) | ||
message(STATUS "Using gRPC ${gRPC_VERSION}") | ||
|
||
set(_GRPC_GRPCPP gRPC::grpc++) | ||
if(CMAKE_CROSSCOMPILING) | ||
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) | ||
else() | ||
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
find_package(Protobuf REQUIRED) | ||
cmake_minimum_required(VERSION 3.5) | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
find_package(absl CONFIG REQUIRED) | ||
find_package(GRPC REQUIRED) | ||
find_package(Protobuf CONFIG REQUIRED) | ||
|
||
# Proto file | ||
get_filename_component(concord_kvbc_proto "concord_kvbc.proto" ABSOLUTE) | ||
get_filename_component(concord_kvbc_proto_path "${concord_kvbc_proto}" PATH) | ||
|
||
set(ck_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/concord_kvbc.pb.cc") | ||
set(ck_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/concord_kvbc.pb.h") | ||
|
||
add_custom_command( | ||
OUTPUT "${ck_proto_srcs}" "${ck_proto_hdrs}" | ||
COMMAND protoc | ||
ARGS --proto_path="${concord_kvbc_proto_path}" | ||
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}" | ||
"${concord_kvbc_proto}" | ||
DEPENDS "${concord_kvbc_proto}") | ||
|
||
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_CURRENT_BINARY_DIR} | ||
concord_kvbc.proto | ||
) | ||
message(STATUS "Concord KVBC protobuf generated - see " ${CMAKE_CURRENT_BINARY_DIR}) | ||
|
||
add_library(concord-kvbc-proto STATIC ${PROTO_SRCS}) | ||
add_library(concord-kvbc-proto STATIC ${ck_proto_srcs}) | ||
target_link_libraries(concord-kvbc-proto protobuf::libprotobuf) | ||
target_include_directories(concord-kvbc-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) |
Oops, something went wrong.