media/webrtc/trunk/build/protoc.gypi

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/trunk/build/protoc.gypi	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,116 @@
     1.4 +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.5 +# Use of this source code is governed by a BSD-style license that can be
     1.6 +# found in the LICENSE file.
     1.7 +
     1.8 +# This file is meant to be included into a target to provide a rule
     1.9 +# to invoke protoc in a consistent manner.
    1.10 +#
    1.11 +# To use this, create a gyp target with the following form:
    1.12 +# {
    1.13 +#   'target_name': 'my_proto_lib',
    1.14 +#   'type': 'static_library',
    1.15 +#   'sources': [
    1.16 +#     'foo.proto',
    1.17 +#     'bar.proto',
    1.18 +#   ],
    1.19 +#   'variables': {
    1.20 +#     # Optional, see below: 'proto_in_dir': '.'
    1.21 +#     'proto_out_dir': 'dir/for/my_proto_lib'
    1.22 +#   },
    1.23 +#   'includes': ['path/to/this/gypi/file'],
    1.24 +# }
    1.25 +# If necessary, you may add normal .cc files to the sources list or other gyp
    1.26 +# dependencies.  The proto headers are guaranteed to be generated before any
    1.27 +# source files, even within this target, are compiled.
    1.28 +#
    1.29 +# The 'proto_in_dir' variable must be the relative path to the
    1.30 +# directory containing the .proto files.  If left out, it defaults to '.'.
    1.31 +#
    1.32 +# The 'proto_out_dir' variable specifies the path suffix that output
    1.33 +# files are generated under.  Targets that gyp-depend on my_proto_lib
    1.34 +# will be able to include the resulting proto headers with an include
    1.35 +# like:
    1.36 +#   #include "dir/for/my_proto_lib/foo.pb.h"
    1.37 +#
    1.38 +# If you need to add an EXPORT macro to a protobuf's c++ header, set the
    1.39 +# 'cc_generator_options' variable with the value: 'dllexport_decl=FOO_EXPORT:'
    1.40 +# e.g. 'dllexport_decl=BASE_EXPORT:'
    1.41 +#
    1.42 +# It is likely you also need to #include a file for the above EXPORT macro to
    1.43 +# work. You can do so with the 'cc_include' variable.
    1.44 +# e.g. 'base/base_export.h'
    1.45 +#
    1.46 +# Implementation notes:
    1.47 +# A proto_out_dir of foo/bar produces
    1.48 +#   <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h}
    1.49 +#   <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py
    1.50 +
    1.51 +{
    1.52 +  'variables': {
    1.53 +    'protoc_wrapper': '<(DEPTH)/tools/protoc_wrapper/protoc_wrapper.py',
    1.54 +    'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
    1.55 +    'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)',
    1.56 +    'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)',
    1.57 +    'cc_generator_options%': '',
    1.58 +    'cc_include%': '',
    1.59 +    'proto_in_dir%': '.',
    1.60 +  },
    1.61 +  'rules': [
    1.62 +    {
    1.63 +      'rule_name': 'genproto',
    1.64 +      'extension': 'proto',
    1.65 +      'inputs': [
    1.66 +        '<(protoc_wrapper)',
    1.67 +        '<(protoc)',
    1.68 +      ],
    1.69 +      'outputs': [
    1.70 +        '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py',
    1.71 +        '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
    1.72 +        '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
    1.73 +      ],
    1.74 +      'action': [
    1.75 +        'python',
    1.76 +        '<(protoc_wrapper)',
    1.77 +        '--include',
    1.78 +        '<(cc_include)',
    1.79 +        '--protobuf',
    1.80 +        '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
    1.81 +        '--',
    1.82 +        '<(protoc)',
    1.83 +        # Using the --arg val form (instead of --arg=val) allows gyp's msvs rule
    1.84 +        # generation to correct 'val' which is a path.
    1.85 +        '--proto_path','<(proto_in_dir)',
    1.86 +        # Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires
    1.87 +        # --proto_path is a strict prefix of the path given as an argument.
    1.88 +        '<(proto_in_dir)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
    1.89 +        '--cpp_out', '<(cc_generator_options)<(cc_dir)',
    1.90 +        '--python_out', '<(py_dir)',
    1.91 +      ],
    1.92 +      'msvs_cygwin_shell': 0,
    1.93 +      'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
    1.94 +      'process_outputs_as_sources': 1,
    1.95 +    },
    1.96 +  ],
    1.97 +  'dependencies': [
    1.98 +    '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
    1.99 +    '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
   1.100 +  ],
   1.101 +  'include_dirs': [
   1.102 +    '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
   1.103 +    '<(DEPTH)',
   1.104 +  ],
   1.105 +  'direct_dependent_settings': {
   1.106 +    'include_dirs': [
   1.107 +      '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
   1.108 +      '<(DEPTH)',
   1.109 +    ]
   1.110 +  },
   1.111 +  'export_dependent_settings': [
   1.112 +    # The generated headers reference headers within protobuf_lite,
   1.113 +    # so dependencies must be able to find those headers too.
   1.114 +    '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
   1.115 +  ],
   1.116 +  # This target exports a hard dependency because it generates header
   1.117 +  # files.
   1.118 +  'hard_dependency': 1,
   1.119 +}

mercurial