# Copyright 2015 Google Inc. All Rights Reserved. # Describes building protobuf and protoc from sources. # Requires configuration of protobuf_source and setting of # protobuf_config to 'source'. # Source lists accurate as of protobuf v2.5.0. { # Some sources are used by both libprotobuf_lite and libprotobuf. # 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_lite_sources': [ '<(protobuf_source)/src/google/protobuf/extension_set.cc', '<(protobuf_source)/src/google/protobuf/generated_message_util.cc', '<(protobuf_source)/src/google/protobuf/message_lite.cc', '<(protobuf_source)/src/google/protobuf/repeated_field.cc', '<(protobuf_source)/src/google/protobuf/wire_format_lite.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/stubs/atomicops_internals_x86_gcc.cc', '<(protobuf_source)/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc', '<(protobuf_source)/src/google/protobuf/stubs/common.cc', '<(protobuf_source)/src/google/protobuf/stubs/once.cc', '<(protobuf_source)/src/google/protobuf/stubs/stringprintf.cc', ], }, 'target_defaults': { # These flags silence warnings that appear in protobuf upstream. # We will not maintain a divergent copy of protobuf to fix them. 'cflags': [ # Ignore unknown warning options, to support both gcc & clang at once. '-Wno-unknown-warning-option', # GCC: '-Wno-sign-compare', '-Wno-unused-local-typedefs', # Clang: '-Wno-unused-const-variable', '-Wno-unused-function', ], }, 'targets': [ { 'target_name': 'protobuf_lite', 'type': 'static_library', 'toolsets': ['target'], 'sources': [ '<@(protobuf_lite_sources)', ], 'include_dirs': [ '<(protobuf_source)', '<(protobuf_source)/src', ], 'direct_dependent_settings': { 'include_dirs': [ '<(protobuf_source)/src', ], }, }, { 'target_name': 'protobuf', 'type': 'static_library', 'toolsets': ['host'], 'includes': ['xcode_host.gypi'], # xcode workaround 'sources': [ '<@(protobuf_lite_sources)', '<(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/dynamic_message.cc', '<(protobuf_source)/src/google/protobuf/extension_set_heavy.cc', '<(protobuf_source)/src/google/protobuf/generated_message_reflection.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/text_format.cc', '<(protobuf_source)/src/google/protobuf/unknown_field_set.cc', '<(protobuf_source)/src/google/protobuf/wire_format.cc', '<(protobuf_source)/src/google/protobuf/compiler/importer.cc', '<(protobuf_source)/src/google/protobuf/compiler/parser.cc', '<(protobuf_source)/src/google/protobuf/io/gzip_stream.cc', '<(protobuf_source)/src/google/protobuf/io/printer.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/stubs/structurally_valid.cc', '<(protobuf_source)/src/google/protobuf/stubs/strutil.cc', '<(protobuf_source)/src/google/protobuf/stubs/substitute.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/main.cc', '<(protobuf_source)/src/google/protobuf/compiler/plugin.cc', '<(protobuf_source)/src/google/protobuf/compiler/plugin.pb.cc', '<(protobuf_source)/src/google/protobuf/compiler/subprocess.cc', '<(protobuf_source)/src/google/protobuf/compiler/zip_writer.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_message.cc', '<(protobuf_source)/src/google/protobuf/compiler/cpp/cpp_message_field.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/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_extension.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_helpers.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_message_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_primitive_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_service.cc', '<(protobuf_source)/src/google/protobuf/compiler/java/java_string_field.cc', '<(protobuf_source)/src/google/protobuf/compiler/python/python_generator.cc', ], 'include_dirs': [ '<(protobuf_source)', '<(protobuf_source)/src', ], 'dependencies': [ 'protobuf', ], }, ], }