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
3 # found in the LICENSE file.
6 config_h_dir = "vsprojects"
11 config("protobuf_config") {
17 "GOOGLE_PROTOBUF_NO_RTTI",
18 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
22 # TODO(jschuh): http://crbug.com/167187 size_t -> int.
23 cflags = [ "/wd4267" ]
27 if (component_mode == "shared_library") {
28 config("protobuf_use_dlls") {
29 defines = [ "PROTOBUF_USE_DLLS" ]
33 # This condif should be applied to targets using generated code from the proto
34 # compiler. It sets up the include directories properly.
35 config("using_proto") {
36 include_dirs = [ "$root_gen_dir/protoc_out" ]
39 protobuf_lite_sources = [
40 "src/google/protobuf/extension_set.cc",
41 "src/google/protobuf/extension_set.h",
42 "src/google/protobuf/generated_message_util.cc",
43 "src/google/protobuf/generated_message_util.h",
44 "src/google/protobuf/io/coded_stream.cc",
45 "src/google/protobuf/io/coded_stream.h",
46 "src/google/protobuf/io/coded_stream_inl.h",
47 "src/google/protobuf/io/zero_copy_stream.cc",
48 "src/google/protobuf/io/zero_copy_stream.h",
49 "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
50 "src/google/protobuf/io/zero_copy_stream_impl_lite.h",
51 "src/google/protobuf/message_lite.cc",
52 "src/google/protobuf/message_lite.h",
53 "src/google/protobuf/repeated_field.cc",
54 "src/google/protobuf/repeated_field.h",
55 "src/google/protobuf/stubs/atomicops.h",
56 "src/google/protobuf/stubs/atomicops_internals_arm_gcc.h",
57 "src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h",
58 "src/google/protobuf/stubs/atomicops_internals_macosx.h",
59 "src/google/protobuf/stubs/atomicops_internals_mips_gcc.h",
60 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
61 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.h",
62 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
63 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.h",
64 "src/google/protobuf/stubs/common.cc",
65 "src/google/protobuf/stubs/common.h",
66 "src/google/protobuf/stubs/hash.h",
67 "src/google/protobuf/stubs/map-util.h",
68 "src/google/protobuf/stubs/once.cc",
69 "src/google/protobuf/stubs/once.h",
70 "src/google/protobuf/stubs/platform_macros.h",
71 "src/google/protobuf/unknown_field_set.cc",
72 "src/google/protobuf/unknown_field_set.h",
73 "src/google/protobuf/wire_format_lite.cc",
74 "src/google/protobuf/wire_format_lite.h",
75 "src/google/protobuf/wire_format_lite_inl.h",
76 "$config_h_dir/config.h",
79 protobuf_lite_cflags = []
81 protobuf_lite_cflags = [
82 "/wd4018", # signed/unsigned mismatch in comparison
83 "/wd4244", # implicit conversion, possible loss of data
84 "/wd4355", # 'this' used in base member initializer list
85 "/wd4267", # size_t to int truncation
86 "/wd4291", # no matching operator delete for a placement new
90 component("protobuf_lite") {
91 sources = protobuf_lite_sources
93 configs -= [ "//build/config/compiler:chromium_code" ]
94 configs += [ "//build/config/compiler:no_chromium_code" ]
96 configs -= [ "//build/config/win:lean_and_mean" ]
98 public_configs = [ ":protobuf_config" ]
100 cflags = protobuf_lite_cflags
102 # Required for component builds. See http://crbug.com/172800.
103 if (component_mode == "shared_library") {
104 public_configs += [ ":protobuf_use_dlls" ]
105 defines = [ "LIBPROTOBUF_EXPORTS" ]
109 # This is the full, heavy protobuf lib that's needed for c++ .protos that don't
110 # specify the LITE_RUNTIME option. The protocol compiler itself (protoc) falls
111 # into that category. Do not use in Chrome code.
113 source_set("protobuf_full") {
114 # Prevent people from depending on this outside our file.
115 visibility = [ ":*" ]
117 sources = protobuf_lite_sources
119 "src/google/protobuf/descriptor.h",
120 "src/google/protobuf/descriptor.pb.h",
121 "src/google/protobuf/descriptor_database.h",
122 "src/google/protobuf/dynamic_message.h",
123 "src/google/protobuf/generated_enum_reflection.h",
124 "src/google/protobuf/generated_message_reflection.h",
125 "src/google/protobuf/message.h",
126 "src/google/protobuf/reflection_ops.h",
127 "src/google/protobuf/service.h",
128 "src/google/protobuf/text_format.h",
129 "src/google/protobuf/wire_format.h",
130 "src/google/protobuf/io/gzip_stream.h",
131 "src/google/protobuf/io/printer.h",
132 "src/google/protobuf/io/tokenizer.h",
133 "src/google/protobuf/io/zero_copy_stream_impl.h",
134 "src/google/protobuf/compiler/code_generator.h",
135 "src/google/protobuf/compiler/command_line_interface.h",
136 "src/google/protobuf/compiler/importer.h",
137 "src/google/protobuf/compiler/java/java_doc_comment.cc",
138 "src/google/protobuf/compiler/java/java_doc_comment.h",
139 "src/google/protobuf/compiler/parser.h",
140 "src/google/protobuf/stubs/strutil.cc",
141 "src/google/protobuf/stubs/strutil.h",
142 "src/google/protobuf/stubs/substitute.cc",
143 "src/google/protobuf/stubs/substitute.h",
144 "src/google/protobuf/stubs/stl_util.h",
145 "src/google/protobuf/stubs/stringprintf.cc",
146 "src/google/protobuf/stubs/stringprintf.h",
147 "src/google/protobuf/stubs/structurally_valid.cc",
148 "src/google/protobuf/stubs/template_util.h",
149 "src/google/protobuf/stubs/type_traits.h",
150 "src/google/protobuf/descriptor.cc",
151 "src/google/protobuf/descriptor.pb.cc",
152 "src/google/protobuf/descriptor_database.cc",
153 "src/google/protobuf/dynamic_message.cc",
154 "src/google/protobuf/extension_set_heavy.cc",
155 "src/google/protobuf/generated_message_reflection.cc",
156 "src/google/protobuf/message.cc",
157 "src/google/protobuf/reflection_ops.cc",
158 "src/google/protobuf/service.cc",
159 "src/google/protobuf/text_format.cc",
160 "src/google/protobuf/wire_format.cc",
162 # This file pulls in zlib, but it's not actually used by protoc, so
163 # instead of compiling zlib for the host, let's just exclude this.
164 # "src/src/google/protobuf/io/gzip_stream.cc",
165 "src/google/protobuf/io/printer.cc",
166 "src/google/protobuf/io/tokenizer.cc",
167 "src/google/protobuf/io/zero_copy_stream_impl.cc",
168 "src/google/protobuf/compiler/importer.cc",
169 "src/google/protobuf/compiler/parser.cc",
172 configs -= [ "//build/config/compiler:chromium_code" ]
173 configs += [ "//build/config/compiler:no_chromium_code" ]
175 configs -= [ "//build/config/win:lean_and_mean" ]
177 public_configs = [ ":protobuf_config" ]
179 cflags = protobuf_lite_cflags
182 # Only compile the compiler for the host architecture.
183 if (current_toolchain == host_toolchain) {
184 executable("protoc") {
186 "src/google/protobuf/compiler/code_generator.cc",
187 "src/google/protobuf/compiler/command_line_interface.cc",
188 "src/google/protobuf/compiler/plugin.cc",
189 "src/google/protobuf/compiler/plugin.pb.cc",
190 "src/google/protobuf/compiler/subprocess.cc",
191 "src/google/protobuf/compiler/subprocess.h",
192 "src/google/protobuf/compiler/zip_writer.cc",
193 "src/google/protobuf/compiler/zip_writer.h",
194 "src/google/protobuf/compiler/cpp/cpp_enum.cc",
195 "src/google/protobuf/compiler/cpp/cpp_enum.h",
196 "src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
197 "src/google/protobuf/compiler/cpp/cpp_enum_field.h",
198 "src/google/protobuf/compiler/cpp/cpp_extension.cc",
199 "src/google/protobuf/compiler/cpp/cpp_extension.h",
200 "src/google/protobuf/compiler/cpp/cpp_field.cc",
201 "src/google/protobuf/compiler/cpp/cpp_field.h",
202 "src/google/protobuf/compiler/cpp/cpp_file.cc",
203 "src/google/protobuf/compiler/cpp/cpp_file.h",
204 "src/google/protobuf/compiler/cpp/cpp_generator.cc",
205 "src/google/protobuf/compiler/cpp/cpp_helpers.cc",
206 "src/google/protobuf/compiler/cpp/cpp_helpers.h",
207 "src/google/protobuf/compiler/cpp/cpp_message.cc",
208 "src/google/protobuf/compiler/cpp/cpp_message.h",
209 "src/google/protobuf/compiler/cpp/cpp_message_field.cc",
210 "src/google/protobuf/compiler/cpp/cpp_message_field.h",
211 "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
212 "src/google/protobuf/compiler/cpp/cpp_primitive_field.h",
213 "src/google/protobuf/compiler/cpp/cpp_service.cc",
214 "src/google/protobuf/compiler/cpp/cpp_service.h",
215 "src/google/protobuf/compiler/cpp/cpp_string_field.cc",
216 "src/google/protobuf/compiler/cpp/cpp_string_field.h",
217 "src/google/protobuf/compiler/java/java_enum.cc",
218 "src/google/protobuf/compiler/java/java_enum.h",
219 "src/google/protobuf/compiler/java/java_enum_field.cc",
220 "src/google/protobuf/compiler/java/java_enum_field.h",
221 "src/google/protobuf/compiler/java/java_extension.cc",
222 "src/google/protobuf/compiler/java/java_extension.h",
223 "src/google/protobuf/compiler/java/java_field.cc",
224 "src/google/protobuf/compiler/java/java_field.h",
225 "src/google/protobuf/compiler/java/java_file.cc",
226 "src/google/protobuf/compiler/java/java_file.h",
227 "src/google/protobuf/compiler/java/java_generator.cc",
228 "src/google/protobuf/compiler/java/java_helpers.cc",
229 "src/google/protobuf/compiler/java/java_helpers.h",
230 "src/google/protobuf/compiler/java/java_message.cc",
231 "src/google/protobuf/compiler/java/java_message.h",
232 "src/google/protobuf/compiler/java/java_message_field.cc",
233 "src/google/protobuf/compiler/java/java_message_field.h",
234 "src/google/protobuf/compiler/java/java_primitive_field.cc",
235 "src/google/protobuf/compiler/java/java_primitive_field.h",
236 "src/google/protobuf/compiler/java/java_service.cc",
237 "src/google/protobuf/compiler/java/java_service.h",
238 "src/google/protobuf/compiler/java/java_string_field.cc",
239 "src/google/protobuf/compiler/java/java_string_field.h",
240 "src/google/protobuf/compiler/python/python_generator.cc",
241 "src/google/protobuf/compiler/main.cc",
244 configs -= [ "//build/config/compiler:chromium_code" ]
245 configs += [ "//build/config/compiler:no_chromium_code" ]
247 # This is defined internally, don't warn on duplicate.
248 configs -= [ "//build/config/win:lean_and_mean" ]
251 cflags = protobuf_lite_cflags
256 deps += [ "//build/config/sanitizers:deps" ]