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