kuksa-val: Upgrade to latest
[AGL/meta-agl-demo.git] / recipes-connectivity / kuksa-val / kuksa-val / 0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch
1 From 09eba6eef270a3f75add5c54b5455399aecceaf6 Mon Sep 17 00:00:00 2001
2 From: Scott Murray <scott.murray@konsulko.com>
3 Date: Thu, 6 Oct 2022 11:56:57 -0400
4 Subject: [PATCH 2/3] Fix gRPC configuration for OE cross-compiling
5
6 The gRPC CMake package that kuksa.val pulls in is problematic with
7 respect to cross-compiling with OpenEmbedded's split native and
8 target sysroots, as the location of the grpc_cpp_plugin does not
9 match the (somewhat ill-advised) assumptions in the original
10 upstream gRPC configuration.  To work around this, a patch to
11 gRPC is separately applied to split the plugins into their own
12 optional package, and the logic in grpc.cmake here tweaked to
13 explicitly take cross-compilation into account.
14
15 Upstream-Status: Pending
16
17 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
18 ---
19  kuksa-val-server/grpc.cmake | 13 ++++++++++---
20  1 file changed, 10 insertions(+), 3 deletions(-)
21
22 diff --git a/kuksa-val-server/grpc.cmake b/kuksa-val-server/grpc.cmake
23 index 4d90f1d..d097a69 100644
24 --- a/kuksa-val-server/grpc.cmake
25 +++ b/kuksa-val-server/grpc.cmake
26 @@ -14,14 +14,21 @@ set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library")
27  set(GRPC_VER 1.44.0)
28  
29  find_package(Protobuf)
30 -find_package(gRPC ${GRPC_VER} EXACT CONFIG)
31 +find_package(gRPC ${GRPC_VER} CONFIG)
32 +if(NOT CMAKE_CROSSCOMPILING)
33 +    find_package(gRPCPlugin ${GRPC_VER} CONFIG)
34 +    if(gRPCPlugin_FOUND)
35 +        set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
36 +    endif()
37 +else()
38 +    find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
39 +endif()
40  
41 -if(Protobuf_FOUND AND gRPC_FOUND)
42 +if(Protobuf_FOUND AND gRPC_FOUND AND _GRPC_CPP_PLUGIN_EXECUTABLE)
43      message(STATUS "Using protobuf ${protobuf_VERSION}")
44      message(STATUS "Using gRPC ${gRPC_VERSION}")
45  
46      set(_GRPC_GRPCPP gRPC::grpc++)
47 -    set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
48      set(_REFLECTION gRPC::grpc++_reflection)
49      set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
50  
51 -- 
52 2.37.3
53