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 ".", |
11 "include/", | 11 "include/", |
12 ] | 12 ] |
13 | 13 |
14 defines = [ "GRPC_USE_PROTO_LITE" ] | 14 defines = [ |
15 } | 15 "GRPC_USE_PROTO_LITE", |
16 | 16 # TODO(xyzzyz): the <condition_variable> header in libstdc++-4.6 we're usi
ng |
17 config("grpc_no_cxx11_threads") { | 17 # in Chromium has a bug, which causes a compilation error on Clang. |
18 # TODO(xyzzyz): the <condition_variable> header in libstdc++-4.6 we're using | 18 # Therefore, we need to make gRPC not use standard library threading |
19 # in Chromium has a bug, which causes a compilation error on Clang. | 19 # support. |
20 # Therefore, we need to make gRPC not use standard library threading support
. | 20 # https://crbug.com/593874 |
21 # https://crbug.com/593874 | 21 "GRPC_CXX0X_NO_THREAD", |
22 defines = [ "GRPC_CXX0X_NO_THREAD" ] | 22 ] |
23 } | 23 } |
24 | 24 |
25 <%! | 25 <%! |
26 def get_deps(target_dict): | 26 def get_deps(target_dict): |
27 deps = [] | 27 deps = [] |
28 if target_dict.get("secure", False): | 28 if target_dict.get("secure", False): |
29 deps = [ | 29 deps = [ |
30 "//third_party/boringssl", | 30 "//third_party/boringssl", |
31 ] | 31 ] |
32 | 32 |
33 if target_dict.get("build", None) == "protoc": | 33 if target_dict.get("build", None) == "protoc": |
34 deps.append("//third_party/protobuf:protoc_lib") | 34 deps.append("//third_party/protobuf:protoc_lib") |
35 | 35 |
36 name = target_dict.get("name", None) | 36 name = target_dict.get("name", None) |
37 if name in ("grpc++_unsecure", "grpc++", "grpc++_codegen_lib"): | 37 if name in ("grpc++_unsecure", "grpc++", "grpc++_codegen_lib"): |
38 deps.append("//third_party/protobuf:protobuf_lite") | 38 deps.append("//third_party/protobuf:protobuf_lite") |
39 elif name == "grpc": | 39 elif name in ("grpc", "grpc_unsecure"): |
40 deps.append("//third_party/zlib") | 40 deps.append("//third_party/zlib") |
41 | 41 |
42 for d in target_dict.get("deps", []): | 42 for d in target_dict.get("deps", []): |
| 43 # TODO(xyzzyz): grpc++_unsecure mistakenly depends on both grpc and |
| 44 # grpc_unsecure. Remove when it's fixed. |
| 45 # See https://github.com/grpc/grpc/issues/7739 |
| 46 if name == "grpc++_unsecure" and d == "grpc": |
| 47 # Ignore. |
| 48 continue |
| 49 |
43 if d.startswith(("//", ":")): | 50 if d.startswith(("//", ":")): |
44 deps.append(d) | 51 deps.append(d) |
45 else: | 52 else: |
46 deps.append(":%s" % d) | 53 deps.append(":%s" % d) |
47 return deps | 54 return deps |
48 | 55 |
49 def get_extra_configs(target_dict): | 56 def get_extra_configs(target_dict): |
50 if target_dict.get("name", "") in ("grpc++", "grpc++_unsecure"): | |
51 return [":grpc_no_cxx11_threads"] | |
52 if target_dict.get("name", "") == "grpc_cpp_plugin": | 57 if target_dict.get("name", "") == "grpc_cpp_plugin": |
53 return ["//third_party/protobuf:protobuf_config"] | 58 return ["//third_party/protobuf:protobuf_config"] |
54 return [] | 59 return [] |
55 | 60 |
56 def uses_nanopb_or_protofull(f): | 61 def uses_nanopb_or_protofull(f): |
57 return (f.startswith("third_party/nanopb") | 62 return (f.startswith("third_party/nanopb") |
58 or f.endswith(".pb.h") | 63 or f.endswith(".pb.h") |
59 or f.endswith(".pb.c") | 64 or f.endswith(".pb.c") |
60 or f.endswith(".pb.cc") | 65 or f.endswith(".pb.cc") |
61 or f.endswith("load_balancer_api.h") | 66 or f.endswith("load_balancer_api.h") |
(...skipping 21 matching lines...) Expand all Loading... |
83 ${cc_binary(tgt)} | 88 ${cc_binary(tgt)} |
84 % endif | 89 % endif |
85 % endfor | 90 % endfor |
86 | 91 |
87 <%def name="cc_library(lib)"> | 92 <%def name="cc_library(lib)"> |
88 <% | 93 <% |
89 lib_hdrs = lib.get("headers", []) | 94 lib_hdrs = lib.get("headers", []) |
90 hdrs = [h for h in lib_hdrs if not uses_nanopb_or_protofull(h)] | 95 hdrs = [h for h in lib_hdrs if not uses_nanopb_or_protofull(h)] |
91 srcs = [s for s in lib.src if not uses_nanopb_or_protofull(s)] | 96 srcs = [s for s in lib.src if not uses_nanopb_or_protofull(s)] |
92 %> | 97 %> |
93 component("${lib.name}") { | 98 source_set("${lib.name}") { |
94 sources = [ | 99 sources = [ |
95 % for hdr in lib.get("public_headers", []): | 100 % for hdr in lib.get("public_headers", []): |
96 "${hdr}", | 101 "${hdr}", |
97 % endfor | 102 % endfor |
98 % for hdr in hdrs: | 103 % for hdr in hdrs: |
99 "${hdr}", | 104 "${hdr}", |
100 % endfor | 105 % endfor |
101 % for src in srcs: | 106 % for src in srcs: |
102 "${src}", | 107 "${src}", |
103 % endfor | 108 % endfor |
104 ] | 109 ] |
105 deps = [ | 110 deps = [ |
106 % for dep in get_deps(lib): | 111 % for dep in get_deps(lib): |
107 "${dep}", | 112 "${dep}", |
108 % endfor | 113 % endfor |
109 ] | 114 ] |
110 configs -= [ "//build/config/compiler:chromium_code" ] | 115 configs -= [ "//build/config/compiler:chromium_code" ] |
111 configs += [ | 116 configs += [ |
112 "//build/config/compiler:no_chromium_code", | 117 "//build/config/compiler:no_chromium_code", |
113 % for config in get_extra_configs(lib): | 118 % for config in get_extra_configs(lib): |
114 "${config}", | 119 "${config}", |
115 % endfor | 120 % endfor |
116 ] | 121 ] |
117 public_configs = [ ":grpc_config" ] | 122 public_configs = [ |
| 123 ":grpc_config", |
| 124 ] |
118 } | 125 } |
119 </%def> | 126 </%def> |
120 | 127 |
121 <%def name="cc_binary(tgt)"> | 128 <%def name="cc_binary(tgt)"> |
122 executable("${tgt.name}") { | 129 executable("${tgt.name}") { |
123 sources = [ | 130 sources = [ |
124 % for src in tgt.src: | 131 % for src in tgt.src: |
125 "${src}", | 132 "${src}", |
126 % endfor | 133 % endfor |
127 ] | 134 ] |
128 deps = [ | 135 deps = [ |
129 % for dep in get_deps(tgt): | 136 % for dep in get_deps(tgt): |
130 "${dep}", | 137 "${dep}", |
131 % endfor | 138 % endfor |
132 ] | 139 ] |
133 configs -= [ "//build/config/compiler:chromium_code" ] | 140 configs -= [ "//build/config/compiler:chromium_code" ] |
134 configs += [ | 141 configs += [ |
135 "//build/config/compiler:no_chromium_code", | 142 "//build/config/compiler:no_chromium_code", |
136 % for config in get_extra_configs(tgt): | 143 % for config in get_extra_configs(tgt): |
137 "${config}", | 144 "${config}", |
138 % endfor | 145 % endfor |
139 ] | 146 ] |
140 public_configs = [ ":grpc_config" ] | 147 public_configs = [ ":grpc_config" ] |
141 } | 148 } |
142 </%def> | 149 </%def> |
OLD | NEW |