# Copyright 2015 Google Inc. All Rights Reserved. # # Describes building protobuf_lite, protobuf, and protoc from sources. # This is only used by the build files if protobuf_source is configured to # point here and protobuf_config is set to 'source'. # # Based on the BUILD file in the Protobuf C++ release package. # Source lists accurate as of Protobuf v3.5.1 { # Some sources are used by both protobuf_lite and protobuf. Representing this # with dependencies means that protobuf_lite must be built with both the # target and host toolsets. Although GYP allows for this, this causes bugs in # the generated output for both xcode and ninja. Therefore we include this # variable in the sources of both libraries instead. 'variables': { 'protobuf_common_sources': [ '<(protobuf_source)/src/google/protobuf/arena.cc', '<(protobuf_source)/src/google/protobuf/arenastring.cc', '<(protobuf_source)/src/google/protobuf/extension_set.cc', '<(protobuf_source)/src/google/protobuf/generated_message_table_driven_lite.cc', '<(protobuf_source)/src/google/protobuf/generated_message_util.cc', '<(protobuf_source)/src/google/protobuf/implicit_weak_message.cc', '<(protobuf_source)/src/google/protobuf/io/coded_stream.cc', '<(protobuf_source)/src/google/protobuf/io/zero_copy_stream.cc', '<(protobuf_source)/src/google/protobuf/io/zero_copy_stream_impl_lite.cc', '<(protobuf_source)/src/google/protobuf/message_lite.cc', '<(protobuf_source)/src/google/protobuf/repeated_field.cc', '<(protobuf_source)/src/google/protobuf/stubs/bytestream.cc', '<(protobuf_source)/src/google/protobuf/stubs/common.cc', '<(protobuf_source)/src/google/protobuf/stubs/int128.cc', '<(protobuf_source)/src/google/protobuf/stubs/io_win32.cc', '<(protobuf_source)/src/google/protobuf/stubs/status.cc', '<(protobuf_source)/src/google/protobuf/stubs/statusor.cc', '<(protobuf_source)/src/google/protobuf/stubs/stringpiece.cc', '<(protobuf_source)/src/google/protobuf/stubs/stringprintf.cc', '<(protobuf_source)/src/google/protobuf/stubs/structurally_valid.cc', '<(protobuf_source)/src/google/protobuf/stubs/strutil.cc', '<(protobuf_source)/src/google/protobuf/stubs/time.cc', '<(protobuf_source)/src/google/protobuf/wire_format_lite.cc', ], 'included_cflags': [ # Ignore unknown warning options, to support both gcc & clang at once. '-Wno-unknown-warning-option', # These flags come from Protobuf's BUILD file. '-Wall', '-Wwrite-strings', '-Woverloaded-virtual', '-Wno-sign-compare', '-Wno-unused-function', '-Wno-writable-strings', # These flags silence warnings that appear in protobuf upstream. # We will not maintain a divergent copy of protobuf to fix them. '-Wno-shadow', '-Wno-invalid-offsetof', '-Wno-cast-qual', '-Wno-ignored-qualifiers', ], 'excluded_cflags': [ # In addition to turning these off above, GYP's order-of-operations means # that we need to filter the positive versions as well. '-Wsign-compare', '-Wunused-function', '-Wwritable-strings', '-Wshadow', '-Winvalid-offsetof', '-Wcast-qual', '-Wignored-qualifiers', ], }, 'target_defaults': { 'defines': [ 'GOOGLE_PROTOBUF_NO_RTTI', # These defines come from Protobuf's BUILD file. 'HAVE_PTHREAD', ], 'cflags': ['<@(included_cflags)'], 'cflags!': ['<@(excluded_cflags)'], 'cflags_cc': ['<@(included_cflags)'], 'cflags_cc!': ['<@(excluded_cflags)'], 'msvs_settings': { 'VCCLCompilerTool': { 'DisableSpecificWarnings': [ '4005', # Duplicate #define with WIN32_LEAN_AND_MEAN. '4506', # Missing definition of inline template. ], }, }, }, 'targets': [ { 'target_name': 'protobuf_lite', 'type': 'static_library', 'standalone_static_library': 1, 'toolsets': ['target'], 'sources': [ '<@(protobuf_common_sources)', ], 'include_dirs': [ '<(protobuf_source)', '<(protobuf_source)/src', ], 'direct_dependent_settings': { 'include_dirs': [ '<(protobuf_source)/src', ], # Protobuf's exported headers require that these values match when # compiling Protobuf and when depending on Protobuf. 'defines': [ 'GOOGLE_PROTOBUF_NO_RTTI', ], 'cflags': ['-Wno-unknown-warning-option', '-Wno-shadow'], 'cflags!': ['-Wshadow'], 'cflags_cc': ['-Wno-unknown-warning-option', '-Wno-shadow'], 'cflags_cc!': ['-Wshadow'], }, }, { 'target_name': 'protobuf', 'type': 'static_library', 'toolsets': ['host'], 'includes': ['xcode_host.gypi'], # xcode workaround 'sources': [ '<@(protobuf_common_sources)', '<(protobuf_source)/src/google/protobuf/any.cc', '<(protobuf_source)/src/google/protobuf/any.pb.cc', '<(protobuf_source)/src/google/protobuf/api.pb.cc', '<(protobuf_source)/src/google/protobuf/compiler/importer.cc', '<(protobuf_source)/src/google/protobuf/compiler/parser.cc', '<(protobuf_source)/src/google/protobuf/descriptor.cc', '<(protobuf_source)/src/google/protobuf/descriptor.pb.cc', '<(protobuf_source)/src/google/protobuf/descriptor_database.cc', '<(protobuf_source)/src/google/protobuf/duration.pb.cc', '<(protobuf_source)/src/google/protobuf/dynamic_message.cc', '<(protobuf_source)/src/google/protobuf/empty.pb.cc', '<(protobuf_source)/src/google/protobuf/extension_set_heavy.cc', '<(protobuf_source)/src/google/protobuf/field_mask.pb.cc', '<(protobuf_source)/src/google/protobuf/generated_message_reflection.cc', '<(protobuf_source)/src/google/protobuf/generated_message_table_driven.cc', '<(protobuf_source)/src/google/protobuf/io/gzip_stream.cc', '<(protobuf_source)/src/google/protobuf/io/printer.cc', '<(protobuf_source)/src/google/protobuf/io/strtod.cc', '<(protobuf_source)/src/google/protobuf/io/tokenizer.cc', '<(protobuf_source)/src/google/protobuf/io/zero_copy_stream_impl.cc', '<(protobuf_source)/src/google/protobuf/map_field.cc', '<(protobuf_source)/src/google/protobuf/message.cc', '<(protobuf_source)/src/google/protobuf/reflection_ops.cc', '<(protobuf_source)/src/google/protobuf/service.cc', '<(protobuf_source)/src/google/protobuf/source_context.pb.cc', '<(protobuf_source)/src/google/protobuf/struct.pb.cc', '<(protobuf_source)/src/google/protobuf/stubs/mathlimits.cc', '<(protobuf_source)/src/google/protobuf/stubs/substitute.cc', '<(protobuf_source)/src/google/protobuf/text_format.cc', '<(protobuf_source)/src/google/protobuf/timestamp.pb.cc', '<(protobuf_source)/src/google/protobuf/type.pb.cc', '<(protobuf_source)/src/google/protobuf/unknown_field_set.cc', '<(protobuf_source)/src/google/protobuf/util/delimited_message_util.cc', '<(protobuf_source)/src/google/protobuf/util/field_comparator.cc', '<(protobuf_source)/src/google/protobuf/util/field_mask_util.cc', '<(protobuf_source)/src/google/protobuf/util/internal/datapiece.cc', '<(protobuf_source)/src/google/protobuf/util/internal/default_value_objectwriter.cc', '<(protobuf_source)/src/google/protobuf/util/internal/error_listener.cc', '<(protobuf_source)/src/google/protobuf/util/internal/field_mask_utility.cc', '<(protobuf_source)/src/google/protobuf/util/internal/json_escaping.cc', '<(protobuf_source)/src/google/protobuf/util/internal/json_objectwriter.cc', '<(protobuf_source)/src/google/protobuf/util/internal/json_stream_parser.cc', '<(protobuf_source)/src/google/protobuf/util/internal/object_writer.cc', '<(protobuf_source)/src/google/protobuf/util/internal/proto_writer.cc', '<(protobuf_source)/src/google/protobuf/util/internal/protostream_objectsource.cc', '<(protobuf_source)/src/google/protobuf/util/internal/protostream_objectwriter.cc', '<(protobuf_source)/src/google/protobuf/util/internal/type_info.cc', '<(protobuf_source)/src/google/protobuf/util/internal/type_info_test_helper.cc', '<(protobuf_source)/src/google/protobuf/util/internal/utility.cc', '<(protobuf_source)/src/google/protobuf/util/json_util.cc', '<(protobuf_source)/src/google/protobuf/util/message_differencer.cc', '<(protobuf_source)/src/google/protobuf/util/time_util.cc', '<(protobuf_source)/src/google/protobuf/util/type_resolver_util.cc', '<(protobuf_source)/src/google/protobuf/wire_format.cc', '<(protobuf_source)/src/google/protobuf/wrappers.pb.cc', ], 'include_dirs': [ '<(protobuf_source)', '<(protobuf_source)/src', ], }, { 'target_name': 'protoc', 'type': 'executable', 'toolsets': ['host'], 'includes': ['xcode_host.gypi'], # xcode workaround 'sources': [ '<(protobuf_source)/src/google/protobuf/compiler/code_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/command_line_interface.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_enum.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_enum_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_extension.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_file.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_helpers.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_map_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_message.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_message_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_service.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_string_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_enum.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_enum_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_field_base.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_helpers.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_map_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_message.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_message_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc', '<(protobuf_source)/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_context.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_doc_comment.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_enum.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_enum_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_enum_field_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_enum_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_extension.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_extension_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_file.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_generator_factory.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_helpers.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_lazy_message_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_map_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_map_field_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message_builder.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message_builder_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message_field_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_name_resolver.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_primitive_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_primitive_field_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_service.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_shared_code_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_string_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_string_field_lite.cc', '<(protobuf_source)/src/google/protobuf/compiler/js/js_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/js/well_known_types_embed.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_enum.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_extension.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_file.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_message.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc', '<(protobuf_source)/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/php/php_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/plugin.cc', '<(protobuf_source)/src/google/protobuf/compiler/plugin.pb.cc', '<(protobuf_source)/src/google/protobuf/compiler/python/python_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/ruby/ruby_generator.cc', '<(protobuf_source)/src/google/protobuf/compiler/subprocess.cc', '<(protobuf_source)/src/google/protobuf/compiler/zip_writer.cc', '<(protobuf_source)/src/google/protobuf/compiler/main.cc', ], 'include_dirs': [ '<(protobuf_source)', '<(protobuf_source)/src', ], 'dependencies': [ 'protobuf', ], 'conditions': [ ['OS!="win"', { 'libraries': [ '-lpthread', '-lm', ], }], ], }, ], }