1 # Copyright (c) 2012 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.
7 ['use_system_protobuf==0', {
12 '.', # crafted for gcc/linux.
14 }, { # else, OS=="win"
17 'vsprojects', # crafted for msvc.
20 'msvs_disabled_warnings': [
21 4018, # signed/unsigned mismatch in comparison
22 4244, # implicit conversion, possible loss of data
23 4355, # 'this' used in base member initializer list
24 4267, # size_t to int truncation
25 4291, # no matching operator delete for a placement new
28 'WIN32_LEAN_AND_MEAN', # Protobuf defines this itself.
32 ['OS=="ios" and "<(GENERATOR)"!="ninja"', {
34 'ninja_output_dir': 'ninja-protoc',
36 '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)',
39 'third_party/protobuf/protobuf.gyp',
44 # On iOS, generating protoc is done via two actions: (1) compiling
45 # the executable with ninja, and (2) copying the executable into a
46 # location that is shared with other projects. These actions are
47 # separated into two targets in order to be able to specify that the
48 # second action should not run until the first action finishes (since
49 # the ordering of multiple actions in one target is defined only by
50 # inputs and outputs, and it's impossible to set correct inputs for
51 # the ninja build, so setting all the inputs and outputs isn't an
52 # option). The first target is given here; the second target is the
53 # normal protoc target under the condition that "OS==iOS".
54 'target_name': 'compile_protoc',
56 'includes': ['../../build/ios/mac_build.gypi'],
59 'action_name': 'compile protoc',
66 'message': 'Generating the C++ protocol buffers compiler',
74 # The "lite" lib is about 1/7th the size of the heavy lib,
75 # but it doesn't support some of the more exotic features of
76 # protobufs, like reflection. To generate C++ code that can link
77 # against the lite version of the library, add the option line:
79 # option optimize_for = LITE_RUNTIME;
81 # to your .proto file.
83 'target_name': 'protobuf_lite',
84 'type': '<(component)',
85 'toolsets': ['host', 'target'],
89 # Required for component builds. See http://crbug.com/172800.
91 'LIBPROTOBUF_EXPORTS',
94 'direct_dependent_settings': {
100 # This is the full, heavy protobuf lib that's needed for c++ .protos
101 # that don't specify the LITE_RUNTIME option. The protocol
102 # compiler itself (protoc) falls into that category.
104 # DO NOT LINK AGAINST THIS TARGET IN CHROME CODE --agl
106 'target_name': 'protobuf_full_do_not_use',
107 'type': 'static_library',
108 'toolsets': ['host','target'],
110 'protobuf_lite.gypi',
113 'src/google/protobuf/descriptor.h',
114 'src/google/protobuf/descriptor.pb.h',
115 'src/google/protobuf/descriptor_database.h',
116 'src/google/protobuf/dynamic_message.h',
117 'src/google/protobuf/generated_enum_reflection.h',
118 'src/google/protobuf/generated_message_reflection.h',
119 'src/google/protobuf/message.h',
120 'src/google/protobuf/reflection_ops.h',
121 'src/google/protobuf/service.h',
122 'src/google/protobuf/text_format.h',
123 'src/google/protobuf/wire_format.h',
124 'src/google/protobuf/io/gzip_stream.h',
125 'src/google/protobuf/io/printer.h',
126 'src/google/protobuf/io/tokenizer.h',
127 'src/google/protobuf/io/zero_copy_stream_impl.h',
128 'src/google/protobuf/compiler/code_generator.h',
129 'src/google/protobuf/compiler/command_line_interface.h',
130 'src/google/protobuf/compiler/importer.h',
131 'src/google/protobuf/compiler/java/java_doc_comment.cc',
132 'src/google/protobuf/compiler/java/java_doc_comment.h',
133 'src/google/protobuf/compiler/parser.h',
135 'src/google/protobuf/stubs/strutil.cc',
136 'src/google/protobuf/stubs/strutil.h',
137 'src/google/protobuf/stubs/substitute.cc',
138 'src/google/protobuf/stubs/substitute.h',
139 'src/google/protobuf/stubs/stl_util.h',
140 'src/google/protobuf/stubs/stringprintf.cc',
141 'src/google/protobuf/stubs/stringprintf.h',
142 'src/google/protobuf/stubs/structurally_valid.cc',
143 'src/google/protobuf/stubs/template_util.h',
144 'src/google/protobuf/stubs/type_traits.h',
146 'src/google/protobuf/descriptor.cc',
147 'src/google/protobuf/descriptor.pb.cc',
148 'src/google/protobuf/descriptor_database.cc',
149 'src/google/protobuf/dynamic_message.cc',
150 'src/google/protobuf/extension_set.cc',
151 'src/google/protobuf/extension_set.h',
152 'src/google/protobuf/extension_set_heavy.cc',
153 'src/google/protobuf/generated_message_reflection.cc',
154 'src/google/protobuf/message.cc',
155 'src/google/protobuf/reflection_ops.cc',
156 'src/google/protobuf/service.cc',
157 'src/google/protobuf/text_format.cc',
158 'src/google/protobuf/wire_format.cc',
159 # This file pulls in zlib, but it's not actually used by protoc, so
160 # instead of compiling zlib for the host, let's just exclude this.
161 # 'src/src/google/protobuf/io/gzip_stream.cc',
162 'src/google/protobuf/io/printer.cc',
163 'src/google/protobuf/io/tokenizer.cc',
164 'src/google/protobuf/io/zero_copy_stream_impl.cc',
165 'src/google/protobuf/compiler/importer.cc',
166 'src/google/protobuf/compiler/parser.cc',
170 'target_name': 'protoc',
172 ['OS!="ios" or "<(GENERATOR)"=="ninja"', {
173 'type': 'executable',
174 'toolsets': ['host'],
176 'src/google/protobuf/compiler/code_generator.cc',
177 'src/google/protobuf/compiler/command_line_interface.cc',
178 'src/google/protobuf/compiler/plugin.cc',
179 'src/google/protobuf/compiler/plugin.pb.cc',
180 'src/google/protobuf/compiler/subprocess.cc',
181 'src/google/protobuf/compiler/subprocess.h',
182 'src/google/protobuf/compiler/zip_writer.cc',
183 'src/google/protobuf/compiler/zip_writer.h',
184 'src/google/protobuf/compiler/cpp/cpp_enum.cc',
185 'src/google/protobuf/compiler/cpp/cpp_enum.h',
186 'src/google/protobuf/compiler/cpp/cpp_enum_field.cc',
187 'src/google/protobuf/compiler/cpp/cpp_enum_field.h',
188 'src/google/protobuf/compiler/cpp/cpp_extension.cc',
189 'src/google/protobuf/compiler/cpp/cpp_extension.h',
190 'src/google/protobuf/compiler/cpp/cpp_field.cc',
191 'src/google/protobuf/compiler/cpp/cpp_field.h',
192 'src/google/protobuf/compiler/cpp/cpp_file.cc',
193 'src/google/protobuf/compiler/cpp/cpp_file.h',
194 'src/google/protobuf/compiler/cpp/cpp_generator.cc',
195 'src/google/protobuf/compiler/cpp/cpp_helpers.cc',
196 'src/google/protobuf/compiler/cpp/cpp_helpers.h',
197 'src/google/protobuf/compiler/cpp/cpp_message.cc',
198 'src/google/protobuf/compiler/cpp/cpp_message.h',
199 'src/google/protobuf/compiler/cpp/cpp_message_field.cc',
200 'src/google/protobuf/compiler/cpp/cpp_message_field.h',
201 'src/google/protobuf/compiler/cpp/cpp_primitive_field.cc',
202 'src/google/protobuf/compiler/cpp/cpp_primitive_field.h',
203 'src/google/protobuf/compiler/cpp/cpp_service.cc',
204 'src/google/protobuf/compiler/cpp/cpp_service.h',
205 'src/google/protobuf/compiler/cpp/cpp_string_field.cc',
206 'src/google/protobuf/compiler/cpp/cpp_string_field.h',
207 'src/google/protobuf/compiler/java/java_enum.cc',
208 'src/google/protobuf/compiler/java/java_enum.h',
209 'src/google/protobuf/compiler/java/java_enum_field.cc',
210 'src/google/protobuf/compiler/java/java_enum_field.h',
211 'src/google/protobuf/compiler/java/java_extension.cc',
212 'src/google/protobuf/compiler/java/java_extension.h',
213 'src/google/protobuf/compiler/java/java_field.cc',
214 'src/google/protobuf/compiler/java/java_field.h',
215 'src/google/protobuf/compiler/java/java_file.cc',
216 'src/google/protobuf/compiler/java/java_file.h',
217 'src/google/protobuf/compiler/java/java_generator.cc',
218 'src/google/protobuf/compiler/java/java_helpers.cc',
219 'src/google/protobuf/compiler/java/java_helpers.h',
220 'src/google/protobuf/compiler/java/java_message.cc',
221 'src/google/protobuf/compiler/java/java_message.h',
222 'src/google/protobuf/compiler/java/java_message_field.cc',
223 'src/google/protobuf/compiler/java/java_message_field.h',
224 'src/google/protobuf/compiler/java/java_primitive_field.cc',
225 'src/google/protobuf/compiler/java/java_primitive_field.h',
226 'src/google/protobuf/compiler/java/java_service.cc',
227 'src/google/protobuf/compiler/java/java_service.h',
228 'src/google/protobuf/compiler/java/java_string_field.cc',
229 'src/google/protobuf/compiler/java/java_string_field.h',
230 'src/google/protobuf/compiler/python/python_generator.cc',
231 'src/google/protobuf/compiler/main.cc',
234 'protobuf_full_do_not_use',
240 }, { # else, OS=="ios" and "<(GENERATOR)"!="ninja"
247 'action_name': 'copy protoc',
249 '<(ninja_product_dir)/protoc',
252 '<(PRODUCT_DIR)/protoc',
256 '<(ninja_product_dir)/protoc',
257 '<(PRODUCT_DIR)/protoc',
265 # Generate the python module needed by all protoc-generated Python code.
266 'target_name': 'py_proto',
270 'destination': '<(PRODUCT_DIR)/pyproto/google/',
272 # google/ module gets an empty __init__.py.
277 'destination': '<(PRODUCT_DIR)/pyproto/google/protobuf',
279 'python/google/protobuf/__init__.py',
280 'python/google/protobuf/descriptor.py',
281 'python/google/protobuf/descriptor_database.py',
282 'python/google/protobuf/descriptor_pool.py',
283 'python/google/protobuf/message.py',
284 'python/google/protobuf/message_factory.py',
285 'python/google/protobuf/reflection.py',
286 'python/google/protobuf/service.py',
287 'python/google/protobuf/service_reflection.py',
288 'python/google/protobuf/text_format.py',
290 # TODO(ncarter): protoc's python generator treats
291 # descriptor.proto specially, but it's not possible to trigger
292 # the special treatment unless you run protoc from ./src/src
293 # (the treatment is based on the path to the .proto file
294 # matching a constant exactly). I'm not sure how to convince
295 # gyp to execute a rule from a different directory. Until this
296 # is resolved, use a copy of descriptor_pb2.py that I manually
302 'destination': '<(PRODUCT_DIR)/pyproto/google/protobuf/internal',
304 'python/google/protobuf/internal/__init__.py',
305 'python/google/protobuf/internal/api_implementation.py',
306 'python/google/protobuf/internal/containers.py',
307 'python/google/protobuf/internal/cpp_message.py',
308 'python/google/protobuf/internal/decoder.py',
309 'python/google/protobuf/internal/encoder.py',
310 'python/google/protobuf/internal/enum_type_wrapper.py',
311 'python/google/protobuf/internal/generator_test.py',
312 'python/google/protobuf/internal/message_listener.py',
313 'python/google/protobuf/internal/python_message.py',
314 'python/google/protobuf/internal/type_checkers.py',
315 'python/google/protobuf/internal/wire_format.py',
319 # # We can't generate a proper descriptor_pb2.py -- see earlier comment.
322 # 'rule_name': 'genproto',
323 # 'extension': 'proto',
325 # '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
328 # # The protoc compiler requires a proto_path argument with the
329 # # directory containing the .proto file.
330 # 'rule_input_relpath': 'src/google/protobuf',
333 # '<(PRODUCT_DIR)/pyproto/google/protobuf/<(RULE_INPUT_ROOT)_pb2.py',
336 # '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
339 # '--python_out=<(PRODUCT_DIR)/pyproto/google/protobuf',
340 # 'google/protobuf/descriptor.proto',
342 # 'message': 'Generating Python code from <(RULE_INPUT_PATH)',
349 # 'src/google/protobuf/descriptor.proto',
353 }, { # use_system_protobuf==1
356 'target_name': 'protobuf_lite',
358 'direct_dependent_settings': {
360 # Use full protobuf, because vanilla protobuf doesn't have
361 # our custom patch to retain unknown fields in lite mode.
362 '<!@(pkg-config --cflags protobuf)',
365 'USE_SYSTEM_PROTOBUF',
367 # This macro must be defined to suppress the use
368 # of dynamic_cast<>, which requires RTTI.
369 'GOOGLE_PROTOBUF_NO_RTTI',
370 'GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER',
374 # Use full protobuf, because vanilla protobuf doesn't have
375 # our custom patch to retain unknown fields in lite mode.
377 '<!@(pkg-config --libs-only-L --libs-only-other protobuf)',
380 '<!@(pkg-config --libs-only-l protobuf)',
385 'target_name': 'protoc',
387 'toolsets': ['host', 'target'],
390 'target_name': 'py_proto',