diff options
author | Alexey Firago <alexey_firago@mentor.com> | 2017-10-31 23:47:03 +0300 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2017-11-15 16:34:05 -0800 |
commit | 07f015f7e4eacd696fb7690d5dab25210924bf2f (patch) | |
tree | 563f3c2499362683a96c0fd93e41cd804bef05fd /meta-oe/recipes-devtools | |
parent | 10d31097dc63c2d15fc55f3ba3ba7b75d287fedb (diff) | |
download | meta-openembedded-07f015f7e4eacd696fb7690d5dab25210924bf2f.tar.gz |
grpc: Add recipe for grpc v1.6.6
Add recipe to build the C based gRPC libraries.
Regular gRPC build process uses git sub-modules for dependcies on external
libraries/tools (c-ares, protobuf, etc). This recipe add patches and configs
to use libraries provided by Yocto/bitbake/OE.
grpc-native is required to build grpc for target - it uses some grpc plugins
built for host.
Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-oe/recipes-devtools')
5 files changed, 408 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists-when-cross-compiling-the-host-grpc_cpp_pl.patch b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists-when-cross-compiling-the-host-grpc_cpp_pl.patch new file mode 100644 index 000000000..31c36422e --- /dev/null +++ b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists-when-cross-compiling-the-host-grpc_cpp_pl.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | From 43ae4e81056888623a73069c11da28a80c39a297 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexey Firago <alexey_firago@mentor.com> | ||
3 | Date: Thu, 19 Oct 2017 00:20:36 +0300 | ||
4 | Subject: [PATCH] CMakeLists: when cross-compiling, the host grpc_cpp_plugin | ||
5 | should be used | ||
6 | |||
7 | Signed-off-by: Alexey Firago <alexey_firago@mentor.com> | ||
8 | --- | ||
9 | CMakeLists.txt | 9 ++++++++- | ||
10 | templates/CMakeLists.txt.template | 9 ++++++++- | ||
11 | 2 files changed, 16 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
14 | index 2f66066..af2046c 100644 | ||
15 | --- a/CMakeLists.txt | ||
16 | +++ b/CMakeLists.txt | ||
17 | @@ -333,6 +333,13 @@ function(protobuf_generate_grpc_cpp) | ||
18 | get_filename_component(REL_DIR ${REL_FIL} DIRECTORY) | ||
19 | set(RELFIL_WE "${REL_DIR}/${FIL_WE}") | ||
20 | |||
21 | + #if cross-compiling, find host plugin | ||
22 | + if(CMAKE_CROSSCOMPILING) | ||
23 | + find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin) | ||
24 | + else() | ||
25 | + set(gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>) | ||
26 | + endif() | ||
27 | + | ||
28 | add_custom_command( | ||
29 | OUTPUT "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc" | ||
30 | "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h" | ||
31 | @@ -342,7 +349,7 @@ function(protobuf_generate_grpc_cpp) | ||
32 | COMMAND ${_gRPC_PROTOBUF_PROTOC} | ||
33 | ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} | ||
34 | --cpp_out=${_gRPC_PROTO_GENS_DIR} | ||
35 | - --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> | ||
36 | + --plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN} | ||
37 | ${_protobuf_include_path} | ||
38 | ${REL_FIL} | ||
39 | DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin | ||
40 | diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template | ||
41 | index 850404b..09c1388 100644 | ||
42 | --- a/templates/CMakeLists.txt.template | ||
43 | +++ b/templates/CMakeLists.txt.template | ||
44 | @@ -378,6 +378,13 @@ | ||
45 | get_filename_component(REL_DIR <%text>${REL_FIL}</%text> DIRECTORY) | ||
46 | set(RELFIL_WE "<%text>${REL_DIR}/${FIL_WE}</%text>") | ||
47 | |||
48 | + #if cross-compiling, find host plugin | ||
49 | + if(CMAKE_CROSSCOMPILING) | ||
50 | + find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin) | ||
51 | + else() | ||
52 | + set(gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>) | ||
53 | + endif() | ||
54 | + | ||
55 | add_custom_command( | ||
56 | OUTPUT <%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc"</%text> | ||
57 | <%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h"</%text> | ||
58 | @@ -387,7 +394,7 @@ | ||
59 | COMMAND <%text>$<TARGET_FILE:${_gRPC_PROTOBUF_PROTOC}></%text> | ||
60 | ARGS --grpc_out=<%text>generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}</%text> | ||
61 | --cpp_out=<%text>${_gRPC_PROTO_GENS_DIR}</%text> | ||
62 | - --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> | ||
63 | + --plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN} | ||
64 | <%text>${_protobuf_include_path}</%text> | ||
65 | <%text>${REL_FIL}</%text> | ||
66 | DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> grpc_cpp_plugin | ||
67 | -- | ||
68 | 2.7.4 | ||
diff --git a/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch new file mode 100644 index 000000000..5774e62eb --- /dev/null +++ b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | From cc6dbabea0e452ebc93682df860a79ed9a45722e Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexey Firago <alexey_firago@mentor.com> | ||
3 | Date: Fri, 20 Oct 2017 00:04:19 +0300 | ||
4 | Subject: [PATCH] CMakeLists.txt: Fix grpc_cpp_plugin path during | ||
5 | cross-compilation | ||
6 | |||
7 | Signed-off-by: Alexey Firago <alexey_firago@mentor.com> | ||
8 | --- | ||
9 | CMakeLists.txt | 9 ++++++++- | ||
10 | templates/CMakeLists.txt.template | 9 ++++++++- | ||
11 | 2 files changed, 16 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
14 | index f9cd630..9663934 100644 | ||
15 | --- a/CMakeLists.txt | ||
16 | +++ b/CMakeLists.txt | ||
17 | @@ -328,6 +328,13 @@ function(protobuf_generate_grpc_cpp) | ||
18 | return() | ||
19 | endif() | ||
20 | |||
21 | + #if cross-compiling, find host plugin | ||
22 | + if(CMAKE_CROSSCOMPILING) | ||
23 | + find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin) | ||
24 | + else() | ||
25 | + set(gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>) | ||
26 | + endif() | ||
27 | + | ||
28 | set(_protobuf_include_path -I . -I ${PROTOBUF_WELLKNOWN_IMPORT_DIR}) | ||
29 | foreach(FIL ${ARGN}) | ||
30 | get_filename_component(ABS_FIL ${FIL} ABSOLUTE) | ||
31 | @@ -345,7 +352,7 @@ function(protobuf_generate_grpc_cpp) | ||
32 | COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE} | ||
33 | ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} | ||
34 | --cpp_out=${_gRPC_PROTO_GENS_DIR} | ||
35 | - --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> | ||
36 | + --plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN} | ||
37 | ${_protobuf_include_path} | ||
38 | ${REL_FIL} | ||
39 | DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin | ||
40 | diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template | ||
41 | index 64daf04..a7e8629 100644 | ||
42 | --- a/templates/CMakeLists.txt.template | ||
43 | +++ b/templates/CMakeLists.txt.template | ||
44 | @@ -373,6 +373,13 @@ | ||
45 | return() | ||
46 | endif() | ||
47 | |||
48 | + #if cross-compiling, find host plugin | ||
49 | + if(CMAKE_CROSSCOMPILING) | ||
50 | + find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin) | ||
51 | + else() | ||
52 | + set(gRPC_CPP_PLUGIN $<TARGET_FILE:grpc_cpp_plugin>) | ||
53 | + endif() | ||
54 | + | ||
55 | set(_protobuf_include_path -I . -I <%text>${PROTOBUF_WELLKNOWN_IMPORT_DIR}</%text>) | ||
56 | foreach(FIL <%text>${ARGN}</%text>) | ||
57 | get_filename_component(ABS_FIL <%text>${FIL}</%text> ABSOLUTE) | ||
58 | @@ -390,7 +397,7 @@ | ||
59 | COMMAND <%text>${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}</%text> | ||
60 | ARGS --grpc_out=<%text>generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}</%text> | ||
61 | --cpp_out=<%text>${_gRPC_PROTO_GENS_DIR}</%text> | ||
62 | - --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> | ||
63 | + --plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN} | ||
64 | <%text>${_protobuf_include_path}</%text> | ||
65 | <%text>${REL_FIL}</%text> | ||
66 | DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> grpc_cpp_plugin | ||
67 | -- | ||
68 | 2.7.4 | ||
diff --git a/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch new file mode 100644 index 000000000..c3d406ea3 --- /dev/null +++ b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch | |||
@@ -0,0 +1,157 @@ | |||
1 | From cc170860e5b77d7c9f3b9ce8730b719976dab2bb Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexey Firago <alexey_firago@mentor.com> | ||
3 | Date: Mon, 30 Oct 2017 23:24:49 +0300 | ||
4 | Subject: [PATCH] CMakeLists.txt: Fix libraries installation for Linux | ||
5 | |||
6 | * Set libs versions as in Makefile | ||
7 | |||
8 | Signed-off-by: Alexey Firago <alexey_firago@mentor.com> | ||
9 | --- | ||
10 | CMakeLists.txt | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
11 | 1 file changed, 55 insertions(+) | ||
12 | |||
13 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
14 | index 9663934..5719435 100644 | ||
15 | --- a/CMakeLists.txt | ||
16 | +++ b/CMakeLists.txt | ||
17 | @@ -30,6 +30,15 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") | ||
18 | set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") | ||
19 | project(${PACKAGE_NAME} C CXX) | ||
20 | |||
21 | +set (CORE_VERSION_MAJOR "4") | ||
22 | +set (CORE_VERSION "4.0.0") | ||
23 | + | ||
24 | +set (CPP_VERSION_MAJOR "1") | ||
25 | +set (CPP_VERSION "1.6.6") | ||
26 | + | ||
27 | +set (CSHARP_VERSION_MAJOR "1") | ||
28 | +set (CSHARP_VERSION "1.6.6") | ||
29 | + | ||
30 | set(gRPC_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") | ||
31 | set(gRPC_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") | ||
32 | set(gRPC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") | ||
33 | @@ -840,6 +849,10 @@ if(WIN32 AND MSVC) | ||
34 | endif() | ||
35 | endif() | ||
36 | |||
37 | +if(_gRPC_PLATFORM_LINUX) | ||
38 | + set_property(TARGET gpr PROPERTY VERSION ${CORE_VERSION}) | ||
39 | + set_property(TARGET gpr PROPERTY SOVERSION ${CORE_VERSION_MAJOR}) | ||
40 | +endif() | ||
41 | |||
42 | target_include_directories(gpr | ||
43 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
44 | @@ -1228,6 +1241,10 @@ if(WIN32 AND MSVC) | ||
45 | endif() | ||
46 | endif() | ||
47 | |||
48 | +if(_gRPC_PLATFORM_LINUX) | ||
49 | + set_property(TARGET grpc PROPERTY VERSION ${CORE_VERSION}) | ||
50 | + set_property(TARGET grpc PROPERTY SOVERSION ${CORE_VERSION_MAJOR}) | ||
51 | +endif() | ||
52 | |||
53 | target_include_directories(grpc | ||
54 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
55 | @@ -1534,6 +1551,10 @@ if(WIN32 AND MSVC) | ||
56 | endif() | ||
57 | endif() | ||
58 | |||
59 | +if(_gRPC_PLATFORM_LINUX) | ||
60 | + set_property(TARGET grpc_cronet PROPERTY VERSION ${CORE_VERSION}) | ||
61 | + set_property(TARGET grpc_cronet PROPERTY SOVERSION ${CORE_VERSION_MAJOR}) | ||
62 | +endif() | ||
63 | |||
64 | target_include_directories(grpc_cronet | ||
65 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
66 | @@ -2366,6 +2387,10 @@ if(WIN32 AND MSVC) | ||
67 | endif() | ||
68 | endif() | ||
69 | |||
70 | +if(_gRPC_PLATFORM_LINUX) | ||
71 | + set_property(TARGET grpc_unsecure PROPERTY VERSION ${CORE_VERSION}) | ||
72 | + set_property(TARGET grpc_unsecure PROPERTY SOVERSION ${CORE_VERSION_MAJOR}) | ||
73 | +endif() | ||
74 | |||
75 | target_include_directories(grpc_unsecure | ||
76 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
77 | @@ -2583,6 +2608,10 @@ if(WIN32 AND MSVC) | ||
78 | endif() | ||
79 | endif() | ||
80 | |||
81 | +if(_gRPC_PLATFORM_LINUX) | ||
82 | + set_property(TARGET grpc++ PROPERTY VERSION ${CPP_VERSION}) | ||
83 | + set_property(TARGET grpc++ PROPERTY SOVERSION ${CPP_VERSION_MAJOR}) | ||
84 | +endif() | ||
85 | |||
86 | target_include_directories(grpc++ | ||
87 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
88 | @@ -3013,6 +3042,10 @@ if(WIN32 AND MSVC) | ||
89 | endif() | ||
90 | endif() | ||
91 | |||
92 | +if(_gRPC_PLATFORM_LINUX) | ||
93 | + set_property(TARGET grpc++_cronet PROPERTY VERSION ${CPP_VERSION}) | ||
94 | + set_property(TARGET grpc++_cronet PROPERTY SOVERSION ${CPP_VERSION_MAJOR}) | ||
95 | +endif() | ||
96 | |||
97 | target_include_directories(grpc++_cronet | ||
98 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
99 | @@ -3213,6 +3246,11 @@ protobuf_generate_grpc_cpp( | ||
100 | src/proto/grpc/status/status.proto | ||
101 | ) | ||
102 | |||
103 | +if(_gRPC_PLATFORM_LINUX) | ||
104 | + set_property(TARGET grpc++_error_details PROPERTY VERSION ${CPP_VERSION}) | ||
105 | + set_property(TARGET grpc++_error_details PROPERTY SOVERSION ${CPP_VERSION_MAJOR}) | ||
106 | +endif() | ||
107 | + | ||
108 | target_include_directories(grpc++_error_details | ||
109 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
110 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} | ||
111 | @@ -3343,6 +3381,11 @@ protobuf_generate_grpc_cpp( | ||
112 | src/proto/grpc/reflection/v1alpha/reflection.proto | ||
113 | ) | ||
114 | |||
115 | +if(_gRPC_PLATFORM_LINUX) | ||
116 | + set_property(TARGET grpc++_reflection PROPERTY VERSION ${CPP_VERSION}) | ||
117 | + set_property(TARGET grpc++_reflection PROPERTY SOVERSION ${CPP_VERSION_MAJOR}) | ||
118 | +endif() | ||
119 | + | ||
120 | target_include_directories(grpc++_reflection | ||
121 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
122 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} | ||
123 | @@ -3762,6 +3805,10 @@ if(WIN32 AND MSVC) | ||
124 | endif() | ||
125 | endif() | ||
126 | |||
127 | +if(_gRPC_PLATFORM_LINUX) | ||
128 | + set_property(TARGET grpc++_unsecure PROPERTY VERSION ${CPP_VERSION}) | ||
129 | + set_property(TARGET grpc++_unsecure PROPERTY SOVERSION ${CPP_VERSION_MAJOR}) | ||
130 | +endif() | ||
131 | |||
132 | target_include_directories(grpc++_unsecure | ||
133 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
134 | @@ -4075,6 +4122,10 @@ if(WIN32 AND MSVC) | ||
135 | endif() | ||
136 | endif() | ||
137 | |||
138 | +if(_gRPC_PLATFORM_LINUX) | ||
139 | + set_property(TARGET grpc_plugin_support PROPERTY VERSION ${CORE_VERSION}) | ||
140 | + set_property(TARGET grpc_plugin_support PROPERTY SOVERSION ${CORE_VERSION_MAJOR}) | ||
141 | +endif() | ||
142 | |||
143 | target_include_directories(grpc_plugin_support | ||
144 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
145 | @@ -4599,6 +4650,10 @@ if(WIN32 AND MSVC) | ||
146 | endif() | ||
147 | endif() | ||
148 | |||
149 | +if(_gRPC_PLATFORM_LINUX) | ||
150 | + set_property(TARGET grpc_csharp_ext PROPERTY VERSION ${CSHARP_VERSION}) | ||
151 | + set_property(TARGET grpc_csharp_ext PROPERTY SOVERSION ${CSHARP_VERSION_MAJOR}) | ||
152 | +endif() | ||
153 | |||
154 | target_include_directories(grpc_csharp_ext | ||
155 | PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
156 | -- | ||
157 | 2.7.4 | ||
diff --git a/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-use-the-right-protoc-executable-regardless-of-protob.patch b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-use-the-right-protoc-executable-regardless-of-protob.patch new file mode 100644 index 000000000..4621dc6fd --- /dev/null +++ b/meta-oe/recipes-devtools/grpc/grpc-1.6.6/0001-use-the-right-protoc-executable-regardless-of-protob.patch | |||
@@ -0,0 +1,77 @@ | |||
1 | From f640fcc81c76953b2e84fc3087f905141b6643b9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jan Tattermusch <jtattermusch@google.com> | ||
3 | Date: Thu, 24 Aug 2017 17:51:47 +0200 | ||
4 | Subject: [PATCH] use the right protoc executable regardless of protobuf | ||
5 | provider | ||
6 | |||
7 | --- | ||
8 | CMakeLists.txt | 5 ++++- | ||
9 | templates/CMakeLists.txt.template | 5 ++++- | ||
10 | 2 files changed, 8 insertions(+), 2 deletions(-) | ||
11 | |||
12 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
13 | index bde8946..f9cd630 100644 | ||
14 | --- a/CMakeLists.txt | ||
15 | +++ b/CMakeLists.txt | ||
16 | @@ -190,6 +190,7 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") | ||
17 | endif() | ||
18 | if(TARGET protoc) | ||
19 | set(_gRPC_PROTOBUF_PROTOC protoc) | ||
20 | + set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protoc>) | ||
21 | endif() | ||
22 | else() | ||
23 | message(WARNING "gRPC_PROTOBUF_PROVIDER is \"module\" but PROTOBUF_ROOT_DIR is wrong") | ||
24 | @@ -213,8 +214,10 @@ elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") | ||
25 | endif() | ||
26 | if(TARGET protobuf::protoc) | ||
27 | set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) | ||
28 | + set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protobuf::protoc>) | ||
29 | else() | ||
30 | set(_gRPC_PROTOBUF_PROTOC ${PROTOBUF_PROTOC_EXECUTABLE}) | ||
31 | + set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE}) | ||
32 | endif() | ||
33 | set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf ${gRPC_PROTOBUF_PACKAGE_TYPE})\nendif()") | ||
34 | endif() | ||
35 | @@ -339,7 +342,7 @@ function(protobuf_generate_grpc_cpp) | ||
36 | "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h" | ||
37 | "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc" | ||
38 | "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h" | ||
39 | - COMMAND $<TARGET_FILE:${_gRPC_PROTOBUF_PROTOC}> | ||
40 | + COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE} | ||
41 | ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} | ||
42 | --cpp_out=${_gRPC_PROTO_GENS_DIR} | ||
43 | --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> | ||
44 | diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template | ||
45 | index 850404b..64daf04 100644 | ||
46 | --- a/templates/CMakeLists.txt.template | ||
47 | +++ b/templates/CMakeLists.txt.template | ||
48 | @@ -235,6 +235,7 @@ | ||
49 | endif() | ||
50 | if(TARGET protoc) | ||
51 | set(_gRPC_PROTOBUF_PROTOC protoc) | ||
52 | + set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protoc>) | ||
53 | endif() | ||
54 | else() | ||
55 | message(WARNING "gRPC_PROTOBUF_PROVIDER is \"module\" but PROTOBUF_ROOT_DIR is wrong") | ||
56 | @@ -258,8 +259,10 @@ | ||
57 | endif() | ||
58 | if(TARGET protobuf::protoc) | ||
59 | set(_gRPC_PROTOBUF_PROTOC protobuf::protoc) | ||
60 | + set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protobuf::protoc>) | ||
61 | else() | ||
62 | set(_gRPC_PROTOBUF_PROTOC <%text>${PROTOBUF_PROTOC_EXECUTABLE}</%text>) | ||
63 | + set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE <%text>${PROTOBUF_PROTOC_EXECUTABLE}</%text>) | ||
64 | endif() | ||
65 | set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)\n find_package(Protobuf <%text>${gRPC_PROTOBUF_PACKAGE_TYPE}</%text>)\nendif()") | ||
66 | endif() | ||
67 | @@ -384,7 +387,7 @@ | ||
68 | <%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h"</%text> | ||
69 | <%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"</%text> | ||
70 | <%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"</%text> | ||
71 | - COMMAND <%text>$<TARGET_FILE:${_gRPC_PROTOBUF_PROTOC}></%text> | ||
72 | + COMMAND <%text>${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}</%text> | ||
73 | ARGS --grpc_out=<%text>generate_mock_code=true:${_gRPC_PROTO_GENS_DIR}</%text> | ||
74 | --cpp_out=<%text>${_gRPC_PROTO_GENS_DIR}</%text> | ||
75 | --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> | ||
76 | -- | ||
77 | 2.7.4 | ||
diff --git a/meta-oe/recipes-devtools/grpc/grpc_1.6.6.bb b/meta-oe/recipes-devtools/grpc/grpc_1.6.6.bb new file mode 100644 index 000000000..6fde33d85 --- /dev/null +++ b/meta-oe/recipes-devtools/grpc/grpc_1.6.6.bb | |||
@@ -0,0 +1,38 @@ | |||
1 | DESCRIPTION = "A high performance, open source, general-purpose RPC framework. \ | ||
2 | Provides gRPC libraries for multiple languages written on top of shared C core library \ | ||
3 | (C++, Node.js, Python, Ruby, Objective-C, PHP, C#)" | ||
4 | HOMEPAGE = "https://github.com/grpc/grpc" | ||
5 | SECTION = "libs" | ||
6 | LICENSE = "Apache-2" | ||
7 | |||
8 | DEPENDS = "gflags c-ares protobuf protobuf-native protobuf-c protobuf-c-native openssl" | ||
9 | DEPENDS_append_class-target = " gtest grpc-native " | ||
10 | |||
11 | LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" | ||
12 | |||
13 | SRC_URI = "https://github.com/grpc/grpc/archive/v1.6.6.tar.gz" | ||
14 | SRC_URI[md5sum] = "a960878ad0231189d48ac8ff17eeca3c" | ||
15 | SRC_URI[sha256sum] = "b97eaa0c8a63b0492dc94bdad621795b4815278e841f06b0c78d6bcbd4c8bdec" | ||
16 | |||
17 | SRC_URI += " \ | ||
18 | file://0001-use-the-right-protoc-executable-regardless-of-protob.patch \ | ||
19 | file://0001-CMakeLists.txt-Fix-libraries-installation-for-Linux.patch \ | ||
20 | " | ||
21 | |||
22 | SRC_URI_append_class-target = " file://0001-CMakeLists.txt-Fix-grpc_cpp_plugin-path-during-cross.patch" | ||
23 | |||
24 | inherit cmake | ||
25 | |||
26 | EXTRA_OECMAKE = " \ | ||
27 | -DgRPC_CARES_PROVIDER=package \ | ||
28 | -DgRPC_ZLIB_PROVIDER=package \ | ||
29 | -DgRPC_SSL_PROVIDER=package \ | ||
30 | -DgRPC_PROTOBUF_PROVIDER=package \ | ||
31 | -DgRPC_GFLAGS_PROVIDER=package \ | ||
32 | -DgRPC_INSTALL=1 \ | ||
33 | -DBUILD_SHARED_LIBS=ON \ | ||
34 | " | ||
35 | |||
36 | FILES_${PN}-dev += "${libdir}/cmake" | ||
37 | |||
38 | BBCLASSEXTEND = "native" | ||