cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / third_party / protobuf / protobuf.gyp
blob44bcdd6eee1cf9703eab81fee88a44b8613abb1a
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.
6   'conditions': [
7     ['use_system_protobuf==0', {
8       'conditions': [
9         ['OS!="win"', {
10           'variables': {
11             'config_h_dir':
12               '.',  # crafted for gcc/linux.
13           },
14         }, {  # else, OS=="win"
15           'variables': {
16             'config_h_dir':
17               'vsprojects',  # crafted for msvc.
18           },
19           'target_defaults': {
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
26             ],
27             'defines!': [
28               'WIN32_LEAN_AND_MEAN',  # Protobuf defines this itself.
29             ],
30           },
31         }],
32         ['OS=="ios" and "<(GENERATOR)"!="ninja"', {
33           'variables': {
34             'ninja_output_dir': 'ninja-protoc',
35             'ninja_product_dir':
36               '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)',
37             # Gyp to rerun
38             're_run_targets': [
39               'third_party/protobuf/protobuf.gyp',
40             ],
41           },
42           'targets': [
43             {
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',
55               'type': 'none',
56               'includes': ['../../build/ios/mac_build.gypi'],
57               'actions': [
58                 {
59                   'action_name': 'compile protoc',
60                   'inputs': [],
61                   'outputs': [],
62                   'action': [
63                     '<@(ninja_cmd)',
64                     'protoc',
65                   ],
66                   'message': 'Generating the C++ protocol buffers compiler',
67                 },
68               ],
69             },
70           ],
71         }],
72         ['OS=="android"', {
73           'targets': [
74             {
75               'target_name': 'protobuf_lite_javalib',
76               'type' : 'none',
77               'dependencies': [
78                 'protoc#host',
79               ],
80               'variables': {
81                 'script_descriptors': './protobuf_lite_java_descriptor_proto.py',
82                 'script_pom': './protobuf_lite_java_parse_pom.py',
83                 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
84                 # Variables needed by java.gypi below.
85                 'java_out_dir': '<(PRODUCT_DIR)/java_proto/protobuf_lite_java_descriptor_proto',
86                 'generated_src_dirs': ['<(java_out_dir)'],
87                 'java_in_dir': 'java',
88                 'maven_pom': '<(java_in_dir)/pom.xml',
89                 'javac_includes': ['<!@(<(script_pom) <(maven_pom))'],
90                 'additional_input_paths': [
91                   '<(java_out_dir)/com/google/protobuf/DescriptorProtos.java'
92                 ],
93               },
94               'actions': [
95                 {
96                   'action_name': 'protobuf_lite_java_gen_descriptor_proto',
97                   'inputs': [
98                     '<(script_descriptors)',
99                     '<(protoc)',
100                     'src/google/protobuf/descriptor.proto',
101                   ],
102                   'outputs': [
103                     '<(java_out_dir)/com/google/protobuf/DescriptorProtos.java',
104                   ],
105                   'action': [
106                     '<(script_descriptors)',
107                     '<(protoc)',
108                     '<(java_out_dir)',
109                     'src',
110                     'src/google/protobuf/descriptor.proto',
111                   ],
112                   'message': 'Generating descriptor protos for Java',
113                 },
114               ],
115               # Now that we have generated DescriptorProtos.java, build jar.
116               'includes': ['../../build/java.gypi'],
117             },
118           ]
119         }],
120       ],
121       'targets': [
122         # The "lite" lib is about 1/7th the size of the heavy lib,
123         # but it doesn't support some of the more exotic features of
124         # protobufs, like reflection.  To generate C++ code that can link
125         # against the lite version of the library, add the option line:
126         #
127         #   option optimize_for = LITE_RUNTIME;
128         #
129         # to your .proto file.
130         {
131           'target_name': 'protobuf_lite',
132           'type': '<(component)',
133           'toolsets': ['host', 'target'],
134           'includes': [
135             'protobuf_lite.gypi',
136           ],
137           # Required for component builds. See http://crbug.com/172800.
138           'defines': [
139             'LIBPROTOBUF_EXPORTS',
140             'PROTOBUF_USE_DLLS',
141           ],
142           'direct_dependent_settings': {
143             'defines': [
144               'PROTOBUF_USE_DLLS',
145             ],
146           },
147         },
148         # This is the full, heavy protobuf lib that's needed for c++ .protos
149         # that don't specify the LITE_RUNTIME option.  The protocol
150         # compiler itself (protoc) falls into that category.
151         #
152         # DO NOT LINK AGAINST THIS TARGET IN CHROME CODE  --agl
153         {
154           'target_name': 'protobuf_full_do_not_use',
155           'type': 'static_library',
156           'toolsets': ['host','target'],
157           'includes': [
158             'protobuf_lite.gypi',
159           ],
160           'sources': [
161             'src/google/protobuf/descriptor.h',
162             'src/google/protobuf/descriptor.pb.h',
163             'src/google/protobuf/descriptor_database.h',
164             'src/google/protobuf/dynamic_message.h',
165             'src/google/protobuf/generated_enum_reflection.h',
166             'src/google/protobuf/generated_message_reflection.h',
167             'src/google/protobuf/message.h',
168             'src/google/protobuf/reflection_ops.h',
169             'src/google/protobuf/service.h',
170             'src/google/protobuf/text_format.h',
171             'src/google/protobuf/wire_format.h',
172             'src/google/protobuf/io/gzip_stream.h',
173             'src/google/protobuf/io/printer.h',
174             'src/google/protobuf/io/tokenizer.h',
175             'src/google/protobuf/io/zero_copy_stream_impl.h',
176             'src/google/protobuf/compiler/code_generator.h',
177             'src/google/protobuf/compiler/command_line_interface.h',
178             'src/google/protobuf/compiler/importer.h',
179             'src/google/protobuf/compiler/java/java_doc_comment.cc',
180             'src/google/protobuf/compiler/java/java_doc_comment.h',
181             'src/google/protobuf/compiler/parser.h',
183             'src/google/protobuf/stubs/strutil.cc',
184             'src/google/protobuf/stubs/strutil.h',
185             'src/google/protobuf/stubs/substitute.cc',
186             'src/google/protobuf/stubs/substitute.h',
187             'src/google/protobuf/stubs/stl_util.h',
188             'src/google/protobuf/stubs/stringprintf.cc',
189             'src/google/protobuf/stubs/stringprintf.h',
190             'src/google/protobuf/stubs/structurally_valid.cc',
191             'src/google/protobuf/stubs/template_util.h',
192             'src/google/protobuf/stubs/type_traits.h',
194             'src/google/protobuf/descriptor.cc',
195             'src/google/protobuf/descriptor.pb.cc',
196             'src/google/protobuf/descriptor_database.cc',
197             'src/google/protobuf/dynamic_message.cc',
198             'src/google/protobuf/extension_set.cc',
199             'src/google/protobuf/extension_set.h',
200             'src/google/protobuf/extension_set_heavy.cc',
201             'src/google/protobuf/generated_message_reflection.cc',
202             'src/google/protobuf/message.cc',
203             'src/google/protobuf/reflection_ops.cc',
204             'src/google/protobuf/service.cc',
205             'src/google/protobuf/text_format.cc',
206             'src/google/protobuf/wire_format.cc',
207             # This file pulls in zlib, but it's not actually used by protoc, so
208             # instead of compiling zlib for the host, let's just exclude this.
209             # 'src/src/google/protobuf/io/gzip_stream.cc',
210             'src/google/protobuf/io/printer.cc',
211             'src/google/protobuf/io/tokenizer.cc',
212             'src/google/protobuf/io/zero_copy_stream_impl.cc',
213             'src/google/protobuf/compiler/importer.cc',
214             'src/google/protobuf/compiler/parser.cc',
215           ],
216         },
217         {
218           'target_name': 'protoc',
219           'conditions': [
220             ['OS!="ios" or "<(GENERATOR)"=="ninja"', {
221               'type': 'executable',
222               'toolsets': ['host'],
223               'sources': [
224                 'src/google/protobuf/compiler/code_generator.cc',
225                 'src/google/protobuf/compiler/command_line_interface.cc',
226                 'src/google/protobuf/compiler/plugin.cc',
227                 'src/google/protobuf/compiler/plugin.pb.cc',
228                 'src/google/protobuf/compiler/subprocess.cc',
229                 'src/google/protobuf/compiler/subprocess.h',
230                 'src/google/protobuf/compiler/zip_writer.cc',
231                 'src/google/protobuf/compiler/zip_writer.h',
232                 'src/google/protobuf/compiler/cpp/cpp_enum.cc',
233                 'src/google/protobuf/compiler/cpp/cpp_enum.h',
234                 'src/google/protobuf/compiler/cpp/cpp_enum_field.cc',
235                 'src/google/protobuf/compiler/cpp/cpp_enum_field.h',
236                 'src/google/protobuf/compiler/cpp/cpp_extension.cc',
237                 'src/google/protobuf/compiler/cpp/cpp_extension.h',
238                 'src/google/protobuf/compiler/cpp/cpp_field.cc',
239                 'src/google/protobuf/compiler/cpp/cpp_field.h',
240                 'src/google/protobuf/compiler/cpp/cpp_file.cc',
241                 'src/google/protobuf/compiler/cpp/cpp_file.h',
242                 'src/google/protobuf/compiler/cpp/cpp_generator.cc',
243                 'src/google/protobuf/compiler/cpp/cpp_helpers.cc',
244                 'src/google/protobuf/compiler/cpp/cpp_helpers.h',
245                 'src/google/protobuf/compiler/cpp/cpp_message.cc',
246                 'src/google/protobuf/compiler/cpp/cpp_message.h',
247                 'src/google/protobuf/compiler/cpp/cpp_message_field.cc',
248                 'src/google/protobuf/compiler/cpp/cpp_message_field.h',
249                 'src/google/protobuf/compiler/cpp/cpp_primitive_field.cc',
250                 'src/google/protobuf/compiler/cpp/cpp_primitive_field.h',
251                 'src/google/protobuf/compiler/cpp/cpp_service.cc',
252                 'src/google/protobuf/compiler/cpp/cpp_service.h',
253                 'src/google/protobuf/compiler/cpp/cpp_string_field.cc',
254                 'src/google/protobuf/compiler/cpp/cpp_string_field.h',
255                 'src/google/protobuf/compiler/java/java_enum.cc',
256                 'src/google/protobuf/compiler/java/java_enum.h',
257                 'src/google/protobuf/compiler/java/java_enum_field.cc',
258                 'src/google/protobuf/compiler/java/java_enum_field.h',
259                 'src/google/protobuf/compiler/java/java_extension.cc',
260                 'src/google/protobuf/compiler/java/java_extension.h',
261                 'src/google/protobuf/compiler/java/java_field.cc',
262                 'src/google/protobuf/compiler/java/java_field.h',
263                 'src/google/protobuf/compiler/java/java_file.cc',
264                 'src/google/protobuf/compiler/java/java_file.h',
265                 'src/google/protobuf/compiler/java/java_generator.cc',
266                 'src/google/protobuf/compiler/java/java_helpers.cc',
267                 'src/google/protobuf/compiler/java/java_helpers.h',
268                 'src/google/protobuf/compiler/java/java_message.cc',
269                 'src/google/protobuf/compiler/java/java_message.h',
270                 'src/google/protobuf/compiler/java/java_message_field.cc',
271                 'src/google/protobuf/compiler/java/java_message_field.h',
272                 'src/google/protobuf/compiler/java/java_primitive_field.cc',
273                 'src/google/protobuf/compiler/java/java_primitive_field.h',
274                 'src/google/protobuf/compiler/java/java_service.cc',
275                 'src/google/protobuf/compiler/java/java_service.h',
276                 'src/google/protobuf/compiler/java/java_string_field.cc',
277                 'src/google/protobuf/compiler/java/java_string_field.h',
278                 'src/google/protobuf/compiler/python/python_generator.cc',
279                 'src/google/protobuf/compiler/main.cc',
280               ],
281               'dependencies': [
282                 'protobuf_full_do_not_use',
283               ],
284               'include_dirs': [
285                 '<(config_h_dir)',
286                 'src/src',
287               ],
288             }, {  # else, OS=="ios" and "<(GENERATOR)"!="ninja"
289               'type': 'none',
290               'dependencies': [
291                 'compile_protoc',
292               ],
293               'actions': [
294                 {
295                   'action_name': 'copy protoc',
296                   'inputs': [
297                     '<(ninja_product_dir)/protoc',
298                   ],
299                   'outputs': [
300                     '<(PRODUCT_DIR)/protoc',
301                   ],
302                   'action': [
303                     'cp',
304                     '<(ninja_product_dir)/protoc',
305                     '<(PRODUCT_DIR)/protoc',
306                   ],
307                 },
308               ],
309             }],
310           ],
311         },
312         {
313           # Generate the python module needed by all protoc-generated Python code.
314           'target_name': 'py_proto',
315           'type': 'none',
316           'copies': [
317             {
318               'destination': '<(PRODUCT_DIR)/pyproto/google/',
319               'files': [
320                 # google/ module gets an empty __init__.py.
321                 '__init__.py',
322               ],
323             },
324             {
325               'destination': '<(PRODUCT_DIR)/pyproto/google/protobuf',
326               'files': [
327                 'python/google/protobuf/__init__.py',
328                 'python/google/protobuf/descriptor.py',
329                 'python/google/protobuf/descriptor_database.py',
330                 'python/google/protobuf/descriptor_pool.py',
331                 'python/google/protobuf/message.py',
332                 'python/google/protobuf/message_factory.py',
333                 'python/google/protobuf/reflection.py',
334                 'python/google/protobuf/service.py',
335                 'python/google/protobuf/service_reflection.py',
336                 'python/google/protobuf/text_format.py',
338                 # TODO(ncarter): protoc's python generator treats
339                 # descriptor.proto specially, but it's not possible to trigger
340                 # the special treatment unless you run protoc from ./src/src
341                 # (the treatment is based on the path to the .proto file
342                 # matching a constant exactly). I'm not sure how to convince
343                 # gyp to execute a rule from a different directory.  Until this
344                 # is resolved, use a copy of descriptor_pb2.py that I manually
345                 # generated.
346                 'descriptor_pb2.py',
347               ],
348             },
349             {
350               'destination': '<(PRODUCT_DIR)/pyproto/google/protobuf/internal',
351               'files': [
352                 'python/google/protobuf/internal/__init__.py',
353                 'python/google/protobuf/internal/api_implementation.py',
354                 'python/google/protobuf/internal/containers.py',
355                 'python/google/protobuf/internal/cpp_message.py',
356                 'python/google/protobuf/internal/decoder.py',
357                 'python/google/protobuf/internal/encoder.py',
358                 'python/google/protobuf/internal/enum_type_wrapper.py',
359                 'python/google/protobuf/internal/generator_test.py',
360                 'python/google/protobuf/internal/message_listener.py',
361                 'python/google/protobuf/internal/python_message.py',
362                 'python/google/protobuf/internal/type_checkers.py',
363                 'python/google/protobuf/internal/wire_format.py',
364               ],
365             },
366           ],
367       #   # We can't generate a proper descriptor_pb2.py -- see earlier comment.
368       #   'rules': [
369       #     {
370       #       'rule_name': 'genproto',
371       #       'extension': 'proto',
372       #       'inputs': [
373       #         '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
374       #       ],
375       #       'variables': {
376       #         # The protoc compiler requires a proto_path argument with the
377       #           # directory containing the .proto file.
378       #           'rule_input_relpath': 'src/google/protobuf',
379       #         },
380       #         'outputs': [
381       #           '<(PRODUCT_DIR)/pyproto/google/protobuf/<(RULE_INPUT_ROOT)_pb2.py',
382       #         ],
383       #         'action': [
384       #           '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
385       #           '-I./src',
386       #           '-I.',
387       #           '--python_out=<(PRODUCT_DIR)/pyproto/google/protobuf',
388       #           'google/protobuf/descriptor.proto',
389       #         ],
390       #         'message': 'Generating Python code from <(RULE_INPUT_PATH)',
391       #       },
392       #     ],
393       #     'dependencies': [
394       #       'protoc#host',
395       #     ],
396       #     'sources': [
397       #       'src/google/protobuf/descriptor.proto',
398       #     ],
399          },
400       ],
401     }, { # use_system_protobuf==1
402       'targets': [
403         {
404           'target_name': 'protobuf_lite',
405           'type': 'none',
406           'direct_dependent_settings': {
407             'cflags': [
408               # Use full protobuf, because vanilla protobuf doesn't have
409               # our custom patch to retain unknown fields in lite mode.
410               '<!@(pkg-config --cflags protobuf)',
411             ],
412             'defines': [
413               'USE_SYSTEM_PROTOBUF',
415               # This macro must be defined to suppress the use
416               # of dynamic_cast<>, which requires RTTI.
417               'GOOGLE_PROTOBUF_NO_RTTI',
418               'GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER',
419             ],
420           },
421           'link_settings': {
422             # Use full protobuf, because vanilla protobuf doesn't have
423             # our custom patch to retain unknown fields in lite mode.
424             'ldflags': [
425               '<!@(pkg-config --libs-only-L --libs-only-other protobuf)',
426             ],
427             'libraries': [
428               '<!@(pkg-config --libs-only-l protobuf)',
429             ],
430           },
431         },
432         {
433           'target_name': 'protoc',
434           'type': 'none',
435           'toolsets': ['host', 'target'],
436         },
437         {
438           'target_name': 'py_proto',
439           'type': 'none',
440         },
441       ],
442     }],
443   ],