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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/proto/chromotocol.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/protoc.gypi
diff --git a/build/protoc.gypi b/build/protoc.gypi
new file mode 100644
index 0000000000000000000000000000000000000000..6065bde8909f99794b7cf375d7ba29890432bcfb
--- /dev/null
+++ b/build/protoc.gypi
@@ -0,0 +1,78 @@
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This file is meant to be included into an target to provide a rule
+# to invoke protoc in a consistent manner.
+#
+# To use this, create a gyp target with the following form:
+# {
+# 'target_name': 'my_proto_lib',
+# 'sources': [
+# 'foo.proto',
+# 'bar.proto',
+# ],
+# 'variables': {
+# 'proto_dir': 'dir/for/my_proto_lib'
+# },
+# 'includes': ['path/to/this/gypi/file'],
+# }
+# If necessary, you may add normal .cc files to the sources list or other gyp
+# dependencies. The proto headers are guaranteed to be generated before any
+# source files, even within this target, are compiled.
+#
+# Targets that gyp-depend on my_proto_lib will be able to include the resulting
+# proto headers with an include like:
+# #include "dir/for/my_proto_lib/foo.pb.h"
+#
+# Implementation notes:
+# A proto_dir of foo/bar produces
+# <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h}
+# <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py
+
+{
+ '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.
+ 'variables': {
+ 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
+ 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_dir)',
+ 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_dir)',
+ },
+ 'rules': [
+ {
+ 'rule_name': 'genproto',
+ 'extension': 'proto',
+ 'inputs': [
+ '<(protoc)',
+ ],
+ 'outputs': [
+ '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py',
+ '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
+ '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
+ ],
+ 'action': [
+ '<(protoc)',
+ '--proto_path=.',
+ './<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
+ '--cpp_out=<(cc_dir)',
+ '--python_out=<(py_dir)',
+ ],
+ 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ 'dependencies': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
+ ],
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
+ ]
+ },
+ # This target exports a hard dependency because it generates header
+ # files.
+ 'hard_dependency': 1,
+}
« 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