Files
ce_cdm/third_party/protoc.gypi
Joey Parrish 58aba6b2ec Fix protoc dependency race.
According to Eureka team, using protobuf_lib_type=="target" without a
direct dependency on a protoc target causes flakiness in the build.
This introduces a new variable to represent the protoc host target,
with a default value for platforms like iOS where a prebuilt copy of
protoc is used.

Change-Id: I39c08bd76c6bc4a5291b0e19b2d22a9f3beb04d0
2015-05-12 17:40:40 -07:00

75 lines
2.0 KiB
Python

# Copyright 2014 Google Inc. All rights reserved.
{
'variables': {
'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
'proto_in_dir%': '.',
},
'conditions': [
['protobuf_lib_type=="system"', {
# protobuf_lib is a library setting.
'direct_dependent_settings': {
'libraries': [
'<(protobuf_lib)',
],
},
}],
['protobuf_lib_type=="target"', {
# protobuf_lib is a gyp target.
'dependencies': [
'<(protobuf_lib)',
'<(protoc_host_target)',
],
'export_dependent_settings': [
'<(protobuf_lib)',
'<(protoc_host_target)',
],
}],
['protobuf_lib_type=="source"', {
# protobuf_lib is a source folder.
# We use protobuf.gyp to describe the build.
'dependencies': [
'../third_party/protobuf.gyp:protoc#host',
'../third_party/protobuf.gyp:protobuf_lite',
],
'export_dependent_settings': [
'../third_party/protobuf.gyp:protobuf_lite',
],
'variables': {
# Since we are building our own protoc, override protoc_dir.
'protoc_dir': '<(PRODUCT_DIR)',
},
}],
],
'rules': [
{
'rule_name': 'genproto',
'extension': 'proto',
'outputs': [
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
],
'action': [
'<(protoc_dir)/protoc',
'--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=<(cc_dir)',
],
'message': 'Generating C++ code from <(RULE_INPUT_PATH) ccdir=<(cc_dir)',
'process_outputs_as_sources': 1,
},
],
'include_dirs': [
'<(cc_dir)',
],
'direct_dependent_settings': {
'include_dirs': [
'<(cc_dir)',
]
},
# This target exports a hard dependency because it generates header
# files.
'hard_dependency': 1,
}