Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Side by Side Diff: templates/BUILD.gn.template

Issue 2260573003: Fix build rules for gRPC proto generator plugin to work when crosscompiling (Closed) Base URL: https://chromium.googlesource.com/external/github.com/grpc/grpc@2016-08-17
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 %YAML 1.2 1 %YAML 1.2
2 --- | 2 --- |
3 # GRPC Chromium BUILD.gn file. 3 # GRPC Chromium BUILD.gn file.
4 # This file has been automatically generated from a template file. 4 # This file has been automatically generated from a template file.
5 # Please look at the templates directory instead. 5 # Please look at the templates directory instead.
6 # This file can be regenerated from the template by running 6 # This file can be regenerated from the template by running
7 # tools/buildgen/generate_projects.sh 7 # tools/buildgen/generate_projects.sh
8 config("grpc_config") { 8 config("grpc_config") {
9 include_dirs = [ 9 include_dirs = [
10 ".", 10 ".",
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 or f.endswith("load_balancer_api.c")) 67 or f.endswith("load_balancer_api.c"))
68 68
69 def wanted_lib(lib): 69 def wanted_lib(lib):
70 wanted_libs = ("gpr", "grpc", "grpc_unsecure", "grpc++", "grpc++_unsecure", 70 wanted_libs = ("gpr", "grpc", "grpc_unsecure", "grpc++", "grpc++_unsecure",
71 "grpc_cronet", "grpc_plugin_support") 71 "grpc_cronet", "grpc_plugin_support")
72 return lib.build in ("all", "protoc") and lib.get("name", "") in wanted_libs 72 return lib.build in ("all", "protoc") and lib.get("name", "") in wanted_libs
73 73
74 def wanted_binary(tgt): 74 def wanted_binary(tgt):
75 wanted_binaries = ("grpc_cpp_plugin",) 75 wanted_binaries = ("grpc_cpp_plugin",)
76 return tgt.build == "protoc" and tgt.get("name", "") in wanted_binaries 76 return tgt.build == "protoc" and tgt.get("name", "") in wanted_binaries
77
78 def only_on_host_toolchain(tgt):
79 return tgt.get("name", "") in ("grpc_plugin_support", "grpc_cpp_plugin")
77 %> 80 %>
78 81
79 % for lib in libs: 82 % for lib in libs:
80 % if wanted_lib(lib): 83 % if wanted_lib(lib):
84 % if only_on_host_toolchain(lib):
85 # Only compile the plugin for the host architecture.
86 if (current_toolchain == host_toolchain) {
81 ${cc_library(lib)} 87 ${cc_library(lib)}
88 }
89 % else:
90 ${cc_library(lib)}
91 % endif
82 % endif 92 % endif
83 % endfor 93 % endfor
84 94
85 95
86 % for tgt in targets: 96 % for tgt in targets:
87 % if wanted_binary(tgt): 97 % if wanted_binary(tgt):
98 % if only_on_host_toolchain(tgt):
99 # Only compile the plugin for the host architecture.
100 if (current_toolchain == host_toolchain) {
88 ${cc_binary(tgt)} 101 ${cc_binary(tgt)}
102 }
103 % else:
104 ${cc_binary(tgt)}
105 % endif
89 % endif 106 % endif
90 % endfor 107 % endfor
91 108
92 <%def name="cc_library(lib)"> 109 <%def name="cc_library(lib)">
93 <% 110 <%
94 lib_hdrs = lib.get("headers", []) 111 lib_hdrs = lib.get("headers", [])
95 hdrs = [h for h in lib_hdrs if not uses_nanopb_or_protofull(h)] 112 hdrs = [h for h in lib_hdrs if not uses_nanopb_or_protofull(h)]
96 srcs = [s for s in lib.src if not uses_nanopb_or_protofull(s)] 113 srcs = [s for s in lib.src if not uses_nanopb_or_protofull(s)]
97 %> 114 %>
98 source_set("${lib.name}") { 115 source_set("${lib.name}") {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 configs -= [ "//build/config/compiler:chromium_code" ] 157 configs -= [ "//build/config/compiler:chromium_code" ]
141 configs += [ 158 configs += [
142 "//build/config/compiler:no_chromium_code", 159 "//build/config/compiler:no_chromium_code",
143 % for config in get_extra_configs(tgt): 160 % for config in get_extra_configs(tgt):
144 "${config}", 161 "${config}",
145 % endfor 162 % endfor
146 ] 163 ]
147 public_configs = [ ":grpc_config" ] 164 public_configs = [ ":grpc_config" ]
148 } 165 }
149 </%def> 166 </%def>
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698