From 09eba6eef270a3f75add5c54b5455399aecceaf6 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Thu, 6 Oct 2022 11:56:57 -0400 Subject: [PATCH 2/3] Fix gRPC configuration for OE cross-compiling The gRPC CMake package that kuksa.val pulls in is problematic with respect to cross-compiling with OpenEmbedded's split native and target sysroots, as the location of the grpc_cpp_plugin does not match the (somewhat ill-advised) assumptions in the original upstream gRPC configuration. To work around this, a patch to gRPC is separately applied to split the plugins into their own optional package, and the logic in grpc.cmake here tweaked to explicitly take cross-compilation into account. Upstream-Status: Pending Signed-off-by: Scott Murray --- kuksa-val-server/grpc.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kuksa-val-server/grpc.cmake b/kuksa-val-server/grpc.cmake index 4d90f1d..d097a69 100644 --- a/kuksa-val-server/grpc.cmake +++ b/kuksa-val-server/grpc.cmake @@ -14,14 +14,21 @@ set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library") set(GRPC_VER 1.44.0) find_package(Protobuf) -find_package(gRPC ${GRPC_VER} EXACT CONFIG) +find_package(gRPC ${GRPC_VER} CONFIG) +if(NOT CMAKE_CROSSCOMPILING) + find_package(gRPCPlugin ${GRPC_VER} CONFIG) + if(gRPCPlugin_FOUND) + set(_GRPC_CPP_PLUGIN_EXECUTABLE $) + endif() +else() + find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) +endif() -if(Protobuf_FOUND AND gRPC_FOUND) +if(Protobuf_FOUND AND gRPC_FOUND AND _GRPC_CPP_PLUGIN_EXECUTABLE) message(STATUS "Using protobuf ${protobuf_VERSION}") message(STATUS "Using gRPC ${gRPC_VERSION}") set(_GRPC_GRPCPP gRPC::grpc++) - set(_GRPC_CPP_PLUGIN_EXECUTABLE $) set(_REFLECTION gRPC::grpc++_reflection) set(_PROTOBUF_PROTOC $) -- 2.37.3