Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 # This file is meant to be included into an target to provide a rule | |
| 6 # to invoke protoc in a consistent manner. | |
| 7 # | |
| 8 # To use this, create a gyp target with the following form: | |
| 9 # { | |
| 10 # 'target_name': 'my_proto_lib', | |
| 11 # 'sources': [ | |
| 12 # 'foo.proto', | |
| 13 # 'bar.proto', | |
| 14 # ], | |
| 15 # 'variables': { | |
| 16 # 'proto_dir': 'dir/for/my_proto_lib' | |
| 17 # }, | |
| 18 # 'includes': ['path/to/this/gypi/file'], | |
| 19 # } | |
| 20 # If necessary, you may add normal .cc files to the sources list or other gyp | |
| 21 # dependencies. The proto headers are guaranteed to be generated before any | |
| 22 # source files, even within this target, are compiled. | |
| 23 # | |
| 24 # Targets that gyp-depend on my_proto_lib will be able to include the resulting | |
| 25 # proto headers with an include like: | |
| 26 # #include "dir/for/my_proto_lib/foo.pb.h" | |
| 27 # | |
| 28 # Implementation notes: | |
| 29 # A proto_dir of foo/bar produces | |
| 30 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h} | |
| 31 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py | |
| 32 | |
| 33 { | |
| 34 'type': 'static_library', | |
|
TVL
2011/08/18 20:22:40
should this be a default (type?) so the target can
Evan Martin
2011/08/18 20:24:49
I considered it, but I figure I can generalize thi
TVL
2011/08/18 20:30:13
Ok, approach makes sense to me. Mark -
Maybe go
Mark Mentovai
2011/08/18 20:32:27
This shouldn’t set type at all!
Evan Martin
2011/08/18 20:51:49
Done.
| |
| 35 'variables': { | |
| 36 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', | |
| 37 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_dir)', | |
| 38 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_dir)', | |
| 39 }, | |
| 40 'rules': [ | |
| 41 { | |
| 42 'rule_name': 'genproto', | |
| 43 'extension': 'proto', | |
| 44 'inputs': [ | |
| 45 '<(protoc)', | |
| 46 ], | |
| 47 'outputs': [ | |
| 48 '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py', | |
| 49 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc', | |
| 50 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h', | |
| 51 ], | |
| 52 'action': [ | |
| 53 '<(protoc)', | |
| 54 '--proto_path=.', | |
| 55 './<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)', | |
| 56 '--cpp_out=<(cc_dir)', | |
| 57 '--python_out=<(py_dir)', | |
| 58 ], | |
| 59 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)', | |
| 60 'process_outputs_as_sources': 1, | |
| 61 }, | |
| 62 ], | |
| 63 'dependencies': [ | |
| 64 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', | |
| 65 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', | |
| 66 ], | |
| 67 'include_dirs': [ | |
| 68 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', | |
| 69 ], | |
| 70 'direct_dependent_settings': { | |
| 71 'include_dirs': [ | |
| 72 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', | |
| 73 ] | |
| 74 }, | |
| 75 # This target exports a hard dependency because it generates header | |
| 76 # files. | |
| 77 'hard_dependency': 1, | |
| 78 } | |
| OLD | NEW |