aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManjunath Kudlur <keveman@gmail.com>2015-12-07 13:08:21 -0800
committerManjunath Kudlur <keveman@gmail.com>2015-12-07 13:08:21 -0800
commit3ff1dca0bd9c1526cc0377533db89c4a45862253 (patch)
tree031bcc9871bc786d4f31e4d237a0035d789eeea7
parent9bd74b7f25b45b253f46025d7300a17df58d213f (diff)
downloadprotobuf-3ff1dca0bd9c1526cc0377533db89c4a45862253.tar.gz
protobuf-3ff1dca0bd9c1526cc0377533db89c4a45862253.tar.bz2
protobuf-3ff1dca0bd9c1526cc0377533db89c4a45862253.zip
Enable fast cpp protos in the python interface.
-rw-r--r--BUILD48
-rw-r--r--python/google/protobuf/pyext/extension_dict.h3
-rw-r--r--python/google/protobuf/pyext/message.h3
-rw-r--r--python/google/protobuf/pyext/message_map_container.h3
-rw-r--r--python/google/protobuf/pyext/repeated_composite_container.h3
-rw-r--r--python/google/protobuf/pyext/repeated_scalar_container.h3
-rw-r--r--python/google/protobuf/pyext/scalar_map_container.h3
7 files changed, 53 insertions, 13 deletions
diff --git a/BUILD b/BUILD
index ee31cd86..c04a7c0b 100644
--- a/BUILD
+++ b/BUILD
@@ -54,9 +54,9 @@ cc_library(
"src/google/protobuf/stubs/time.cc",
"src/google/protobuf/wire_format_lite.cc",
],
+ hdrs = glob(["src/google/protobuf/**/*.h"]),
copts = COPTS,
includes = ["src/"],
- hdrs = glob(["src/google/protobuf/**/*.h"]),
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
)
@@ -156,9 +156,9 @@ cc_proto_library(
name = "cc_wkt_protos",
srcs = WELL_KNOWN_PROTOS,
include = "src",
+ default_runtime = ":protobuf",
internal_bootstrap_hack = 1,
protoc = ":protoc",
- default_runtime = ":protobuf",
visibility = ["//visibility:public"],
)
@@ -336,8 +336,8 @@ cc_proto_library(
name = "cc_test_protos",
srcs = LITE_TEST_PROTOS + TEST_PROTOS,
include = "src",
- protoc = ":protoc",
default_runtime = ":protobuf",
+ protoc = ":protoc",
deps = [":cc_wkt_protos"],
)
@@ -509,15 +509,49 @@ internal_copied_filegroup(
include = "python",
)
+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,
+)
+
+cc_binary(
+ name = "google/protobuf/pyext/_message.so",
+ srcs = glob([
+ "python/google/protobuf/pyext/*.cc",
+ "python/google/protobuf/pyext/*.h",
+ ]),
+ copts = COPTS + [
+ "-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
+ "-I/usr/include/python2.7",
+ ],
+ includes = [
+ "python/",
+ "src/",
+ ],
+ linkshared = 1,
+ linkstatic = 1,
+ deps = [":protobuf"],
+)
+
py_proto_library(
name = "protobuf_python",
srcs = WELL_KNOWN_PROTOS,
- srcs_version = "PY2AND3",
include = "src",
+ data = [
+ ":google/protobuf/internal/_api_implementation.so",
+ ":google/protobuf/pyext/_message.so",
+ ],
+ default_runtime = "",
protoc = ":protoc",
py_extra_srcs = [":python_srcs"],
py_libs = ["//external:six"],
- default_runtime = "",
+ srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
@@ -536,9 +570,9 @@ py_proto_library(
name = "python_common_test_protos",
srcs = LITE_TEST_PROTOS + TEST_PROTOS,
include = "src",
+ default_runtime = "",
protoc = ":protoc",
deps = [":protobuf_python"],
- default_runtime = "",
)
py_proto_library(
@@ -548,9 +582,9 @@ py_proto_library(
"python/google/protobuf/internal/import_test_package/*.proto",
]),
include = "python",
+ default_runtime = ":protobuf_python",
protoc = ":protoc",
deps = [":python_common_test_protos"],
- default_runtime = ":protobuf_python",
)
py_library(
diff --git a/python/google/protobuf/pyext/extension_dict.h b/python/google/protobuf/pyext/extension_dict.h
index 7e1049f1..0cac8ba6 100644
--- a/python/google/protobuf/pyext/extension_dict.h
+++ b/python/google/protobuf/pyext/extension_dict.h
@@ -47,7 +47,8 @@ namespace protobuf {
class Message;
class FieldDescriptor;
-using internal::shared_ptr;
+using std::shared_ptr;
+using std::string;
namespace python {
diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h
index 1ff82e2f..d4b7f4cf 100644
--- a/python/google/protobuf/pyext/message.h
+++ b/python/google/protobuf/pyext/message.h
@@ -52,7 +52,8 @@ class Descriptor;
class DescriptorPool;
class MessageFactory;
-using internal::shared_ptr;
+using std::shared_ptr;
+using std::string;
namespace python {
diff --git a/python/google/protobuf/pyext/message_map_container.h b/python/google/protobuf/pyext/message_map_container.h
index 8286ba8a..270922d4 100644
--- a/python/google/protobuf/pyext/message_map_container.h
+++ b/python/google/protobuf/pyext/message_map_container.h
@@ -45,7 +45,8 @@ namespace protobuf {
class Message;
-using internal::shared_ptr;
+using std::shared_ptr;
+using std::string;
namespace python {
diff --git a/python/google/protobuf/pyext/repeated_composite_container.h b/python/google/protobuf/pyext/repeated_composite_container.h
index 3013aba9..494db0ec 100644
--- a/python/google/protobuf/pyext/repeated_composite_container.h
+++ b/python/google/protobuf/pyext/repeated_composite_container.h
@@ -49,7 +49,8 @@ namespace protobuf {
class FieldDescriptor;
class Message;
-using internal::shared_ptr;
+using std::shared_ptr;
+using std::string;
namespace python {
diff --git a/python/google/protobuf/pyext/repeated_scalar_container.h b/python/google/protobuf/pyext/repeated_scalar_container.h
index 5dfa21e0..a13cf9b2 100644
--- a/python/google/protobuf/pyext/repeated_scalar_container.h
+++ b/python/google/protobuf/pyext/repeated_scalar_container.h
@@ -48,7 +48,8 @@ namespace protobuf {
class Message;
-using internal::shared_ptr;
+using std::shared_ptr;
+using std::string;
namespace python {
diff --git a/python/google/protobuf/pyext/scalar_map_container.h b/python/google/protobuf/pyext/scalar_map_container.h
index aded8d49..8807892d 100644
--- a/python/google/protobuf/pyext/scalar_map_container.h
+++ b/python/google/protobuf/pyext/scalar_map_container.h
@@ -45,7 +45,8 @@ namespace protobuf {
class Message;
-using internal::shared_ptr;
+using std::shared_ptr;
+using std::string;
namespace python {