0001-target-build-using-host-plugin.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From aa18148e392ef28275a182db34397ccb66fb4617 Mon Sep 17 00:00:00 2001
  2. From: Robert Rose <robertroyrose@gmail.com>
  3. Date: Wed, 28 Nov 2018 09:41:52 -0800
  4. Subject: [PATCH] CMakeLists.txt: allow passing a pre-existing grpc_cpp_plugin
  5. The grpc_cpp_plugin is meant to be executed during the build process
  6. of grpc. As such, in cross-compilation contexts, this program needs to
  7. be built for the host machine and not the target machine. In order to
  8. allow this, this commit adds an option gRPC_NATIVE_CPP_PLUGIN that can
  9. be passed on the command line, with the path to an existing
  10. grpc_cpp_plugin binary. If not passed, grpc_cpp_plugin is built as
  11. usual.
  12. Signed-off-by: Robert Rose <robertroyrose@gmail.com>
  13. ---
  14. CMakeLists.txt | 13 +++++++++++++
  15. 1 file changed, 13 insertions(+)
  16. diff --git a/CMakeLists.txt b/CMakeLists.txt
  17. index be695c2..45c2fcb 100644
  18. --- a/CMakeLists.txt
  19. +++ b/CMakeLists.txt
  20. @@ -10844,6 +10844,18 @@ target_link_libraries(grpc_cli
  21. endif()
  22. if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CPP_PLUGIN)
  23. +if (gRPC_NATIVE_CPP_PLUGIN)
  24. +
  25. +add_executable(grpc_cpp_plugin
  26. + IMPORTED
  27. +)
  28. +
  29. +set_property(TARGET grpc_cpp_plugin
  30. + PROPERTY IMPORTED_LOCATION ${gRPC_NATIVE_CPP_PLUGIN}
  31. +)
  32. +
  33. +else()
  34. +
  35. add_executable(grpc_cpp_plugin
  36. src/compiler/cpp_plugin.cc
  37. )
  38. @@ -10877,6 +10889,7 @@ if(gRPC_INSTALL)
  39. ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
  40. )
  41. endif()
  42. +endif()
  43. endif()
  44. if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CSHARP_PLUGIN)
  45. --
  46. 2.26.2