[meta-oe,1/2] grpc: add cmake support for target

Message ID 20220407114406.6828-1-stefan.herbrechtsmeier-oss@weidmueller.com
State New
Headers show
Series [meta-oe,1/2] grpc: add cmake support for target | expand

Commit Message

Stefan Herbrechtsmeier April 7, 2022, 11:44 a.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

The CMake gRPC config checks for binaries and fails if a binary (plugin)
is missing. Fix the problem in the code and add the CMake gRPC config
back to the target package.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---

 ...d-separate-export-for-plugin-targets.patch | 93 +++++++++++++++++++
 meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb  |  3 +-
 2 files changed, 94 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch

Comments

Khem Raj April 7, 2022, 9:39 p.m. UTC | #1
can you rebase it on top of latest master or master-next and resend, we 
now have grpc 1.45.1 in master.

On 4/7/22 7:44 AM, Stefan Herbrechtsmeier wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> The CMake gRPC config checks for binaries and fails if a binary (plugin)
> is missing. Fix the problem in the code and add the CMake gRPC config
> back to the target package.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> ---
> 
>   ...d-separate-export-for-plugin-targets.patch | 93 +++++++++++++++++++
>   meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb  |  3 +-
>   2 files changed, 94 insertions(+), 2 deletions(-)
>   create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch
> 
> diff --git a/meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch b/meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch
> new file mode 100644
> index 000000000..679bd3882
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch
> @@ -0,0 +1,93 @@
> +From 3150cb043363e05588062dd392b940be25594713 Mon Sep 17 00:00:00 2001
> +From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> +Date: Tue, 18 Feb 2020 14:17:07 +0100
> +Subject: [PATCH] cmake: add separate export for plugin targets
> +
> +Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/29328]
> +
> +
> +---
> + CMakeLists.txt | 18 +++++++++++-------
> + 1 file changed, 11 insertions(+), 7 deletions(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index efdaf8936d..6608b1b00c 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -10935,7 +10935,7 @@ target_link_libraries(grpc_cpp_plugin
> +
> +
> + if(gRPC_INSTALL)
> +-  install(TARGETS grpc_cpp_plugin EXPORT gRPCTargets
> ++  install(TARGETS grpc_cpp_plugin EXPORT gRPCPluginTargets
> +     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
> +     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
> +     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
> +@@ -10975,7 +10975,7 @@ target_link_libraries(grpc_csharp_plugin
> +
> +
> + if(gRPC_INSTALL)
> +-  install(TARGETS grpc_csharp_plugin EXPORT gRPCTargets
> ++  install(TARGETS grpc_csharp_plugin EXPORT gRPCPluginTargets
> +     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
> +     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
> +     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
> +@@ -11015,7 +11015,7 @@ target_link_libraries(grpc_node_plugin
> +
> +
> + if(gRPC_INSTALL)
> +-  install(TARGETS grpc_node_plugin EXPORT gRPCTargets
> ++  install(TARGETS grpc_node_plugin EXPORT gRPCPluginTargets
> +     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
> +     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
> +     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
> +@@ -11055,7 +11055,7 @@ target_link_libraries(grpc_objective_c_plugin
> +
> +
> + if(gRPC_INSTALL)
> +-  install(TARGETS grpc_objective_c_plugin EXPORT gRPCTargets
> ++  install(TARGETS grpc_objective_c_plugin EXPORT gRPCPluginTargets
> +     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
> +     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
> +     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
> +@@ -11095,7 +11095,7 @@ target_link_libraries(grpc_php_plugin
> +
> +
> + if(gRPC_INSTALL)
> +-  install(TARGETS grpc_php_plugin EXPORT gRPCTargets
> ++  install(TARGETS grpc_php_plugin EXPORT gRPCPluginTargets
> +     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
> +     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
> +     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
> +@@ -11135,7 +11135,7 @@ target_link_libraries(grpc_python_plugin
> +
> +
> + if(gRPC_INSTALL)
> +-  install(TARGETS grpc_python_plugin EXPORT gRPCTargets
> ++  install(TARGETS grpc_python_plugin EXPORT gRPCPluginTargets
> +     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
> +     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
> +     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
> +@@ -11175,7 +11175,7 @@ target_link_libraries(grpc_ruby_plugin
> +
> +
> + if(gRPC_INSTALL)
> +-  install(TARGETS grpc_ruby_plugin EXPORT gRPCTargets
> ++  install(TARGETS grpc_ruby_plugin EXPORT gRPCPluginTargets
> +     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
> +     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
> +     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
> +@@ -17349,6 +17349,10 @@ if(gRPC_INSTALL)
> +     DESTINATION ${gRPC_INSTALL_CMAKEDIR}
> +     NAMESPACE gRPC::
> +   )
> ++  install(EXPORT gRPCPluginTargets
> ++    DESTINATION ${gRPC_INSTALL_CMAKEDIR}
> ++    NAMESPACE gRPC::
> ++  )
> + endif()
> +
> + include(CMakePackageConfigHelpers)
> +--
> +2.30.2
> +
> diff --git a/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb b/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb
> index d25a01cf3..d50fd2727 100644
> --- a/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb
> +++ b/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb
> @@ -24,6 +24,7 @@ SRCREV_grpc = "494b08ada4009ead0d0b70e44d354be72f9c283a"
>   BRANCH = "v1.45.x"
>   SRC_URI = "git://github.com/grpc/grpc.git;protocol=https;name=grpc;branch=${BRANCH} \
>              file://0001-Revert-Changed-GRPCPP_ABSEIL_SYNC-to-GPR_ABSEIL_SYNC.patch \
> +           file://0001-cmake-add-separate-export-for-plugin-targets.patch \
>              "
>   # Fixes build with older compilers 4.8 especially on ubuntu 14.04
>   CXXFLAGS:append:class-native = " -Wl,--no-as-needed"
> @@ -80,8 +81,6 @@ do_configure:prepend:toolchain-clang:x86() {
>   
>   BBCLASSEXTEND = "native nativesdk"
>   
> -SYSROOT_DIRS_IGNORE:append:class-target = " ${baselib}/cmake/grpc"
> -
>   FILES:${PN}-compiler += " \
>       ${bindir} \
>       ${libdir}/libgrpc_plugin_support${SOLIBS} \
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#96451): https://lists.openembedded.org/g/openembedded-devel/message/96451
> Mute This Topic: https://lists.openembedded.org/mt/90310753/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

Patch

diff --git a/meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch b/meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch
new file mode 100644
index 000000000..679bd3882
--- /dev/null
+++ b/meta-oe/recipes-devtools/grpc/grpc/0001-cmake-add-separate-export-for-plugin-targets.patch
@@ -0,0 +1,93 @@ 
+From 3150cb043363e05588062dd392b940be25594713 Mon Sep 17 00:00:00 2001
+From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
+Date: Tue, 18 Feb 2020 14:17:07 +0100
+Subject: [PATCH] cmake: add separate export for plugin targets
+
+Upstream-Status: Submitted [https://github.com/grpc/grpc/pull/29328]
+
+
+---
+ CMakeLists.txt | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index efdaf8936d..6608b1b00c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -10935,7 +10935,7 @@ target_link_libraries(grpc_cpp_plugin
+ 
+ 
+ if(gRPC_INSTALL)
+-  install(TARGETS grpc_cpp_plugin EXPORT gRPCTargets
++  install(TARGETS grpc_cpp_plugin EXPORT gRPCPluginTargets
+     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
+     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+@@ -10975,7 +10975,7 @@ target_link_libraries(grpc_csharp_plugin
+ 
+ 
+ if(gRPC_INSTALL)
+-  install(TARGETS grpc_csharp_plugin EXPORT gRPCTargets
++  install(TARGETS grpc_csharp_plugin EXPORT gRPCPluginTargets
+     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
+     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+@@ -11015,7 +11015,7 @@ target_link_libraries(grpc_node_plugin
+ 
+ 
+ if(gRPC_INSTALL)
+-  install(TARGETS grpc_node_plugin EXPORT gRPCTargets
++  install(TARGETS grpc_node_plugin EXPORT gRPCPluginTargets
+     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
+     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+@@ -11055,7 +11055,7 @@ target_link_libraries(grpc_objective_c_plugin
+ 
+ 
+ if(gRPC_INSTALL)
+-  install(TARGETS grpc_objective_c_plugin EXPORT gRPCTargets
++  install(TARGETS grpc_objective_c_plugin EXPORT gRPCPluginTargets
+     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
+     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+@@ -11095,7 +11095,7 @@ target_link_libraries(grpc_php_plugin
+ 
+ 
+ if(gRPC_INSTALL)
+-  install(TARGETS grpc_php_plugin EXPORT gRPCTargets
++  install(TARGETS grpc_php_plugin EXPORT gRPCPluginTargets
+     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
+     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+@@ -11135,7 +11135,7 @@ target_link_libraries(grpc_python_plugin
+ 
+ 
+ if(gRPC_INSTALL)
+-  install(TARGETS grpc_python_plugin EXPORT gRPCTargets
++  install(TARGETS grpc_python_plugin EXPORT gRPCPluginTargets
+     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
+     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+@@ -11175,7 +11175,7 @@ target_link_libraries(grpc_ruby_plugin
+ 
+ 
+ if(gRPC_INSTALL)
+-  install(TARGETS grpc_ruby_plugin EXPORT gRPCTargets
++  install(TARGETS grpc_ruby_plugin EXPORT gRPCPluginTargets
+     RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}
+     BUNDLE DESTINATION  ${gRPC_INSTALL_BINDIR}
+     LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
+@@ -17349,6 +17349,10 @@ if(gRPC_INSTALL)
+     DESTINATION ${gRPC_INSTALL_CMAKEDIR}
+     NAMESPACE gRPC::
+   )
++  install(EXPORT gRPCPluginTargets
++    DESTINATION ${gRPC_INSTALL_CMAKEDIR}
++    NAMESPACE gRPC::
++  )
+ endif()
+ 
+ include(CMakePackageConfigHelpers)
+-- 
+2.30.2
+
diff --git a/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb b/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb
index d25a01cf3..d50fd2727 100644
--- a/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb
+++ b/meta-oe/recipes-devtools/grpc/grpc_1.45.0.bb
@@ -24,6 +24,7 @@  SRCREV_grpc = "494b08ada4009ead0d0b70e44d354be72f9c283a"
 BRANCH = "v1.45.x"
 SRC_URI = "git://github.com/grpc/grpc.git;protocol=https;name=grpc;branch=${BRANCH} \
            file://0001-Revert-Changed-GRPCPP_ABSEIL_SYNC-to-GPR_ABSEIL_SYNC.patch \
+           file://0001-cmake-add-separate-export-for-plugin-targets.patch \
            "
 # Fixes build with older compilers 4.8 especially on ubuntu 14.04
 CXXFLAGS:append:class-native = " -Wl,--no-as-needed"
@@ -80,8 +81,6 @@  do_configure:prepend:toolchain-clang:x86() {
 
 BBCLASSEXTEND = "native nativesdk"
 
-SYSROOT_DIRS_IGNORE:append:class-target = " ${baselib}/cmake/grpc"
-
 FILES:${PN}-compiler += " \
     ${bindir} \
     ${libdir}/libgrpc_plugin_support${SOLIBS} \