Skip to content

Commit

Permalink
Made building the python extension configurable via --define=use_fast…
Browse files Browse the repository at this point in the history
…_cpp_protos=true
  • Loading branch information
keveman committed Dec 8, 2015
1 parent 3f9b4f2 commit a194921
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,14 @@ cc_binary(
name = "google/protobuf/internal/_api_implementation.so",
srcs = ["python/google/protobuf/internal/api_implementation.cc"],
copts = COPTS + [
"-I/usr/include/python2.7",
"-DPYTHON_PROTO2_CPP_IMPL_V2",
],
linkshared = 1,
linkstatic = 1,
deps = select({
"//conditions:default": [],
":use_fast_cpp_protos": ["//util/python:python_headers"],
}),
)

cc_binary(
Expand All @@ -528,25 +531,39 @@ cc_binary(
]),
copts = COPTS + [
"-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
"-I/usr/include/python2.7",
],
includes = [
"python/",
"src/",
],
linkshared = 1,
linkstatic = 1,
deps = [":protobuf"],
deps = [
":protobuf",
] + select({
"//conditions:default": [],
":use_fast_cpp_protos": ["//util/python:python_headers"],
}),
)

config_setting(
name = "use_fast_cpp_protos",
values = {
"define": "use_fast_cpp_protos=true",
},
)

py_proto_library(
name = "protobuf_python",
srcs = WELL_KNOWN_PROTOS,
include = "src",
data = [
":google/protobuf/internal/_api_implementation.so",
":google/protobuf/pyext/_message.so",
],
data = select({
"//conditions:default": [],
":use_fast_cpp_protos": [
":google/protobuf/internal/_api_implementation.so",
":google/protobuf/pyext/_message.so",
],
}),
default_runtime = "",
protoc = ":protoc",
py_extra_srcs = [":python_srcs"],
Expand Down

0 comments on commit a194921

Please sign in to comment.