Skip to content

Commit

Permalink
cmake: use fixed version of grpc
Browse files Browse the repository at this point in the history
Signed-off-by: Ettore Di Giacinto <[email protected]>
  • Loading branch information
mudler committed Oct 14, 2023
1 parent bab9125 commit c4eb8fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
sudo apt-get update
sudo apt-get install build-essential ffmpeg
sudo apt-get install -y ca-certificates cmake curl patch libabsl-dev protobuf-compiler-grpc grpc-proto libprotobuf-dev protobuf-compiler
sudo apt-get install -y ca-certificates cmake curl patch libabsl-dev libprotobuf-dev protobuf-compiler
sudo apt-get install -y libopencv-dev && sudo ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2
sudo pip install -r extra/requirements.txt
Expand Down
22 changes: 17 additions & 5 deletions backend/cpp/llama/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
set(CMAKE_CXX_STANDARD 17)

cmake_minimum_required(VERSION 3.15)
set(TARGET grpc-server)
set(_PROTOBUF_LIBPROTOBUF libprotobuf)
set(_REFLECTION grpc++_reflection)

# find_package(Protobuf CONFIG REQUIRED) is not working, see:
# https://gitlab.kitware.com/cmake/cmake/-/issues/24321
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG 1)
option(USE_SYSTEM_GRPC "Use system installed gRPC" OFF)

if(USE_SYSTEM_GRPC)
# Find system-installed gRPC
find_package(gRPC CONFIG REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(
gRPC
GIT_REPOSITORY https://github.com/grpc/grpc
GIT_TAG v1.58.0
)
set(FETCHCONTENT_QUIET OFF)
FetchContent_MakeAvailable(gRPC)
endif()

find_package(Protobuf CONFIG REQUIRED)
find_package(absl CONFIG REQUIRED)
find_package(gRPC CONFIG REQUIRED)

find_program(_PROTOBUF_PROTOC protoc)
set(_GRPC_GRPCPP grpc++)
Expand Down

0 comments on commit c4eb8fd

Please sign in to comment.