media/webrtc/trunk/build/protoc.gypi

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 # Use of this source code is governed by a BSD-style license that can be
michael@0 3 # found in the LICENSE file.
michael@0 4
michael@0 5 # This file is meant to be included into a target to provide a rule
michael@0 6 # to invoke protoc in a consistent manner.
michael@0 7 #
michael@0 8 # To use this, create a gyp target with the following form:
michael@0 9 # {
michael@0 10 # 'target_name': 'my_proto_lib',
michael@0 11 # 'type': 'static_library',
michael@0 12 # 'sources': [
michael@0 13 # 'foo.proto',
michael@0 14 # 'bar.proto',
michael@0 15 # ],
michael@0 16 # 'variables': {
michael@0 17 # # Optional, see below: 'proto_in_dir': '.'
michael@0 18 # 'proto_out_dir': 'dir/for/my_proto_lib'
michael@0 19 # },
michael@0 20 # 'includes': ['path/to/this/gypi/file'],
michael@0 21 # }
michael@0 22 # If necessary, you may add normal .cc files to the sources list or other gyp
michael@0 23 # dependencies. The proto headers are guaranteed to be generated before any
michael@0 24 # source files, even within this target, are compiled.
michael@0 25 #
michael@0 26 # The 'proto_in_dir' variable must be the relative path to the
michael@0 27 # directory containing the .proto files. If left out, it defaults to '.'.
michael@0 28 #
michael@0 29 # The 'proto_out_dir' variable specifies the path suffix that output
michael@0 30 # files are generated under. Targets that gyp-depend on my_proto_lib
michael@0 31 # will be able to include the resulting proto headers with an include
michael@0 32 # like:
michael@0 33 # #include "dir/for/my_proto_lib/foo.pb.h"
michael@0 34 #
michael@0 35 # If you need to add an EXPORT macro to a protobuf's c++ header, set the
michael@0 36 # 'cc_generator_options' variable with the value: 'dllexport_decl=FOO_EXPORT:'
michael@0 37 # e.g. 'dllexport_decl=BASE_EXPORT:'
michael@0 38 #
michael@0 39 # It is likely you also need to #include a file for the above EXPORT macro to
michael@0 40 # work. You can do so with the 'cc_include' variable.
michael@0 41 # e.g. 'base/base_export.h'
michael@0 42 #
michael@0 43 # Implementation notes:
michael@0 44 # A proto_out_dir of foo/bar produces
michael@0 45 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h}
michael@0 46 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py
michael@0 47
michael@0 48 {
michael@0 49 'variables': {
michael@0 50 'protoc_wrapper': '<(DEPTH)/tools/protoc_wrapper/protoc_wrapper.py',
michael@0 51 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
michael@0 52 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)',
michael@0 53 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)',
michael@0 54 'cc_generator_options%': '',
michael@0 55 'cc_include%': '',
michael@0 56 'proto_in_dir%': '.',
michael@0 57 },
michael@0 58 'rules': [
michael@0 59 {
michael@0 60 'rule_name': 'genproto',
michael@0 61 'extension': 'proto',
michael@0 62 'inputs': [
michael@0 63 '<(protoc_wrapper)',
michael@0 64 '<(protoc)',
michael@0 65 ],
michael@0 66 'outputs': [
michael@0 67 '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py',
michael@0 68 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
michael@0 69 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
michael@0 70 ],
michael@0 71 'action': [
michael@0 72 'python',
michael@0 73 '<(protoc_wrapper)',
michael@0 74 '--include',
michael@0 75 '<(cc_include)',
michael@0 76 '--protobuf',
michael@0 77 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
michael@0 78 '--',
michael@0 79 '<(protoc)',
michael@0 80 # Using the --arg val form (instead of --arg=val) allows gyp's msvs rule
michael@0 81 # generation to correct 'val' which is a path.
michael@0 82 '--proto_path','<(proto_in_dir)',
michael@0 83 # Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires
michael@0 84 # --proto_path is a strict prefix of the path given as an argument.
michael@0 85 '<(proto_in_dir)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
michael@0 86 '--cpp_out', '<(cc_generator_options)<(cc_dir)',
michael@0 87 '--python_out', '<(py_dir)',
michael@0 88 ],
michael@0 89 'msvs_cygwin_shell': 0,
michael@0 90 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
michael@0 91 'process_outputs_as_sources': 1,
michael@0 92 },
michael@0 93 ],
michael@0 94 'dependencies': [
michael@0 95 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
michael@0 96 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
michael@0 97 ],
michael@0 98 'include_dirs': [
michael@0 99 '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
michael@0 100 '<(DEPTH)',
michael@0 101 ],
michael@0 102 'direct_dependent_settings': {
michael@0 103 'include_dirs': [
michael@0 104 '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
michael@0 105 '<(DEPTH)',
michael@0 106 ]
michael@0 107 },
michael@0 108 'export_dependent_settings': [
michael@0 109 # The generated headers reference headers within protobuf_lite,
michael@0 110 # so dependencies must be able to find those headers too.
michael@0 111 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
michael@0 112 ],
michael@0 113 # This target exports a hard dependency because it generates header
michael@0 114 # files.
michael@0 115 'hard_dependency': 1,
michael@0 116 }

mercurial