Index: third_party/protobuf/BUILD.gn |
diff --git a/third_party/protobuf/BUILD.gn b/third_party/protobuf/BUILD.gn |
index 265499ce28cfdca719b49920f60ca709250b1491..b2eab67e85d43fdd82e5333b5a2d50f7254a863a 100644 |
--- a/third_party/protobuf/BUILD.gn |
+++ b/third_party/protobuf/BUILD.gn |
@@ -14,7 +14,6 @@ config("protobuf_config") { |
config_h_dir, |
] |
defines = [ |
- "PROTOBUF_USE_DLLS", |
"GOOGLE_PROTOBUF_NO_RTTI", |
"GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", |
] |
@@ -25,6 +24,12 @@ config("protobuf_config") { |
} |
} |
+if (component_mode == "shared_library") { |
+ config("protobuf_use_dlls") { |
+ defines = [ "PROTOBUF_USE_DLLS" ] |
+ } |
+} |
+ |
# This condif should be applied to targets using generated code from the proto |
# compiler. It sets up the include directories properly. |
config("using_proto") { |
@@ -84,7 +89,7 @@ if (is_win) { |
] |
} |
-source_set("protobuf_lite") { |
+component("protobuf_lite") { |
sources = protobuf_lite_sources |
configs -= [ "//build/config/compiler:chromium_code" ] |
@@ -97,7 +102,10 @@ source_set("protobuf_lite") { |
cflags = protobuf_lite_cflags |
# Required for component builds. See http://crbug.com/172800. |
- defines = [ "LIBPROTOBUF_EXPORTS" ] |
+ if (component_mode == "shared_library") { |
+ public_configs += [ ":protobuf_use_dlls" ] |
+ defines = [ "LIBPROTOBUF_EXPORTS" ] |
+ } |
} |
# This is the full, heavy protobuf lib that's needed for c++ .protos that don't |