| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
| 6 # to invoke protoc in a consistent manner. For Java-targets, see | 6 # to invoke protoc in a consistent manner. For Java-targets, see |
| 7 # protoc_java.gypi. | 7 # protoc_java.gypi. |
| 8 # | 8 # |
| 9 # To use this, create a gyp target with the following form: | 9 # To use this, create a gyp target with the following form: |
| 10 # { | 10 # { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 # A proto_out_dir of foo/bar produces | 45 # A proto_out_dir of foo/bar produces |
| 46 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h} | 46 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h} |
| 47 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py | 47 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py |
| 48 | 48 |
| 49 { | 49 { |
| 50 'variables': { | 50 'variables': { |
| 51 'protoc_wrapper': '<(DEPTH)/tools/protoc_wrapper/protoc_wrapper.py', | 51 'protoc_wrapper': '<(DEPTH)/tools/protoc_wrapper/protoc_wrapper.py', |
| 52 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)', | 52 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)', |
| 53 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)', | 53 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)', |
| 54 'cc_generator_options%': '', | 54 'cc_generator_options%': '', |
| 55 'cc_generator_plugin%': '', |
| 55 'cc_include%': '', | 56 'cc_include%': '', |
| 56 'proto_in_dir%': '.', | 57 'proto_in_dir%': '.', |
| 57 'conditions': [ | 58 'conditions': [ |
| 58 ['use_system_protobuf==0', { | 59 ['use_system_protobuf==0', { |
| 59 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)
', | 60 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)
', |
| 60 }, { # use_system_protobuf==1 | 61 }, { # use_system_protobuf==1 |
| 61 'protoc': '<!(which protoc)', | 62 'protoc': '<!(which protoc)', |
| 62 }], | 63 }], |
| 63 ], | 64 ], |
| 64 }, | 65 }, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 '--include', | 82 '--include', |
| 82 '<(cc_include)', | 83 '<(cc_include)', |
| 83 '--protobuf', | 84 '--protobuf', |
| 84 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h', | 85 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h', |
| 85 # Using the --arg val form (instead of --arg=val) allows gyp's msvs rule | 86 # Using the --arg val form (instead of --arg=val) allows gyp's msvs rule |
| 86 # generation to correct 'val' which is a path. | 87 # generation to correct 'val' which is a path. |
| 87 '--proto-in-dir','<(proto_in_dir)', | 88 '--proto-in-dir','<(proto_in_dir)', |
| 88 # Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires | 89 # Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires |
| 89 # --proto_path is a strict prefix of the path given as an argument. | 90 # --proto_path is a strict prefix of the path given as an argument. |
| 90 '--proto-in-file','<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)', | 91 '--proto-in-file','<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)', |
| 92 '--cc-generator-plugin=<(cc_generator_plugin)', |
| 91 '--use-system-protobuf=<(use_system_protobuf)', | 93 '--use-system-protobuf=<(use_system_protobuf)', |
| 92 '--', | 94 '--', |
| 93 '<(protoc)', | 95 '<(protoc)', |
| 94 '--cpp_out', '<(cc_generator_options)<(cc_dir)', | 96 '--cpp_out', '<(cc_generator_options)<(cc_dir)', |
| 95 '--python_out', '<(py_dir)', | 97 '--python_out', '<(py_dir)', |
| 96 ], | 98 ], |
| 97 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)', | 99 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)', |
| 98 'process_outputs_as_sources': 1, | 100 'process_outputs_as_sources': 1, |
| 99 }, | 101 }, |
| 100 ], | 102 ], |
| 101 'dependencies': [ | 103 'dependencies': [ |
| 102 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', | 104 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', |
| 103 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', | |
| 104 ], | 105 ], |
| 105 'include_dirs': [ | 106 'include_dirs': [ |
| 106 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', | 107 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', |
| 107 '<(DEPTH)', | 108 '<(DEPTH)', |
| 108 ], | 109 ], |
| 109 'direct_dependent_settings': { | 110 'direct_dependent_settings': { |
| 110 'include_dirs': [ | 111 'include_dirs': [ |
| 111 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', | 112 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', |
| 112 '<(DEPTH)', | 113 '<(DEPTH)', |
| 113 ] | 114 ] |
| 114 }, | 115 }, |
| 115 'export_dependent_settings': [ | 116 # If using built-in cc generator the resulting headers reference headers |
| 116 # The generated headers reference headers within protobuf_lite, | 117 # within protobuf_lite, hence dependencies require those headers too. |
| 117 # so dependencies must be able to find those headers too. | 118 # In case of generator plugin such issues should be resolved by invoker. |
| 118 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', | 119 'hard_dependency': 1, |
| 120 'conditions': [ |
| 121 ['cc_generator_plugin==""', { |
| 122 'dependencies': [ |
| 123 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', |
| 124 ], |
| 125 'export_dependent_settings': [ |
| 126 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', |
| 127 ], |
| 128 }], |
| 119 ], | 129 ], |
| 120 # This target exports a hard dependency because it generates header | |
| 121 # files. | |
| 122 'hard_dependency': 1, | |
| 123 } | 130 } |
| OLD | NEW |