Index: build/protoc.gypi |
=================================================================== |
--- build/protoc.gypi (revision 155895) |
+++ build/protoc.gypi (working copy) |
@@ -39,9 +39,16 @@ |
{ |
'variables': { |
+ 'protoc_wrapper': '<(DEPTH)/tools/protoc_wrapper/protoc_wrapper.py', |
'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', |
'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)', |
'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)', |
+ # Declspec to add to the generated protobuf c++ headers. |
Ryan Sleevi
2012/09/12 22:21:25
nit: declspec is Windows only, but presumably the
Lei Zhang
2012/09/12 23:33:59
Done.
|
+ # e.g. 'dllexport_decl=BASE_EXPORT:' |
+ 'cc_declspec%': '', |
+ # File to #include for the declspec in the generated protobuf c++ headers. |
+ # e.g. 'base/base_export.h' |
Ryan Sleevi
2012/09/12 22:21:25
nit: For consistency with the proto_in_dir/proto_o
Lei Zhang
2012/09/12 23:33:59
Done.
|
+ 'cc_declspec_include%': '', |
'proto_in_dir%': '.', |
}, |
'rules': [ |
@@ -49,6 +56,7 @@ |
'rule_name': 'genproto', |
'extension': 'proto', |
'inputs': [ |
+ '<(protoc_wrapper)', |
'<(protoc)', |
], |
'outputs': [ |
@@ -57,6 +65,13 @@ |
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.h', |
], |
'action': [ |
+ 'python', |
+ '<(protoc_wrapper)', |
+ '--include', |
+ '<(cc_declspec_include)', |
+ '--protobuf', |
+ '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h', |
+ '--', |
'<(protoc)', |
# Using the --arg val form (instead of --arg=val) allows gyp's msvs rule |
# generation to correct 'val' which is a path. |
@@ -64,9 +79,9 @@ |
# Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires |
# --proto_path is a strict prefix of the path given as an argument. |
'<(proto_in_dir)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)', |
- '--cpp_out','<(cc_dir)', |
- '--python_out','<(py_dir)', |
- ], |
+ '--cpp_out', '<(cc_declspec)<(cc_dir)', |
+ '--python_out', '<(py_dir)', |
+ ], |
'msvs_cygwin_shell': 0, |
'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)', |
'process_outputs_as_sources': 1, |
@@ -78,6 +93,7 @@ |
], |
'include_dirs': [ |
'<(SHARED_INTERMEDIATE_DIR)/protoc_out', |
+ '<(DEPTH)', |
Ryan Sleevi
2012/09/12 22:21:25
BUG? Seems like this should also be propagated in
Lei Zhang
2012/09/12 23:33:59
Done.
|
], |
'direct_dependent_settings': { |
'include_dirs': [ |