# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # NOTE: this BUILD.gn is based heavily on Chrome's, however it does require # modification to work properly. When updating, try doing a diff with the # new version of the Chrome BUILD.gn if you see build errors. import("//build_overrides/build.gni") config("protobuf_config") { include_dirs = [ "src/src" ] defines = [ "GOOGLE_PROTOBUF_NO_RTTI", "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", "HAVE_PTHREAD", ] } config("protobuf_warnings") { cflags_cc = [ "-Wno-sign-compare", "-Wno-deprecated-declarations", "-Wno-unused-function", ] if (is_clang) { cflags_cc += [ "-Wno-exit-time-destructors", "-Wno-extra-semi", "-Wno-unneeded-internal-declaration", "-Wno-unused-private-field", ] } if (is_gcc) { cflags_cc += [ "-Wno-stringop-overflow", "-Wno-array-bounds", ] } } # This config should be applied to targets using generated code from the proto # compiler. It sets up the include directories properly. config("using_proto") { include_dirs = [ "src/src", "$root_gen_dir", ] } config("allow_deprecated_proto_fields") { if (is_clang) { cflags = [ "-Wno-deprecated-declarations" ] } } lite_sources = [ "src/src/google/protobuf/any_lite.cc", "src/src/google/protobuf/arena.cc", "src/src/google/protobuf/arena.h", "src/src/google/protobuf/arena_impl.h", "src/src/google/protobuf/arenastring.cc", "src/src/google/protobuf/arenastring.h", "src/src/google/protobuf/extension_set.cc", "src/src/google/protobuf/extension_set.h", "src/src/google/protobuf/generated_enum_util.cc", "src/src/google/protobuf/generated_enum_util.h", "src/src/google/protobuf/generated_message_table_driven_lite.cc", "src/src/google/protobuf/generated_message_table_driven_lite.h", "src/src/google/protobuf/generated_message_util.cc", "src/src/google/protobuf/generated_message_util.h", "src/src/google/protobuf/has_bits.h", "src/src/google/protobuf/implicit_weak_message.cc", "src/src/google/protobuf/implicit_weak_message.h", "src/src/google/protobuf/inlined_string_field.h", "src/src/google/protobuf/io/coded_stream.cc", "src/src/google/protobuf/io/coded_stream.h", "src/src/google/protobuf/io/io_win32.cc", "src/src/google/protobuf/io/io_win32.h", "src/src/google/protobuf/io/strtod.cc", "src/src/google/protobuf/io/strtod.h", "src/src/google/protobuf/io/zero_copy_stream.cc", "src/src/google/protobuf/io/zero_copy_stream.h", "src/src/google/protobuf/io/zero_copy_stream_impl.cc", "src/src/google/protobuf/io/zero_copy_stream_impl.h", "src/src/google/protobuf/io/zero_copy_stream_impl_lite.cc", "src/src/google/protobuf/io/zero_copy_stream_impl_lite.h", "src/src/google/protobuf/map.cc", "src/src/google/protobuf/map.h", "src/src/google/protobuf/map_entry_lite.h", "src/src/google/protobuf/map_field_lite.h", "src/src/google/protobuf/map_type_handler.h", "src/src/google/protobuf/message_lite.cc", "src/src/google/protobuf/message_lite.h", "src/src/google/protobuf/parse_context.cc", "src/src/google/protobuf/parse_context.h", "src/src/google/protobuf/repeated_field.cc", "src/src/google/protobuf/repeated_field.h", "src/src/google/protobuf/stubs/bytestream.cc", "src/src/google/protobuf/stubs/bytestream.h", "src/src/google/protobuf/stubs/callback.h", "src/src/google/protobuf/stubs/casts.h", "src/src/google/protobuf/stubs/common.cc", "src/src/google/protobuf/stubs/common.h", "src/src/google/protobuf/stubs/fastmem.h", "src/src/google/protobuf/stubs/hash.h", "src/src/google/protobuf/stubs/int128.cc", "src/src/google/protobuf/stubs/int128.h", "src/src/google/protobuf/stubs/logging.h", "src/src/google/protobuf/stubs/macros.h", "src/src/google/protobuf/stubs/map_util.h", "src/src/google/protobuf/stubs/mutex.h", "src/src/google/protobuf/stubs/once.h", "src/src/google/protobuf/stubs/platform_macros.h", "src/src/google/protobuf/stubs/port.h", "src/src/google/protobuf/stubs/status.cc", "src/src/google/protobuf/stubs/status.h", "src/src/google/protobuf/stubs/status_macros.h", "src/src/google/protobuf/stubs/statusor.cc", "src/src/google/protobuf/stubs/statusor.h", "src/src/google/protobuf/stubs/stl_util.h", "src/src/google/protobuf/stubs/stringpiece.cc", "src/src/google/protobuf/stubs/stringpiece.h", "src/src/google/protobuf/stubs/stringprintf.cc", "src/src/google/protobuf/stubs/stringprintf.h", "src/src/google/protobuf/stubs/structurally_valid.cc", "src/src/google/protobuf/stubs/strutil.cc", "src/src/google/protobuf/stubs/strutil.h", "src/src/google/protobuf/stubs/template_util.h", "src/src/google/protobuf/stubs/time.cc", "src/src/google/protobuf/stubs/time.h", "src/src/google/protobuf/wire_format_lite.cc", "src/src/google/protobuf/wire_format_lite.h", ] source_set("protobuf_lite") { sources = lite_sources configs += [ ":protobuf_warnings" ] public_configs = [ ":protobuf_config" ] } # This is the full, heavy protobuf lib that's needed for c++ .protos that don't # specify the LITE_RUNTIME option. The protocol compiler itself (protoc) falls # into that category. Do not use in Chrome code. static_library("protobuf_full") { sources = lite_sources + [ "src/src/google/protobuf/any.cc", "src/src/google/protobuf/any.h", "src/src/google/protobuf/any.pb.cc", "src/src/google/protobuf/any.pb.h", "src/src/google/protobuf/api.pb.cc", "src/src/google/protobuf/api.pb.h", "src/src/google/protobuf/compiler/importer.cc", "src/src/google/protobuf/compiler/importer.h", "src/src/google/protobuf/compiler/parser.cc", "src/src/google/protobuf/compiler/parser.h", "src/src/google/protobuf/descriptor.cc", "src/src/google/protobuf/descriptor.h", "src/src/google/protobuf/descriptor.pb.cc", "src/src/google/protobuf/descriptor.pb.h", "src/src/google/protobuf/descriptor_database.cc", "src/src/google/protobuf/descriptor_database.h", "src/src/google/protobuf/duration.pb.cc", "src/src/google/protobuf/duration.pb.h", "src/src/google/protobuf/dynamic_message.cc", "src/src/google/protobuf/dynamic_message.h", "src/src/google/protobuf/empty.pb.cc", "src/src/google/protobuf/empty.pb.h", "src/src/google/protobuf/extension_set_heavy.cc", "src/src/google/protobuf/field_mask.pb.cc", "src/src/google/protobuf/field_mask.pb.h", "src/src/google/protobuf/generated_enum_reflection.h", "src/src/google/protobuf/generated_message_reflection.cc", "src/src/google/protobuf/generated_message_reflection.h", "src/src/google/protobuf/io/gzip_stream.cc", "src/src/google/protobuf/io/gzip_stream.h", "src/src/google/protobuf/io/printer.cc", "src/src/google/protobuf/io/printer.h", "src/src/google/protobuf/io/tokenizer.cc", "src/src/google/protobuf/io/tokenizer.h", "src/src/google/protobuf/map_entry.h", "src/src/google/protobuf/map_field.cc", "src/src/google/protobuf/map_field.h", "src/src/google/protobuf/map_field_inl.h", "src/src/google/protobuf/message.cc", "src/src/google/protobuf/message.h", "src/src/google/protobuf/metadata.h", "src/src/google/protobuf/reflection.h", "src/src/google/protobuf/reflection_internal.h", "src/src/google/protobuf/reflection_ops.cc", "src/src/google/protobuf/reflection_ops.h", "src/src/google/protobuf/service.cc", "src/src/google/protobuf/service.h", "src/src/google/protobuf/source_context.pb.cc", "src/src/google/protobuf/source_context.pb.h", "src/src/google/protobuf/struct.pb.cc", "src/src/google/protobuf/struct.pb.h", "src/src/google/protobuf/stubs/mathutil.h", "src/src/google/protobuf/stubs/substitute.cc", "src/src/google/protobuf/stubs/substitute.h", "src/src/google/protobuf/text_format.cc", "src/src/google/protobuf/text_format.h", "src/src/google/protobuf/timestamp.pb.cc", "src/src/google/protobuf/timestamp.pb.h", "src/src/google/protobuf/type.pb.cc", "src/src/google/protobuf/type.pb.h", "src/src/google/protobuf/unknown_field_set.cc", "src/src/google/protobuf/unknown_field_set.h", "src/src/google/protobuf/util/field_comparator.cc", "src/src/google/protobuf/util/field_comparator.h", "src/src/google/protobuf/util/field_mask_util.cc", "src/src/google/protobuf/util/field_mask_util.h", "src/src/google/protobuf/util/internal/constants.h", "src/src/google/protobuf/util/internal/datapiece.cc", "src/src/google/protobuf/util/internal/datapiece.h", "src/src/google/protobuf/util/internal/default_value_objectwriter.cc", "src/src/google/protobuf/util/internal/default_value_objectwriter.h", "src/src/google/protobuf/util/internal/error_listener.cc", "src/src/google/protobuf/util/internal/error_listener.h", "src/src/google/protobuf/util/internal/field_mask_utility.cc", "src/src/google/protobuf/util/internal/field_mask_utility.h", "src/src/google/protobuf/util/internal/json_escaping.cc", "src/src/google/protobuf/util/internal/json_escaping.h", "src/src/google/protobuf/util/internal/json_objectwriter.cc", "src/src/google/protobuf/util/internal/json_objectwriter.h", "src/src/google/protobuf/util/internal/json_stream_parser.cc", "src/src/google/protobuf/util/internal/json_stream_parser.h", "src/src/google/protobuf/util/internal/location_tracker.h", "src/src/google/protobuf/util/internal/object_location_tracker.h", "src/src/google/protobuf/util/internal/object_source.h", "src/src/google/protobuf/util/internal/object_writer.cc", "src/src/google/protobuf/util/internal/object_writer.h", "src/src/google/protobuf/util/internal/proto_writer.cc", "src/src/google/protobuf/util/internal/proto_writer.h", "src/src/google/protobuf/util/internal/protostream_objectsource.cc", "src/src/google/protobuf/util/internal/protostream_objectsource.h", "src/src/google/protobuf/util/internal/protostream_objectwriter.cc", "src/src/google/protobuf/util/internal/protostream_objectwriter.h", "src/src/google/protobuf/util/internal/structured_objectwriter.h", "src/src/google/protobuf/util/internal/type_info.cc", "src/src/google/protobuf/util/internal/type_info.h", "src/src/google/protobuf/util/internal/type_info_test_helper.cc", "src/src/google/protobuf/util/internal/type_info_test_helper.h", "src/src/google/protobuf/util/internal/utility.cc", "src/src/google/protobuf/util/internal/utility.h", "src/src/google/protobuf/util/json_util.cc", "src/src/google/protobuf/util/json_util.h", "src/src/google/protobuf/util/message_differencer.cc", "src/src/google/protobuf/util/message_differencer.h", "src/src/google/protobuf/util/time_util.cc", "src/src/google/protobuf/util/time_util.h", "src/src/google/protobuf/util/type_resolver.h", "src/src/google/protobuf/util/type_resolver_util.cc", "src/src/google/protobuf/util/type_resolver_util.h", "src/src/google/protobuf/wire_format.cc", "src/src/google/protobuf/wire_format.h", "src/src/google/protobuf/wrappers.pb.cc", "src/src/google/protobuf/wrappers.pb.h", ] deps = [ "../zlib" ] configs += [ ":protobuf_warnings", "../zlib:zlib_config", ] public_configs = [ ":protobuf_config" ] defines = [ "HAVE_ZLIB" ] visibility = [ ":protoc_lib", "../chromium_quic/src/third_party:quic_trace", "//third_party/libprotobuf-mutator:*", ] } # Only compile the compiler for the host architecture. if (current_toolchain == host_toolchain) { # protoc compiler is separated into protoc library and executable targets to # support protoc plugins that need to link libprotoc, but not the main() # itself. See src/google/protobuf/compiler/plugin.h static_library("protoc_lib") { sources = [ "src/src/google/protobuf/compiler/code_generator.cc", "src/src/google/protobuf/compiler/code_generator.h", "src/src/google/protobuf/compiler/command_line_interface.cc", "src/src/google/protobuf/compiler/command_line_interface.h", "src/src/google/protobuf/compiler/cpp/cpp_enum.cc", "src/src/google/protobuf/compiler/cpp/cpp_enum.h", "src/src/google/protobuf/compiler/cpp/cpp_enum_field.cc", "src/src/google/protobuf/compiler/cpp/cpp_enum_field.h", "src/src/google/protobuf/compiler/cpp/cpp_extension.cc", "src/src/google/protobuf/compiler/cpp/cpp_extension.h", "src/src/google/protobuf/compiler/cpp/cpp_field.cc", "src/src/google/protobuf/compiler/cpp/cpp_field.h", "src/src/google/protobuf/compiler/cpp/cpp_file.cc", "src/src/google/protobuf/compiler/cpp/cpp_file.h", "src/src/google/protobuf/compiler/cpp/cpp_generator.cc", "src/src/google/protobuf/compiler/cpp/cpp_generator.h", "src/src/google/protobuf/compiler/cpp/cpp_helpers.cc", "src/src/google/protobuf/compiler/cpp/cpp_helpers.h", "src/src/google/protobuf/compiler/cpp/cpp_map_field.cc", "src/src/google/protobuf/compiler/cpp/cpp_map_field.h", "src/src/google/protobuf/compiler/cpp/cpp_message.cc", "src/src/google/protobuf/compiler/cpp/cpp_message.h", "src/src/google/protobuf/compiler/cpp/cpp_message_field.cc", "src/src/google/protobuf/compiler/cpp/cpp_message_field.h", "src/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h", "src/src/google/protobuf/compiler/cpp/cpp_options.h", "src/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc", "src/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h", "src/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", "src/src/google/protobuf/compiler/cpp/cpp_primitive_field.h", "src/src/google/protobuf/compiler/cpp/cpp_service.cc", "src/src/google/protobuf/compiler/cpp/cpp_service.h", "src/src/google/protobuf/compiler/cpp/cpp_string_field.cc", "src/src/google/protobuf/compiler/cpp/cpp_string_field.h", "src/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc", "src/src/google/protobuf/compiler/csharp/csharp_doc_comment.h", "src/src/google/protobuf/compiler/csharp/csharp_enum.cc", "src/src/google/protobuf/compiler/csharp/csharp_enum.h", "src/src/google/protobuf/compiler/csharp/csharp_enum_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_enum_field.h", "src/src/google/protobuf/compiler/csharp/csharp_field_base.cc", "src/src/google/protobuf/compiler/csharp/csharp_field_base.h", "src/src/google/protobuf/compiler/csharp/csharp_generator.cc", "src/src/google/protobuf/compiler/csharp/csharp_generator.h", "src/src/google/protobuf/compiler/csharp/csharp_helpers.cc", "src/src/google/protobuf/compiler/csharp/csharp_helpers.h", "src/src/google/protobuf/compiler/csharp/csharp_map_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_map_field.h", "src/src/google/protobuf/compiler/csharp/csharp_message.cc", "src/src/google/protobuf/compiler/csharp/csharp_message.h", "src/src/google/protobuf/compiler/csharp/csharp_message_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_message_field.h", "src/src/google/protobuf/compiler/csharp/csharp_options.h", "src/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_primitive_field.h", "src/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc", "src/src/google/protobuf/compiler/csharp/csharp_reflection_class.h", "src/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h", "src/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h", "src/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h", "src/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc", "src/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h", "src/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc", "src/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h", "src/src/google/protobuf/compiler/java/java_context.cc", "src/src/google/protobuf/compiler/java/java_context.h", "src/src/google/protobuf/compiler/java/java_doc_comment.cc", "src/src/google/protobuf/compiler/java/java_doc_comment.h", "src/src/google/protobuf/compiler/java/java_enum.cc", "src/src/google/protobuf/compiler/java/java_enum.h", "src/src/google/protobuf/compiler/java/java_enum_field.cc", "src/src/google/protobuf/compiler/java/java_enum_field.h", "src/src/google/protobuf/compiler/java/java_enum_field_lite.cc", "src/src/google/protobuf/compiler/java/java_enum_field_lite.h", "src/src/google/protobuf/compiler/java/java_enum_lite.cc", "src/src/google/protobuf/compiler/java/java_enum_lite.h", "src/src/google/protobuf/compiler/java/java_extension.cc", "src/src/google/protobuf/compiler/java/java_extension.h", "src/src/google/protobuf/compiler/java/java_extension_lite.cc", "src/src/google/protobuf/compiler/java/java_extension_lite.h", "src/src/google/protobuf/compiler/java/java_field.cc", "src/src/google/protobuf/compiler/java/java_field.h", "src/src/google/protobuf/compiler/java/java_file.cc", "src/src/google/protobuf/compiler/java/java_file.h", "src/src/google/protobuf/compiler/java/java_generator.cc", "src/src/google/protobuf/compiler/java/java_generator.h", "src/src/google/protobuf/compiler/java/java_generator_factory.cc", "src/src/google/protobuf/compiler/java/java_generator_factory.h", "src/src/google/protobuf/compiler/java/java_helpers.cc", "src/src/google/protobuf/compiler/java/java_helpers.h", "src/src/google/protobuf/compiler/java/java_map_field.cc", "src/src/google/protobuf/compiler/java/java_map_field.h", "src/src/google/protobuf/compiler/java/java_map_field_lite.cc", "src/src/google/protobuf/compiler/java/java_map_field_lite.h", "src/src/google/protobuf/compiler/java/java_message.cc", "src/src/google/protobuf/compiler/java/java_message.h", "src/src/google/protobuf/compiler/java/java_message_builder.cc", "src/src/google/protobuf/compiler/java/java_message_builder.h", "src/src/google/protobuf/compiler/java/java_message_builder_lite.cc", "src/src/google/protobuf/compiler/java/java_message_builder_lite.h", "src/src/google/protobuf/compiler/java/java_message_field.cc", "src/src/google/protobuf/compiler/java/java_message_field.h", "src/src/google/protobuf/compiler/java/java_message_field_lite.cc", "src/src/google/protobuf/compiler/java/java_message_field_lite.h", "src/src/google/protobuf/compiler/java/java_message_lite.cc", "src/src/google/protobuf/compiler/java/java_message_lite.h", "src/src/google/protobuf/compiler/java/java_name_resolver.cc", "src/src/google/protobuf/compiler/java/java_name_resolver.h", "src/src/google/protobuf/compiler/java/java_options.h", "src/src/google/protobuf/compiler/java/java_primitive_field.cc", "src/src/google/protobuf/compiler/java/java_primitive_field.h", "src/src/google/protobuf/compiler/java/java_primitive_field_lite.cc", "src/src/google/protobuf/compiler/java/java_primitive_field_lite.h", "src/src/google/protobuf/compiler/java/java_service.cc", "src/src/google/protobuf/compiler/java/java_service.h", "src/src/google/protobuf/compiler/java/java_shared_code_generator.cc", "src/src/google/protobuf/compiler/java/java_shared_code_generator.h", "src/src/google/protobuf/compiler/java/java_string_field.cc", "src/src/google/protobuf/compiler/java/java_string_field.h", "src/src/google/protobuf/compiler/java/java_string_field_lite.cc", "src/src/google/protobuf/compiler/java/java_string_field_lite.h", "src/src/google/protobuf/compiler/js/js_generator.cc", "src/src/google/protobuf/compiler/js/js_generator.h", "src/src/google/protobuf/compiler/js/well_known_types_embed.cc", "src/src/google/protobuf/compiler/js/well_known_types_embed.h", "src/src/google/protobuf/compiler/objectivec/objectivec_enum.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_enum.h", "src/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h", "src/src/google/protobuf/compiler/objectivec/objectivec_extension.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_extension.h", "src/src/google/protobuf/compiler/objectivec/objectivec_field.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_field.h", "src/src/google/protobuf/compiler/objectivec/objectivec_file.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_file.h", "src/src/google/protobuf/compiler/objectivec/objectivec_generator.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_generator.h", "src/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_helpers.h", "src/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_map_field.h", "src/src/google/protobuf/compiler/objectivec/objectivec_message.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_message.h", "src/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_message_field.h", "src/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_oneof.h", "src/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", "src/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h", "src/src/google/protobuf/compiler/php/php_generator.cc", "src/src/google/protobuf/compiler/php/php_generator.h", "src/src/google/protobuf/compiler/plugin.cc", "src/src/google/protobuf/compiler/plugin.h", "src/src/google/protobuf/compiler/plugin.pb.cc", "src/src/google/protobuf/compiler/plugin.pb.h", "src/src/google/protobuf/compiler/python/python_generator.cc", "src/src/google/protobuf/compiler/python/python_generator.h", "src/src/google/protobuf/compiler/ruby/ruby_generator.cc", "src/src/google/protobuf/compiler/ruby/ruby_generator.h", "src/src/google/protobuf/compiler/subprocess.cc", "src/src/google/protobuf/compiler/subprocess.h", "src/src/google/protobuf/compiler/zip_writer.cc", "src/src/google/protobuf/compiler/zip_writer.h", ] configs += [ ":protobuf_warnings" ] public_configs = [ ":protobuf_config" ] public_deps = [ ":protobuf_full" ] } executable("protoc") { sources = [ "src/src/google/protobuf/compiler/main.cc" ] deps = [ ":protoc_lib" ] configs += [ ":protobuf_warnings" ] public_configs = [ ":protobuf_config" ] } }