Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: build/protoc.gypi

Issue 7621073: Unify gyp rules for running protoc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/proto/chromotocol.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 # 'type': 'static_library',
12 # 'sources': [
13 # 'foo.proto',
14 # 'bar.proto',
15 # ],
16 # 'variables': {
17 # # Optional, see below: 'proto_in_dir': '.'
18 # 'proto_out_dir': 'dir/for/my_proto_lib'
19 # },
20 # 'includes': ['path/to/this/gypi/file'],
21 # }
22 # If necessary, you may add normal .cc files to the sources list or other gyp
23 # dependencies. The proto headers are guaranteed to be generated before any
24 # source files, even within this target, are compiled.
25 #
26 # The 'proto_in_dir' variable must be the relative path to the
27 # directory containing the .proto files. If left out, it defaults to '.'.
28 #
29 # The 'proto_out_dir' variable specifies the path suffix that output
30 # files are generated under. Targets that gyp-depend on my_proto_lib
31 # will be able to include the resulting proto headers with an include
32 # like:
33 # #include "dir/for/my_proto_lib/foo.pb.h"
34 #
35 # Implementation notes:
36 # A proto_out_dir of foo/bar produces
37 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h}
38 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py
39
40 {
41 'variables': {
42 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
43 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)',
44 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)',
45 'proto_in_dir%': '.',
46 },
47 'rules': [
48 {
49 'rule_name': 'genproto',
50 'extension': 'proto',
51 'inputs': [
52 '<(protoc)',
53 ],
54 'outputs': [
55 '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py',
56 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
57 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
58 ],
59 'action': [
60 '<(protoc)',
61 '--proto_path=<(proto_in_dir)',
62 # Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires
63 # --proto_path is a strict prefix of the path given as an argument.
64 '<(proto_in_dir)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
65 '--cpp_out=<(cc_dir)',
66 '--python_out=<(py_dir)',
67 ],
68 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
69 'process_outputs_as_sources': 1,
70 },
71 ],
72 'dependencies': [
73 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
74 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
75 ],
76 'include_dirs': [
77 '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
78 ],
79 'direct_dependent_settings': {
80 'include_dirs': [
81 '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
82 ]
83 },
84 # This target exports a hard dependency because it generates header
85 # files.
86 'hard_dependency': 1,
87 }
OLDNEW
« no previous file with comments | « no previous file | remoting/proto/chromotocol.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698