Skip to content

Commit

Permalink
Upgrade C++ grpc version to 1.44 (#980)
Browse files Browse the repository at this point in the history
* Upgrade the grpc to v1.44.0

Signed-off-by: JaySon-Huang <[email protected]>
  • Loading branch information
JaySon-Huang authored Aug 31, 2022
1 parent 9cc5e1d commit 1c389f1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/cpp-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:
run: sudo apt install -y cmake clang libclang-dev llvm llvm-dev
- name: Cache gRPC
id: cache-grpc
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/grpcinstall/v1_26_0
key: ${{ runner.os }}-gRPC-v1_26_0-t0
path: ~/grpcinstall/v1_44_0
key: ${{ runner.os }}-gRPC-v1_44_0-t0
- name: Install gRPC
if: steps.cache-grpc.outputs.cache-hit != 'true'
run: |
export GRPC_INSTALL_PATH=~/grpcinstall/v1_26_0 && mkdir -p $GRPC_INSTALL_PATH
export GRPC_INSTALL_PATH=~/grpcinstall/v1_44_0 && mkdir -p $GRPC_INSTALL_PATH
git clone https://github.com/grpc/grpc.git
pushd grpc && git checkout v1.26.0 && git submodule update --init
pushd grpc && git checkout v1.44.0 && git submodule update --init
mkdir -p grpcbuild && pushd grpcbuild && cmake .. -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$GRPC_INSTALL_PATH && make install && popd
rm -rf grpcbuild && mkdir -p grpcbuild && pushd grpcbuild && cmake .. -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$GRPC_INSTALL_PATH && make install && popd
popd
- name: Test C++
run: |
export GRPC_INSTALL_PATH=~/grpcinstall/v1_26_0
export GRPC_INSTALL_PATH=~/grpcinstall/v1_44_0
export PATH="$GRPC_INSTALL_PATH/bin:$PATH"
rm -rf kvprotobuild && mkdir kvprotobuild && pushd kvprotobuild && cmake ../cpp -DCMAKE_PREFIX_PATH=$GRPC_INSTALL_PATH && make && popd && rm -rf kvprotobuild
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ Cargo.lock
.idea
_tools

cpp/
!cpp/cmake/
!cpp/CMakeLists.txt
cpp/kvproto/
proto-cpp/
kvprotobuild

Expand Down
9 changes: 8 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project (kvproto)

cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.5)

set (CMAKE_CXX_STANDARD 17)

Expand All @@ -22,6 +22,10 @@ if (NOT gRPC_FOUND)
include (cmake/find_grpc.cmake)
endif ()

if (NOT ABSL_ROOT_DIR)
include (cmake/find_abseil-cpp.cmake)
endif ()

# .proto files under "proto"
set (PROTO_DEF_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../proto")
file (GLOB PROTO_DEFS "${PROTO_DEF_DIR}/*.proto")
Expand Down Expand Up @@ -124,6 +128,9 @@ set_source_files_properties(
add_library(kvproto
${PROTO_SRCS} ${PROTO_HDRS}
)
target_link_libraries(kvproto
absl::synchronization
)
target_include_directories(kvproto PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
# Need this to find headers "google/api/http.pb.h" "google/api/annotations.pb.h"
Expand Down
2 changes: 2 additions & 0 deletions cpp/cmake/find_abseil-cpp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
find_package(absl REQUIRED)
message(STATUS "Using absl: dir=${absl_DIR}, version=${absl_VERSION}")

0 comments on commit 1c389f1

Please sign in to comment.