From 00ceebe3333f282d74dc4eb71893f853c99964c4 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Wed, 7 Feb 2018 14:24:31 -0800 Subject: Add zlib support to protobuf We're already including the source files for zlib support, and linking against libz, but we haven't been turning it on. Test: cd external/protobuf; mma Change-Id: Ia4d0ef9f7053b163afda7efaa7c22c3ffa32d4f7 --- Android.bp | 148 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 75 insertions(+), 73 deletions(-) diff --git a/Android.bp b/Android.bp index 0706d037b..6f9f7cb95 100644 --- a/Android.bp +++ b/Android.bp @@ -142,70 +142,75 @@ cc_library_shared { // C++ full library // ======================================================= -protobuf_cc_full_src_files = [ - "src/google/protobuf/any.pb.cc", - "src/google/protobuf/api.pb.cc", - "src/google/protobuf/stubs/mathlimits.cc", - "src/google/protobuf/any.cc", - "src/google/protobuf/descriptor.cc", - "src/google/protobuf/descriptor_database.cc", - "src/google/protobuf/descriptor.pb.cc", - "src/google/protobuf/duration.pb.cc", - "src/google/protobuf/dynamic_message.cc", - "src/google/protobuf/empty.pb.cc", - "src/google/protobuf/extension_set_heavy.cc", - "src/google/protobuf/field_mask.pb.cc", - "src/google/protobuf/generated_message_reflection.cc", - "src/google/protobuf/map_field.cc", - "src/google/protobuf/message.cc", - "src/google/protobuf/reflection_ops.cc", - "src/google/protobuf/service.cc", - "src/google/protobuf/source_context.pb.cc", - "src/google/protobuf/struct.pb.cc", - "src/google/protobuf/stubs/substitute.cc", - "src/google/protobuf/text_format.cc", - "src/google/protobuf/timestamp.pb.cc", - "src/google/protobuf/type.pb.cc", - "src/google/protobuf/unknown_field_set.cc", - "src/google/protobuf/wire_format.cc", - "src/google/protobuf/wrappers.pb.cc", - "src/google/protobuf/io/gzip_stream.cc", - "src/google/protobuf/io/printer.cc", - "src/google/protobuf/io/strtod.cc", - "src/google/protobuf/io/tokenizer.cc", - "src/google/protobuf/io/zero_copy_stream_impl.cc", - "src/google/protobuf/compiler/importer.cc", - "src/google/protobuf/compiler/parser.cc", - "src/google/protobuf/util/field_comparator.cc", - "src/google/protobuf/util/field_mask_util.cc", - "src/google/protobuf/util/internal/datapiece.cc", - "src/google/protobuf/util/internal/default_value_objectwriter.cc", - "src/google/protobuf/util/internal/error_listener.cc", - "src/google/protobuf/util/internal/field_mask_utility.cc", - "src/google/protobuf/util/internal/json_escaping.cc", - "src/google/protobuf/util/internal/json_objectwriter.cc", - "src/google/protobuf/util/internal/json_stream_parser.cc", - "src/google/protobuf/util/internal/object_writer.cc", - "src/google/protobuf/util/internal/protostream_objectsource.cc", - "src/google/protobuf/util/internal/protostream_objectwriter.cc", - "src/google/protobuf/util/internal/proto_writer.cc", - "src/google/protobuf/util/internal/type_info.cc", - "src/google/protobuf/util/internal/type_info_test_helper.cc", - "src/google/protobuf/util/internal/utility.cc", - "src/google/protobuf/util/json_util.cc", - "src/google/protobuf/util/message_differencer.cc", - "src/google/protobuf/util/time_util.cc", - "src/google/protobuf/util/type_resolver_util.cc", -] +cc_defaults { + name: "libprotobuf-cpp-full-defaults", + defaults: ["libprotobuf-cpp-lite-defaults"], + + srcs: [ + "src/google/protobuf/any.pb.cc", + "src/google/protobuf/api.pb.cc", + "src/google/protobuf/stubs/mathlimits.cc", + "src/google/protobuf/any.cc", + "src/google/protobuf/descriptor.cc", + "src/google/protobuf/descriptor_database.cc", + "src/google/protobuf/descriptor.pb.cc", + "src/google/protobuf/duration.pb.cc", + "src/google/protobuf/dynamic_message.cc", + "src/google/protobuf/empty.pb.cc", + "src/google/protobuf/extension_set_heavy.cc", + "src/google/protobuf/field_mask.pb.cc", + "src/google/protobuf/generated_message_reflection.cc", + "src/google/protobuf/map_field.cc", + "src/google/protobuf/message.cc", + "src/google/protobuf/reflection_ops.cc", + "src/google/protobuf/service.cc", + "src/google/protobuf/source_context.pb.cc", + "src/google/protobuf/struct.pb.cc", + "src/google/protobuf/stubs/substitute.cc", + "src/google/protobuf/text_format.cc", + "src/google/protobuf/timestamp.pb.cc", + "src/google/protobuf/type.pb.cc", + "src/google/protobuf/unknown_field_set.cc", + "src/google/protobuf/wire_format.cc", + "src/google/protobuf/wrappers.pb.cc", + "src/google/protobuf/io/gzip_stream.cc", + "src/google/protobuf/io/printer.cc", + "src/google/protobuf/io/strtod.cc", + "src/google/protobuf/io/tokenizer.cc", + "src/google/protobuf/io/zero_copy_stream_impl.cc", + "src/google/protobuf/compiler/importer.cc", + "src/google/protobuf/compiler/parser.cc", + "src/google/protobuf/util/field_comparator.cc", + "src/google/protobuf/util/field_mask_util.cc", + "src/google/protobuf/util/internal/datapiece.cc", + "src/google/protobuf/util/internal/default_value_objectwriter.cc", + "src/google/protobuf/util/internal/error_listener.cc", + "src/google/protobuf/util/internal/field_mask_utility.cc", + "src/google/protobuf/util/internal/json_escaping.cc", + "src/google/protobuf/util/internal/json_objectwriter.cc", + "src/google/protobuf/util/internal/json_stream_parser.cc", + "src/google/protobuf/util/internal/object_writer.cc", + "src/google/protobuf/util/internal/protostream_objectsource.cc", + "src/google/protobuf/util/internal/protostream_objectwriter.cc", + "src/google/protobuf/util/internal/proto_writer.cc", + "src/google/protobuf/util/internal/type_info.cc", + "src/google/protobuf/util/internal/type_info_test_helper.cc", + "src/google/protobuf/util/internal/utility.cc", + "src/google/protobuf/util/json_util.cc", + "src/google/protobuf/util/message_differencer.cc", + "src/google/protobuf/util/time_util.cc", + "src/google/protobuf/util/type_resolver_util.cc", + ], + + cflags: ["-DHAVE_ZLIB=1"], + shared_libs: ["libz"], +} // C++ full library for the NDK. // ======================================================= cc_library_static { name: "libprotobuf-cpp-full-ndk", - defaults: ["libprotobuf-cpp-lite-defaults"], - - srcs: protobuf_cc_full_src_files, - shared_libs: ["libz"], + defaults: ["libprotobuf-cpp-full-defaults"], cflags: ["-DGOOGLE_PROTOBUF_NO_RTTI"], @@ -218,17 +223,14 @@ cc_library_static { // ======================================================= cc_library_shared { name: "libprotobuf-cpp-full", - defaults: ["libprotobuf-cpp-lite-defaults"], + defaults: ["libprotobuf-cpp-full-defaults"], host_supported: true, vendor_available: true, vndk: { enabled: true, }, - srcs: protobuf_cc_full_src_files, - cflags: ["-DGOOGLE_PROTOBUF_NO_RTTI"], - shared_libs: ["libz"], target: { android: { shared_libs: ["liblog"], @@ -240,13 +242,10 @@ cc_library_shared { // ======================================================= cc_library_shared { name: "libprotobuf-cpp-full-rtti", - defaults: ["libprotobuf-cpp-lite-defaults"], + defaults: ["libprotobuf-cpp-full-defaults"], vendor_available: true, - srcs: protobuf_cc_full_src_files, - rtti: true, - shared_libs: ["libz"], target: { android: { shared_libs: ["liblog"], @@ -258,9 +257,9 @@ cc_library_shared { // ======================================================= cc_library_host_shared { name: "libprotoc", - defaults: ["libprotobuf-cpp-lite-defaults"], + defaults: ["libprotobuf-cpp-full-defaults"], - srcs: protobuf_cc_full_src_files + [ + srcs: [ "src/google/protobuf/compiler/code_generator.cc", "src/google/protobuf/compiler/plugin.cc", "src/google/protobuf/compiler/plugin.pb.cc", @@ -269,11 +268,12 @@ cc_library_host_shared { local_include_dirs: [ "config", ], - export_include_dirs: ["src", "config"], + export_include_dirs: [ + "src", + "config", + ], rtti: true, - - shared_libs: ["libz"], } // Android Protocol buffer compiler, aprotoc (host executable) @@ -447,7 +447,9 @@ cc_binary_host { static_libs: ["libz"], - cflags: IGNORED_WARNINGS, + cflags: IGNORED_WARNINGS + [ + "-DHAVE_ZLIB=1", + ], } -- cgit v1.2.3