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

Side by Side Diff: third_party/protobuf/BUILD.gn

Issue 2762193002: [protobuf] Fix potential double definition build errors. (Closed)
Patch Set: add protobuf_globals_sources Created 3 years, 9 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 | « no previous file | 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 config("protobuf_config") { 5 config("protobuf_config") {
6 include_dirs = [ "src" ] 6 include_dirs = [ "src" ]
7 defines = [ 7 defines = [
8 "GOOGLE_PROTOBUF_NO_RTTI", 8 "GOOGLE_PROTOBUF_NO_RTTI",
9 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", 9 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
10 ] 10 ]
(...skipping 18 matching lines...) Expand all
29 29
30 # This config should be applied to targets using generated code from the proto 30 # This config should be applied to targets using generated code from the proto
31 # compiler. It sets up the include directories properly. 31 # compiler. It sets up the include directories properly.
32 config("using_proto") { 32 config("using_proto") {
33 include_dirs = [ 33 include_dirs = [
34 "src", 34 "src",
35 "$root_gen_dir/protoc_out", 35 "$root_gen_dir/protoc_out",
36 ] 36 ]
37 } 37 }
38 38
39 protobuf_globals_sources = [
40 "src/google/protobuf/globals.cc",
41 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
42 ]
43
39 protobuf_lite_sources = [ 44 protobuf_lite_sources = [
40 "src/google/protobuf/arena.cc", 45 "src/google/protobuf/arena.cc",
41 "src/google/protobuf/arena.h", 46 "src/google/protobuf/arena.h",
42 "src/google/protobuf/arenastring.cc", 47 "src/google/protobuf/arenastring.cc",
43 "src/google/protobuf/arenastring.h", 48 "src/google/protobuf/arenastring.h",
44 "src/google/protobuf/extension_set.cc", 49 "src/google/protobuf/extension_set.cc",
45 "src/google/protobuf/extension_set.h", 50 "src/google/protobuf/extension_set.h",
46 "src/google/protobuf/generated_message_util.cc", 51 "src/google/protobuf/generated_message_util.cc",
47 "src/google/protobuf/generated_message_util.h", 52 "src/google/protobuf/generated_message_util.h",
48 "src/google/protobuf/io/coded_stream.cc", 53 "src/google/protobuf/io/coded_stream.cc",
(...skipping 17 matching lines...) Expand all
66 "src/google/protobuf/stubs/atomicops_internals_arm_qnx.h", 71 "src/google/protobuf/stubs/atomicops_internals_arm_qnx.h",
67 "src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h", 72 "src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h",
68 "src/google/protobuf/stubs/atomicops_internals_generic_gcc.h", 73 "src/google/protobuf/stubs/atomicops_internals_generic_gcc.h",
69 "src/google/protobuf/stubs/atomicops_internals_macosx.h", 74 "src/google/protobuf/stubs/atomicops_internals_macosx.h",
70 "src/google/protobuf/stubs/atomicops_internals_mips_gcc.h", 75 "src/google/protobuf/stubs/atomicops_internals_mips_gcc.h",
71 "src/google/protobuf/stubs/atomicops_internals_pnacl.h", 76 "src/google/protobuf/stubs/atomicops_internals_pnacl.h",
72 "src/google/protobuf/stubs/atomicops_internals_power.h", 77 "src/google/protobuf/stubs/atomicops_internals_power.h",
73 "src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h", 78 "src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h",
74 "src/google/protobuf/stubs/atomicops_internals_solaris.h", 79 "src/google/protobuf/stubs/atomicops_internals_solaris.h",
75 "src/google/protobuf/stubs/atomicops_internals_tsan.h", 80 "src/google/protobuf/stubs/atomicops_internals_tsan.h",
76 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
77 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.h", 81 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.h",
78 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc", 82 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
79 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.h", 83 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.h",
80 "src/google/protobuf/stubs/atomic_sequence_num.h", 84 "src/google/protobuf/stubs/atomic_sequence_num.h",
81 "src/google/protobuf/stubs/bytestream.cc", 85 "src/google/protobuf/stubs/bytestream.cc",
82 "src/google/protobuf/stubs/bytestream.h", 86 "src/google/protobuf/stubs/bytestream.h",
83 "src/google/protobuf/stubs/callback.h", 87 "src/google/protobuf/stubs/callback.h",
84 "src/google/protobuf/stubs/casts.h", 88 "src/google/protobuf/stubs/casts.h",
85 "src/google/protobuf/stubs/common.cc", 89 "src/google/protobuf/stubs/common.cc",
86 "src/google/protobuf/stubs/common.h", 90 "src/google/protobuf/stubs/common.h",
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 # be shared across different copies of the library in each component. 157 # be shared across different copies of the library in each component.
154 # protobuf_globals is a shared library that provides this state, but is 158 # protobuf_globals is a shared library that provides this state, but is
155 # careful to prefix all exported symbols with 'cr_' so they don't conflict 159 # careful to prefix all exported symbols with 'cr_' so they don't conflict
156 # with other versions of protobuf. 160 # with other versions of protobuf.
157 component("protobuf_globals") { 161 component("protobuf_globals") {
158 configs += [ 162 configs += [
159 ":protobuf_config", 163 ":protobuf_config",
160 ":protobuf_use_dlls", 164 ":protobuf_use_dlls",
161 ] 165 ]
162 defines = [ "LIBPROTOBUF_EXPORTS" ] 166 defines = [ "LIBPROTOBUF_EXPORTS" ]
163 sources = [ 167 sources = protobuf_globals_sources
164 "src/google/protobuf/globals.cc",
165 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
166 ]
167 } 168 }
168 } 169 }
169 170
170 target(link_target_type, "protobuf_lite") { 171 target(link_target_type, "protobuf_lite") {
171 sources = protobuf_lite_sources 172 sources = protobuf_lite_sources
172 173
173 configs -= [ "//build/config/compiler:chromium_code" ] 174 configs -= [ "//build/config/compiler:chromium_code" ]
174 configs += [ 175 configs += [
175 "//build/config/compiler:no_chromium_code", 176 "//build/config/compiler:no_chromium_code",
176 177
(...skipping 15 matching lines...) Expand all
192 193
193 deps = [ 194 deps = [
194 "//build/config/sanitizers:deps", 195 "//build/config/sanitizers:deps",
195 ] 196 ]
196 197
197 cflags = protobuf_lite_cflags 198 cflags = protobuf_lite_cflags
198 199
199 if (is_component_build && is_linux && !is_chromeos) { 200 if (is_component_build && is_linux && !is_chromeos) {
200 deps += [ ":protobuf_globals" ] 201 deps += [ ":protobuf_globals" ]
201 } else { 202 } else {
202 sources += [ "src/google/protobuf/globals.cc" ] 203 sources += protobuf_globals_sources
203 } 204 }
204 205
205 # Required for component builds. See http://crbug.com/172800. 206 # Required for component builds. See http://crbug.com/172800.
206 if (is_component_build && (!is_linux || is_chromeos)) { 207 if (is_component_build && (!is_linux || is_chromeos)) {
207 public_configs += [ ":protobuf_use_dlls" ] 208 public_configs += [ ":protobuf_use_dlls" ]
208 defines = [ "LIBPROTOBUF_EXPORTS" ] 209 defines = [ "LIBPROTOBUF_EXPORTS" ]
209 } 210 }
210 } 211 }
211 212
212 # This is the full, heavy protobuf lib that's needed for c++ .protos that don't 213 # This is the full, heavy protobuf lib that's needed for c++ .protos that don't
213 # specify the LITE_RUNTIME option. The protocol compiler itself (protoc) falls 214 # specify the LITE_RUNTIME option. The protocol compiler itself (protoc) falls
214 # into that category. Do not use in Chrome code. 215 # into that category. Do not use in Chrome code.
215 static_library("protobuf_full") { 216 static_library("protobuf_full") {
216 # Prevent people from depending on this outside our file. 217 # Prevent people from depending on this outside our file.
217 visibility = [ 218 visibility = [
218 ":*", 219 ":*",
219 220
220 # requires descriptors & reflection; testonly. 221 # requires descriptors & reflection; testonly.
221 "//third_party/libprotobuf-mutator:*", 222 "//third_party/libprotobuf-mutator:*",
222 ] 223 ]
223 224
224 sources = protobuf_lite_sources 225 sources = protobuf_lite_sources + protobuf_globals_sources + [
225 sources += [
226 "src/google/protobuf/any.cc", 226 "src/google/protobuf/any.cc",
227 "src/google/protobuf/any.h", 227 "src/google/protobuf/any.h",
228 "src/google/protobuf/any.pb.cc", 228 "src/google/protobuf/any.pb.cc",
229 "src/google/protobuf/any.pb.h", 229 "src/google/protobuf/any.pb.h",
230 "src/google/protobuf/api.pb.cc", 230 "src/google/protobuf/api.pb.cc",
231 "src/google/protobuf/api.pb.h", 231 "src/google/protobuf/api.pb.h",
232 "src/google/protobuf/compiler/importer.cc", 232 "src/google/protobuf/compiler/importer.cc",
233 "src/google/protobuf/compiler/importer.h", 233 "src/google/protobuf/compiler/importer.h",
234 "src/google/protobuf/compiler/parser.cc", 234 "src/google/protobuf/compiler/parser.cc",
235 "src/google/protobuf/compiler/parser.h", 235 "src/google/protobuf/compiler/parser.h",
236 "src/google/protobuf/descriptor.cc", 236 "src/google/protobuf/descriptor.cc",
237 "src/google/protobuf/descriptor.h", 237 "src/google/protobuf/descriptor.h",
238 "src/google/protobuf/descriptor.pb.cc", 238 "src/google/protobuf/descriptor.pb.cc",
239 "src/google/protobuf/descriptor.pb.h", 239 "src/google/protobuf/descriptor.pb.h",
240 "src/google/protobuf/descriptor_database.cc", 240 "src/google/protobuf/descriptor_database.cc",
241 "src/google/protobuf/descriptor_database.h", 241 "src/google/protobuf/descriptor_database.h",
242 "src/google/protobuf/duration.pb.cc", 242 "src/google/protobuf/duration.pb.cc",
243 "src/google/protobuf/duration.pb.h", 243 "src/google/protobuf/duration.pb.h",
244 "src/google/protobuf/dynamic_message.cc", 244 "src/google/protobuf/dynamic_message.cc",
245 "src/google/protobuf/dynamic_message.h", 245 "src/google/protobuf/dynamic_message.h",
246 "src/google/protobuf/empty.pb.cc", 246 "src/google/protobuf/empty.pb.cc",
247 "src/google/protobuf/empty.pb.h", 247 "src/google/protobuf/empty.pb.h",
248 "src/google/protobuf/extension_set_heavy.cc", 248 "src/google/protobuf/extension_set_heavy.cc",
249 "src/google/protobuf/field_mask.pb.cc", 249 "src/google/protobuf/field_mask.pb.cc",
250 "src/google/protobuf/field_mask.pb.h", 250 "src/google/protobuf/field_mask.pb.h",
251 "src/google/protobuf/generated_enum_reflection.h", 251 "src/google/protobuf/generated_enum_reflection.h",
252 "src/google/protobuf/generated_enum_util.h", 252 "src/google/protobuf/generated_enum_util.h",
253 "src/google/protobuf/generated_message_reflection.cc", 253 "src/google/protobuf/generated_message_reflection.cc",
254 "src/google/protobuf/generated_message_reflection.h", 254 "src/google/protobuf/generated_message_reflection.h",
255 "src/google/protobuf/globals.cc",
256 255
257 # gzip_stream.cc pulls in zlib, but it's not actually used by protoc, just 256 # gzip_stream.cc pulls in zlib, but it's not actually used by protoc, just
258 # by test code, so instead of compiling zlib for the host, let's just 257 # by test code, so instead of compiling zlib for the host, let's just
259 # exclude this. 258 # exclude this.
260 # "src/google/protobuf/io/gzip_stream.cc", 259 # "src/google/protobuf/io/gzip_stream.cc",
261 # "src/google/protobuf/io/gzip_stream.h", 260 # "src/google/protobuf/io/gzip_stream.h",
262 261
263 "src/google/protobuf/io/printer.cc", 262 "src/google/protobuf/io/printer.cc",
264 "src/google/protobuf/io/printer.h", 263 "src/google/protobuf/io/printer.h",
265 "src/google/protobuf/io/strtod.cc", 264 "src/google/protobuf/io/strtod.cc",
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 ":copy_google_protobuf_internal", 685 ":copy_google_protobuf_internal",
687 ":copy_six", 686 ":copy_six",
688 ] 687 ]
689 688
690 # Targets that depend on this should depend on the copied data files. 689 # Targets that depend on this should depend on the copied data files.
691 data = get_target_outputs(":copy_google") 690 data = get_target_outputs(":copy_google")
692 data += get_target_outputs(":copy_six") 691 data += get_target_outputs(":copy_six")
693 data += get_target_outputs(":copy_google_protobuf") 692 data += get_target_outputs(":copy_google_protobuf")
694 data += get_target_outputs(":copy_google_protobuf_internal") 693 data += get_target_outputs(":copy_google_protobuf_internal")
695 } 694 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698