# 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 v21.12 (aka 3.21.12) { # 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/src/google/protobuf/any_lite.cc', 'protobuf/src/google/protobuf/arena.cc', 'protobuf/src/google/protobuf/arenastring.cc', 'protobuf/src/google/protobuf/arenaz_sampler.cc', 'protobuf/src/google/protobuf/extension_set.cc', 'protobuf/src/google/protobuf/generated_enum_util.cc', 'protobuf/src/google/protobuf/generated_message_tctable_lite.cc', 'protobuf/src/google/protobuf/generated_message_util.cc', 'protobuf/src/google/protobuf/implicit_weak_message.cc', 'protobuf/src/google/protobuf/inlined_string_field.cc', 'protobuf/src/google/protobuf/io/coded_stream.cc', 'protobuf/src/google/protobuf/io/io_win32.cc', 'protobuf/src/google/protobuf/io/strtod.cc', 'protobuf/src/google/protobuf/io/zero_copy_stream.cc', 'protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc', 'protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc', 'protobuf/src/google/protobuf/map.cc', 'protobuf/src/google/protobuf/message_lite.cc', 'protobuf/src/google/protobuf/parse_context.cc', 'protobuf/src/google/protobuf/repeated_field.cc', 'protobuf/src/google/protobuf/repeated_ptr_field.cc', 'protobuf/src/google/protobuf/stubs/bytestream.cc', 'protobuf/src/google/protobuf/stubs/common.cc', 'protobuf/src/google/protobuf/stubs/int128.cc', 'protobuf/src/google/protobuf/stubs/status.cc', 'protobuf/src/google/protobuf/stubs/statusor.cc', 'protobuf/src/google/protobuf/stubs/stringpiece.cc', 'protobuf/src/google/protobuf/stubs/stringprintf.cc', 'protobuf/src/google/protobuf/stubs/structurally_valid.cc', 'protobuf/src/google/protobuf/stubs/strutil.cc', 'protobuf/src/google/protobuf/stubs/time.cc', 'protobuf/src/google/protobuf/wire_format_lite.cc', ], }, 'target_defaults': { 'defines': [ 'GOOGLE_PROTOBUF_NO_RTTI', # These defines come from Protobuf's BUILD file. 'HAVE_PTHREAD', ], }, 'targets': [ { 'target_name': 'protobuf_lite', 'toolsets': ['target' ], 'type': 'static_library', 'standalone_static_library': 1, 'hard_dependency': 1, 'toolsets': ['target'], 'sources': [ '<@(protobuf_common_sources)', ], 'include_dirs': [ 'protobuf', 'protobuf/src', ], 'includes': ['disable_warnings.gypi'], 'xcode_settings': { 'OTHER_CFLAGS': ['-w'], 'USE_HEADERMAP': 'NO', }, 'msvs_settings': { 'VCCLCompilerTool': { # Disable warnings for third-party code. 'WarningLevel': '0', }, }, 'direct_dependent_settings': { 'include_dirs': [ 'protobuf/src', ], # Protobuf's exported headers require that these values match when # compiling Protobuf and when depending on Protobuf. 'defines': [ 'GOOGLE_PROTOBUF_NO_RTTI', ], }, }, { 'target_name': 'protobuf', 'type': 'static_library', 'toolsets': ['host'], 'sources': [ '<@(protobuf_common_sources)', 'protobuf/src/google/protobuf/any.cc', 'protobuf/src/google/protobuf/any.pb.cc', 'protobuf/src/google/protobuf/api.pb.cc', 'protobuf/src/google/protobuf/compiler/importer.cc', 'protobuf/src/google/protobuf/compiler/parser.cc', 'protobuf/src/google/protobuf/descriptor.cc', 'protobuf/src/google/protobuf/descriptor.pb.cc', 'protobuf/src/google/protobuf/descriptor_database.cc', 'protobuf/src/google/protobuf/duration.pb.cc', 'protobuf/src/google/protobuf/dynamic_message.cc', 'protobuf/src/google/protobuf/empty.pb.cc', 'protobuf/src/google/protobuf/extension_set_heavy.cc', 'protobuf/src/google/protobuf/field_mask.pb.cc', 'protobuf/src/google/protobuf/generated_message_bases.cc', 'protobuf/src/google/protobuf/generated_message_reflection.cc', 'protobuf/src/google/protobuf/generated_message_tctable_full.cc', 'protobuf/src/google/protobuf/io/gzip_stream.cc', 'protobuf/src/google/protobuf/io/printer.cc', 'protobuf/src/google/protobuf/io/tokenizer.cc', 'protobuf/src/google/protobuf/map_field.cc', 'protobuf/src/google/protobuf/message.cc', 'protobuf/src/google/protobuf/reflection_ops.cc', 'protobuf/src/google/protobuf/service.cc', 'protobuf/src/google/protobuf/source_context.pb.cc', 'protobuf/src/google/protobuf/struct.pb.cc', 'protobuf/src/google/protobuf/stubs/substitute.cc', 'protobuf/src/google/protobuf/text_format.cc', 'protobuf/src/google/protobuf/timestamp.pb.cc', 'protobuf/src/google/protobuf/type.pb.cc', 'protobuf/src/google/protobuf/unknown_field_set.cc', 'protobuf/src/google/protobuf/util/delimited_message_util.cc', 'protobuf/src/google/protobuf/util/field_comparator.cc', 'protobuf/src/google/protobuf/util/field_mask_util.cc', 'protobuf/src/google/protobuf/util/internal/datapiece.cc', 'protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc', 'protobuf/src/google/protobuf/util/internal/error_listener.cc', 'protobuf/src/google/protobuf/util/internal/field_mask_utility.cc', 'protobuf/src/google/protobuf/util/internal/json_escaping.cc', 'protobuf/src/google/protobuf/util/internal/json_objectwriter.cc', 'protobuf/src/google/protobuf/util/internal/json_stream_parser.cc', 'protobuf/src/google/protobuf/util/internal/object_writer.cc', 'protobuf/src/google/protobuf/util/internal/proto_writer.cc', 'protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc', 'protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc', 'protobuf/src/google/protobuf/util/internal/type_info.cc', 'protobuf/src/google/protobuf/util/internal/utility.cc', 'protobuf/src/google/protobuf/util/json_util.cc', 'protobuf/src/google/protobuf/util/message_differencer.cc', 'protobuf/src/google/protobuf/util/time_util.cc', 'protobuf/src/google/protobuf/util/type_resolver_util.cc', 'protobuf/src/google/protobuf/wire_format.cc', 'protobuf/src/google/protobuf/wrappers.pb.cc', ], 'include_dirs': [ 'protobuf', 'protobuf/src', ], 'includes': [ 'disable_warnings.gypi', 'xcode_host.gypi', # XCode workaround ], 'xcode_settings': { 'OTHER_CFLAGS': ['-w'], 'USE_HEADERMAP': 'NO', }, 'msvs_settings': { 'VCCLCompilerTool': { # Disable warnings for third-party code. 'WarningLevel': '0', }, }, }, { 'target_name': 'protoc', 'type': 'executable', 'toolsets': ['host'], 'sources': [ 'protobuf/src/google/protobuf/compiler/code_generator.cc', 'protobuf/src/google/protobuf/compiler/command_line_interface.cc', 'protobuf/src/google/protobuf/compiler/cpp/enum.cc', 'protobuf/src/google/protobuf/compiler/cpp/enum_field.cc', 'protobuf/src/google/protobuf/compiler/cpp/extension.cc', 'protobuf/src/google/protobuf/compiler/cpp/field.cc', 'protobuf/src/google/protobuf/compiler/cpp/file.cc', 'protobuf/src/google/protobuf/compiler/cpp/generator.cc', 'protobuf/src/google/protobuf/compiler/cpp/helpers.cc', 'protobuf/src/google/protobuf/compiler/cpp/map_field.cc', 'protobuf/src/google/protobuf/compiler/cpp/message.cc', 'protobuf/src/google/protobuf/compiler/cpp/message_field.cc', 'protobuf/src/google/protobuf/compiler/cpp/padding_optimizer.cc', 'protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc', 'protobuf/src/google/protobuf/compiler/cpp/primitive_field.cc', 'protobuf/src/google/protobuf/compiler/cpp/service.cc', 'protobuf/src/google/protobuf/compiler/cpp/string_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'protobuf/src/google/protobuf/compiler/java/context.cc', 'protobuf/src/google/protobuf/compiler/java/doc_comment.cc', 'protobuf/src/google/protobuf/compiler/java/enum.cc', 'protobuf/src/google/protobuf/compiler/java/enum_field.cc', 'protobuf/src/google/protobuf/compiler/java/enum_field_lite.cc', 'protobuf/src/google/protobuf/compiler/java/enum_lite.cc', 'protobuf/src/google/protobuf/compiler/java/extension.cc', 'protobuf/src/google/protobuf/compiler/java/extension_lite.cc', 'protobuf/src/google/protobuf/compiler/java/field.cc', 'protobuf/src/google/protobuf/compiler/java/file.cc', 'protobuf/src/google/protobuf/compiler/java/generator.cc', 'protobuf/src/google/protobuf/compiler/java/generator_factory.cc', 'protobuf/src/google/protobuf/compiler/java/helpers.cc', 'protobuf/src/google/protobuf/compiler/java/kotlin_generator.cc', 'protobuf/src/google/protobuf/compiler/java/map_field.cc', 'protobuf/src/google/protobuf/compiler/java/map_field_lite.cc', 'protobuf/src/google/protobuf/compiler/java/message.cc', 'protobuf/src/google/protobuf/compiler/java/message_builder.cc', 'protobuf/src/google/protobuf/compiler/java/message_builder_lite.cc', 'protobuf/src/google/protobuf/compiler/java/message_field.cc', 'protobuf/src/google/protobuf/compiler/java/message_field_lite.cc', 'protobuf/src/google/protobuf/compiler/java/message_lite.cc', 'protobuf/src/google/protobuf/compiler/java/name_resolver.cc', 'protobuf/src/google/protobuf/compiler/java/primitive_field.cc', 'protobuf/src/google/protobuf/compiler/java/primitive_field_lite.cc', 'protobuf/src/google/protobuf/compiler/java/service.cc', 'protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc', 'protobuf/src/google/protobuf/compiler/java/string_field.cc', 'protobuf/src/google/protobuf/compiler/java/string_field_lite.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'protobuf/src/google/protobuf/compiler/php/php_generator.cc', 'protobuf/src/google/protobuf/compiler/plugin.cc', 'protobuf/src/google/protobuf/compiler/plugin.pb.cc', 'protobuf/src/google/protobuf/compiler/python/generator.cc', 'protobuf/src/google/protobuf/compiler/python/helpers.cc', 'protobuf/src/google/protobuf/compiler/python/pyi_generator.cc', 'protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc', 'protobuf/src/google/protobuf/compiler/subprocess.cc', 'protobuf/src/google/protobuf/compiler/zip_writer.cc', 'protobuf/src/google/protobuf/compiler/main.cc', ], 'include_dirs': [ 'protobuf', 'protobuf/src', ], 'dependencies': [ ':protobuf', ], 'includes': [ 'disable_warnings.gypi', 'xcode_host.gypi', # XCode workaround ], 'xcode_settings': { 'OTHER_CFLAGS': ['-w'], 'PRODUCT_BUNDLE_IDENTIFIER': 'com.google.protoc', 'PROVISIONING_PROFILE_SPECIFIER': '', 'USE_HEADERMAP': 'NO', }, 'msvs_settings': { 'VCCLCompilerTool': { # Disable warnings for third-party code. 'WarningLevel': '0', }, }, 'conditions': [ ['OS!="win"', { 'libraries': [ '-lpthread', '-lm', ], }], ], }, ], }