OLD | NEW |
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 Loading... |
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 Loading... |
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> |
OLD | NEW |