summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-extended/etcd/etcd-cpp-apiv3/0001-cmake-fix-when-cross-compiling.patch66
-rw-r--r--meta-oe/recipes-extended/etcd/etcd-cpp-apiv3_0.15.3.bb6
2 files changed, 71 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/etcd/etcd-cpp-apiv3/0001-cmake-fix-when-cross-compiling.patch b/meta-oe/recipes-extended/etcd/etcd-cpp-apiv3/0001-cmake-fix-when-cross-compiling.patch
new file mode 100644
index 0000000000..d1126aa05b
--- /dev/null
+++ b/meta-oe/recipes-extended/etcd/etcd-cpp-apiv3/0001-cmake-fix-when-cross-compiling.patch
@@ -0,0 +1,66 @@
1From cb79329010d73e36ce64830914005f1c17f8f53c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= <peron.clem@gmail.com>
3Date: Sat, 23 Sep 2023 11:32:18 +0200
4Subject: [PATCH] cmake: fix when cross compiling
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9In order to generate protobuf files CMake need to use the protoc
10and grpc-cpp-plugin compiled for the host architecture.
11
12Unfortunately, the protoc and grpc-cpp-plugin in the gRPC CMake
13configuration file are the one for the target architecture.
14
15Fix this by properly finding the correct executable when
16CMake is cross compiling.
17
18Signed-off-by: Clément Péron <peron.clem@gmail.com>
19---
20 CMakeLists.txt | 28 ++++++++++++++++++++++++++--
21 1 file changed, 26 insertions(+), 2 deletions(-)
22
23diff --git a/CMakeLists.txt b/CMakeLists.txt
24index 5aa1310..80ebad2 100644
25--- a/CMakeLists.txt
26+++ b/CMakeLists.txt
27@@ -120,10 +120,34 @@ if(Protobuf_PROTOC_EXECUTABLE)
28 endif()
29 endif()
30
31+# When cross compiling we look for the native protoc compiler
32+# overwrite protobuf::protoc with the proper protoc
33+if(CMAKE_CROSSCOMPILING)
34+ find_program(Protobuf_PROTOC_EXECUTABLE REQUIRED NAMES protoc)
35+ if(NOT TARGET protobuf::protoc)
36+ add_executable(protobuf::protoc IMPORTED)
37+ endif()
38+ set_target_properties(protobuf::protoc PROPERTIES
39+ IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}")
40+endif()
41+
42 find_package(gRPC QUIET)
43-if(gRPC_FOUND AND TARGET gRPC::grpc AND TARGET gRPC::grpc_cpp_plugin)
44+if(gRPC_FOUND AND TARGET gRPC::grpc)
45+ # When cross compiling we look for the native grpc_cpp_plugin
46+ if(CMAKE_CROSSCOMPILING)
47+ find_program(GRPC_CPP_PLUGIN REQUIRED NAMES grpc_cpp_plugin)
48+ if(NOT TARGET gRPC::grpc_cpp_plugin)
49+ add_executable(gRPC::grpc_cpp_plugin IMPORTED)
50+ endif()
51+ set_target_properties(gRPC::grpc_cpp_plugin PROPERTIES
52+ IMPORTED_LOCATION "${GRPC_CPP_PLUGIN}")
53+ elseif(TARGET gRPC::grpc_cpp_plugin)
54+ get_target_property(GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)
55+ else()
56+ message(FATAL_ERROR "Found gRPC but no gRPC CPP plugin defined")
57+ endif()
58+
59 set(GRPC_LIBRARIES gRPC::gpr gRPC::grpc gRPC::grpc++)
60- get_target_property(GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)
61 get_target_property(GRPC_INCLUDE_DIR gRPC::grpc INTERFACE_INCLUDE_DIRECTORIES)
62 else()
63 include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGRPC.cmake)
64--
652.39.3 (Apple Git-145)
66
diff --git a/meta-oe/recipes-extended/etcd/etcd-cpp-apiv3_0.15.3.bb b/meta-oe/recipes-extended/etcd/etcd-cpp-apiv3_0.15.3.bb
index d724abc3c9..e8299bab5f 100644
--- a/meta-oe/recipes-extended/etcd/etcd-cpp-apiv3_0.15.3.bb
+++ b/meta-oe/recipes-extended/etcd/etcd-cpp-apiv3_0.15.3.bb
@@ -4,7 +4,11 @@ HOMEPAGE = "https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3"
4LICENSE = "BSD-3-Clause" 4LICENSE = "BSD-3-Clause"
5LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=eae7da6a2cd1788a5cf8a9f838cf6450" 5LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=eae7da6a2cd1788a5cf8a9f838cf6450"
6 6
7SRC_URI += "git://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git;branch=master;protocol=https" 7SRC_URI = " \
8 git://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git;branch=master;protocol=https \
9 file://0001-cmake-fix-when-cross-compiling.patch \
10"
11
8SRCREV = "e31ac4d4caa55fa662e207150ba40f8151b7ad96" 12SRCREV = "e31ac4d4caa55fa662e207150ba40f8151b7ad96"
9 13
10inherit cmake 14inherit cmake