86 lines
2.4 KiB
Python
86 lines
2.4 KiB
Python
# Copyright 2015 Google Inc. All rights reserved.
|
|
{
|
|
'variables': {
|
|
'proto_gen_dir%': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
|
|
'proto_in_dir%': '.',
|
|
'protoc_gyp_path': './protobuf.gyp',
|
|
},
|
|
'includes': ['disable_warnings.gypi'],
|
|
'conditions': [
|
|
['protobuf_config=="system"', {
|
|
# protobuf_lib is a library setting.
|
|
'direct_dependent_settings': {
|
|
'libraries': [
|
|
'<(protobuf_lib)',
|
|
],
|
|
},
|
|
}],
|
|
['protobuf_config=="target"', {
|
|
# protobuf_lib is a gyp target.
|
|
'dependencies': [
|
|
'<(protobuf_lib_path)',
|
|
'<(protoc_host_path)',
|
|
],
|
|
'export_dependent_settings': [
|
|
'<(protobuf_lib_path)',
|
|
'<(protoc_host_path)',
|
|
],
|
|
}],
|
|
['protobuf_config=="source"', {
|
|
# protobuf_lib is a source folder.
|
|
# We use the targets in protobuf.gyp.
|
|
'dependencies': [
|
|
'<(protoc_gyp_path):protoc#host',
|
|
'<(protoc_gyp_path):protobuf_lite',
|
|
],
|
|
'export_dependent_settings': [
|
|
'<(protoc_gyp_path):protobuf_lite',
|
|
],
|
|
'conditions': [
|
|
# Since we are building protoc, we must supply the value of protoc_bin.
|
|
['OS=="ios"', {
|
|
'variables': {
|
|
'protoc_bin': '$(BUILD_DIR)/$(CONFIGURATION)/protoc',
|
|
},
|
|
}, {
|
|
'variables': {
|
|
'protoc_bin': '<(PRODUCT_DIR)/protoc',
|
|
},
|
|
}],
|
|
],
|
|
}],
|
|
],
|
|
'rules': [
|
|
{
|
|
'rule_name': 'genproto',
|
|
'extension': 'proto',
|
|
'outputs': [
|
|
'<(proto_gen_dir)/<(RULE_INPUT_ROOT).pb.cc',
|
|
'<(proto_gen_dir)/<(RULE_INPUT_ROOT).pb.h',
|
|
],
|
|
'msvs_cygwin_shell': '0', # Don't run action in a CYGWIN shell.
|
|
'action': [
|
|
'<(protoc_bin)',
|
|
'--proto_path=<(proto_in_dir)',
|
|
# 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=<(proto_gen_dir)',
|
|
],
|
|
'message': 'Generating C++ code from <(RULE_INPUT_PATH) ccdir=<(proto_gen_dir)',
|
|
'process_outputs_as_sources': 1,
|
|
},
|
|
],
|
|
'include_dirs': [
|
|
'<(proto_gen_dir)',
|
|
],
|
|
'direct_dependent_settings': {
|
|
'include_dirs': [
|
|
'<(proto_gen_dir)',
|
|
]
|
|
},
|
|
# This target exports a hard dependency because it generates header
|
|
# files.
|
|
'hard_dependency': 1,
|
|
}
|