2020-05-22 20:45:13 +00:00
|
|
|
option (ENABLE_GRPC "Use gRPC" ${ENABLE_LIBRARIES})
|
2019-12-29 11:40:55 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT ENABLE_GRPC)
|
2020-08-13 20:10:06 +00:00
|
|
|
if (USE_INTERNAL_GRPC_LIBRARY)
|
2020-08-14 15:44:04 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal gRPC library with ENABLE_GRPC=OFF")
|
|
|
|
endif()
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2020-08-14 10:29:51 +00:00
|
|
|
option (USE_INTERNAL_GRPC_LIBRARY
|
|
|
|
"Set to FALSE to use system gRPC library instead of bundled. (Experimental. Set to OFF on your own risk)"
|
|
|
|
${NOT_UNBUNDLED})
|
2020-08-14 15:44:04 +00:00
|
|
|
|
|
|
|
if (NOT USE_INTERNAL_GRPC_LIBRARY)
|
|
|
|
find_package(grpc)
|
2020-08-14 10:29:51 +00:00
|
|
|
if (NOT GRPC_FOUND)
|
|
|
|
find_path(GRPC_INCLUDE_DIR grpcpp/grpcpp.h)
|
|
|
|
find_library(GRPC_LIBRARY grpc++)
|
|
|
|
endif ()
|
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (GRPC_INCLUDE_DIR AND GRPC_LIBRARY)
|
|
|
|
set (USE_GRPC ON)
|
|
|
|
else()
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system gRPC")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT USE_GRPC)
|
|
|
|
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/grpc/include/grpc++/grpc++.h")
|
|
|
|
message (WARNING "submodule contrib/grpc is missing. To fix try run: \n git submodule update --init --recursive")
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal gRPC")
|
|
|
|
set (USE_INTERNAL_GRPC_LIBRARY OFF)
|
|
|
|
elseif (NOT USE_PROTOBUF)
|
|
|
|
message (WARNING "gRPC requires protobuf which is disabled")
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Will not use internal gRPC without protobuf")
|
|
|
|
set (USE_INTERNAL_GRPC_LIBRARY OFF)
|
2020-05-22 20:45:13 +00:00
|
|
|
else()
|
2020-08-14 15:44:04 +00:00
|
|
|
set (GRPC_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/grpc/include")
|
|
|
|
set (GRPC_LIBRARY "libgrpc++")
|
|
|
|
set (USE_GRPC ON)
|
|
|
|
set (USE_INTERNAL_GRPC_LIBRARY ON)
|
2020-05-22 20:45:13 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2019-12-29 11:40:55 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
message (STATUS "Using gRPC=${USE_GRPC}: ${GRPC_INCLUDE_DIR} : ${GRPC_LIBRARY}")
|