Skip to content

Commit 74588f1

Browse files
jgsogoprince-chrismcqchateau
authored
(conan-io#5404) [grpc] Use build_modules to find executable grpc_cpp_plugin
* [google-cloud-cpp] Add library * start to work on deps * exclude tests, use config for CMake packages * Add build module to find grpc_cpp_plugin * [crc32c] Add recipe * add crc32c dep * update grpc * remove, not for this PR * [grpc] Use build_modules to find the grcp_cpp_plugin * Update recipes/grpc/all/conanfile.py Co-authored-by: Chris Mc <prince.chrismc@gmail.com> * grpc: add version 1.37.1 (#6) Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot <quentin.chateau@gmail.com> Co-authored-by: Chris Mc <prince.chrismc@gmail.com> Co-authored-by: Quentin Chateau via Conan Center Bot <quentin.chateau@gmail.com>
1 parent a46a4a6 commit 74588f1

File tree

6 files changed

+32
-9
lines changed

6 files changed

+32
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
if(NOT TARGET gRPC::grpc_cpp_plugin)
2+
if(CMAKE_CROSSCOMPILING)
3+
find_program(GRPC_CPP_PLUGIN_PROGRAM
4+
NAMES grpc_cpp_plugin
5+
PATHS ENV
6+
PATH NO_DEFAULT_PATH)
7+
else()
8+
find_program(GRPC_CPP_PLUGIN_PROGRAM
9+
NAMES grpc_cpp_plugin
10+
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/"
11+
NO_DEFAULT_PATH)
12+
endif()
13+
14+
get_filename_component(GRPC_CPP_PLUGIN_PROGRAM "${GRPC_CPP_PLUGIN_PROGRAM}" ABSOLUTE)
15+
16+
add_executable(gRPC::grpc_cpp_plugin IMPORTED)
17+
set_property(TARGET gRPC::grpc_cpp_plugin PROPERTY IMPORTED_LOCATION ${GRPC_CPP_PLUGIN_PROGRAM})
18+
endif()

recipes/grpc/all/conandata.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
sources:
2+
"1.37.1":
3+
url: "https://github.com/grpc/grpc/archive/v1.37.1.tar.gz"
4+
sha256: "acf247ec3a52edaee5dee28644a4e485c5e5badf46bdb24a80ca1d76cb8f1174"
25
"1.37.0":
36
url: https://github.com/grpc/grpc/archive/refs/tags/v1.37.0.tar.gz
47
sha256: "c2dc8e876ea12052d6dd16704492fd8921df8c6d38c70c4708da332cf116df22"

recipes/grpc/all/conanfile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class grpcConan(ConanFile):
1111
url = "https://github.com/conan-io/conan-center-index"
1212
homepage = "https://github.com/grpc/grpc"
1313
license = "Apache-2.0"
14-
exports_sources = ["CMakeLists.txt"]
14+
exports_sources = ["CMakeLists.txt", "cmake/*"]
1515
generators = "cmake", "cmake_find_package", "cmake_find_package_multi"
1616
short_paths = True
1717

@@ -116,13 +116,15 @@ def build(self):
116116
cmake.build()
117117

118118
def package(self):
119-
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
120119
cmake = self._configure_cmake()
121120
cmake.install()
122121

123122
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
124123
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
125124
tools.rmdir(os.path.join(self.package_folder, "share"))
125+
126+
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
127+
self.copy(pattern="*.cmake", dst=os.path.join("lib", "cmake"), src=os.path.join(self.source_folder, "cmake"))
126128

127129
def package_info(self):
128130
bindir = os.path.join(self.package_folder, "bin")
@@ -232,6 +234,10 @@ def package_info(self):
232234

233235
# Executables
234236
# gRPC::grpc_cpp_plugin
237+
if self.options.cpp_plugin:
238+
module_target_rel_path = os.path.join("lib", "cmake", "grpc_cpp_plugin.cmake")
239+
self.cpp_info.components["execs"].build_modules["cmake_find_package"] = [module_target_rel_path]
240+
self.cpp_info.components["execs"].build_modules["cmake_find_package_multi"] = [module_target_rel_path]
235241
# gRPC::grpc_csharp_plugin
236242
# gRPC::grpc_node_plugin
237243
# gRPC::grpc_objective_c_plugin

recipes/grpc/all/test_package/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ message(STATUS "Using protobuf ${protobuf_VERSION}")
1818
# Find gRPC installation
1919
find_package(gRPC CONFIG REQUIRED)
2020
message(STATUS "Using gRPC ${gRPC_VERSION}")
21-
# set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
22-
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin ${CONAN_BIN_DIRS_GRPC} NO_DEFAULT_PATH)
21+
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
2322

2423
# Proto file
2524
get_filename_component(hw_proto "helloworld.proto" ABSOLUTE)

recipes/grpc/all/test_package/greeter_client_server.cc

-5
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@
2323
#include <thread>
2424

2525
#include <grpcpp/grpcpp.h>
26-
27-
#ifdef BAZEL_BUILD
28-
#include "examples/protos/helloworld.grpc.pb.h"
29-
#else
3026
#include "helloworld.grpc.pb.h"
31-
#endif
3227

3328
using grpc::Channel;
3429
using grpc::ClientContext;

recipes/grpc/config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
versions:
2+
"1.37.1":
3+
folder: "all"
24
"1.37.0":
35
folder: "all"

0 commit comments

Comments
 (0)