Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade gRPC version to 1.48.0 #2784

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions client/clientservice/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 17)

find_package(GRPC REQUIRED)
find_package(absl CONFIG REQUIRED)
find_package(Protobuf CONFIG REQUIRED)
find_package(Boost ${MIN_BOOST_VERSION} COMPONENTS program_options REQUIRED)
find_package(jaegertracing REQUIRED)

Expand All @@ -13,6 +18,7 @@ target_link_libraries(clientservice-lib PUBLIC
concordclient
gRPC::grpc++
gRPC::grpc++_reflection
protobuf::libprotobuf
logging
yaml-cpp
secret_retriever
Expand Down
115 changes: 98 additions & 17 deletions client/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,102 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 17)

project(concord)

find_package(Protobuf REQUIRED)
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")
shgandhi marked this conversation as resolved.
Show resolved Hide resolved
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 protobuf::libprotobuf gRPC::grpc++ absl::synchronization)
target_include_directories(clientservice-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
126 changes: 0 additions & 126 deletions cmake/FindProtobuf.cmake

This file was deleted.

50 changes: 17 additions & 33 deletions install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ install_third_party_libraries() {
pytest \
pycryptodome \
ecdsa \
protobuf==3.15.8 \
grpcio==1.37.1 \
grpcio-tools==1.37.1
protobuf==3.21.5 \
grpcio==1.48.0 \
grpcio-tools==1.48.0
}


Expand Down Expand Up @@ -300,36 +300,20 @@ install_openssl() {
# https://github.com/grpc/grpc/blob/master/test/distrib/cpp/run_distrib_test_cmake.sh
install_grpc() {
cd ${HOME}
git clone -b v1.37.1 --depth 1 --recurse-submodules https://github.com/grpc/grpc && \
cd grpc && \
mkdir -p ${HOME}/grpc/third_party/abseil-cpp/cmake/build && \
cd ${HOME}/grpc/third_party/abseil-cpp/cmake/build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
../.. && \
make -j$(nproc) install && \
mkdir -p ${HOME}/grpc/third_party/protobuf/cmake/build && \
cd ${HOME}/grpc/third_party/protobuf/cmake/build && \
cmake -DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
.. && \
make -j$(nproc) install && \
mkdir -p ${HOME}/grpc/cmake/build && \
cd ${HOME}/grpc/cmake/build && \
cmake -DgRPC_INSTALL=ON \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
../.. && \
make -j$(nproc) install &&
cd ${HOME} && \
rm -r ${HOME}/grpc

git clone -b v1.48.x --depth 1 --recurse-submodules https://github.com/grpc/grpc && \
mkdir -p ${HOME}/grpc/cmake/build && \
cd ${HOME}/grpc/cmake/build && \
cmake -DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_SSL_PROVIDER=package \
-DCMAKE_INSTALL_PREFIX=/opt/grpc \
../.. && \
make -j$(nproc) install && \
cd ${HOME} && \
rm -r ${HOME}/grpc
}

install_prometheus() {
Expand Down
27 changes: 22 additions & 5 deletions kvbc/proto/CMakeLists.txt
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})
Loading