2023-04-11 16:16:26 +00:00
|
|
|
set(ENABLE_GRPC_DEFAULT ${ENABLE_LIBRARIES})
|
2022-01-17 07:36:58 +00:00
|
|
|
option(ENABLE_GRPC "Use gRPC" ${ENABLE_GRPC_DEFAULT})
|
|
|
|
|
|
|
|
if(NOT ENABLE_GRPC)
|
|
|
|
message(STATUS "Not using gRPC")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2020-09-30 22:28:23 +00:00
|
|
|
set(_gRPC_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/grpc")
|
|
|
|
set(_gRPC_BINARY_DIR "${ClickHouse_BINARY_DIR}/contrib/grpc")
|
2019-12-27 13:33:42 +00:00
|
|
|
|
2022-01-17 07:36:58 +00:00
|
|
|
if(TARGET OpenSSL::SSL)
|
|
|
|
set(gRPC_USE_UNSECURE_LIBRARIES FALSE)
|
|
|
|
else()
|
|
|
|
set(gRPC_USE_UNSECURE_LIBRARIES TRUE)
|
|
|
|
endif()
|
|
|
|
|
2023-11-19 14:21:11 +00:00
|
|
|
include(grpc.cmake)
|
|
|
|
include(protobuf_generate_grpc.cmake)
|
2022-01-17 07:36:58 +00:00
|
|
|
|
|
|
|
set(gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>)
|
|
|
|
set(gRPC_PYTHON_PLUGIN $<TARGET_FILE:grpc_python_plugin>)
|
|
|
|
|
|
|
|
set(gRPC_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/grpc/include")
|
|
|
|
if(gRPC_USE_UNSECURE_LIBRARIES)
|
|
|
|
set(gRPC_LIBRARIES grpc_unsecure grpc++_unsecure)
|
|
|
|
else()
|
|
|
|
set(gRPC_LIBRARIES grpc grpc++)
|
|
|
|
endif()
|
|
|
|
add_library(_ch_contrib_grpc INTERFACE)
|
|
|
|
target_link_libraries(_ch_contrib_grpc INTERFACE ${gRPC_LIBRARIES})
|
|
|
|
target_include_directories(_ch_contrib_grpc SYSTEM INTERFACE ${gRPC_INCLUDE_DIRS})
|
|
|
|
add_library(ch_contrib::grpc ALIAS _ch_contrib_grpc)
|