diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake index 1e4444e20..9b1de677b 100644 --- a/cmake/libprotobuf-lite.cmake +++ b/cmake/libprotobuf-lite.cmake @@ -1,93 +1,11 @@ -set(libprotobuf_lite_files - ${protobuf_SOURCE_DIR}/src/google/protobuf/any_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/map.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc -) +# CMake definitions for libprotobuf_lite (the "lite" C++ protobuf runtime). -set(libprotobuf_lite_includes - ${protobuf_SOURCE_DIR}/src/google/protobuf/any.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_impl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/explicitly_constructed.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_inl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_decl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/has_bits.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_type_handler.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/port.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/casts.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/hash.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/macros.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/map_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/mutex.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/once.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/platform_macros.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stl_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h -) +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${protobuf_version_rc_file}) + ${libprotobuf_lite_srcs} + ${libprotobuf_lite_hdrs} + ${protobuf_version_rc_file}) if(protobuf_HAVE_LD_VERSION_SCRIPT) if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) @@ -98,9 +16,6 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT) LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) endif() target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT}) -target_include_directories(libprotobuf-lite - PRIVATE ${ABSL_ROOT_DIR} -) if(protobuf_LINK_LIBATOMIC) target_link_libraries(libprotobuf-lite PRIVATE atomic) endif() diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index e597959d2..aa3efc9a6 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -1,106 +1,11 @@ -set(libprotobuf_files - ${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_full.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/source_context.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/substitute.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/datapiece.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/error_listener.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/field_mask_utility.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_escaping.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_writer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/proto_writer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectsource.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectwriter.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/utility.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.cc -) +# CMake definitions for libprotobuf (the "full" C++ protobuf runtime). -set(libprotobuf_includes - ${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/field_access_listener.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_reflection.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_inl.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/message.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/source_context.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.h -) +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) add_library(libprotobuf ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${protobuf_version_rc_file}) + ${libprotobuf_srcs} + ${libprotobuf_hdrs} + ${protobuf_version_rc_file}) if(protobuf_HAVE_LD_VERSION_SCRIPT) if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map) @@ -111,9 +16,6 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT) LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map) endif() target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT}) -target_include_directories(libprotobuf - PRIVATE ${ABSL_ROOT_DIR} -) if(protobuf_WITH_ZLIB) target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES}) endif() diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake index 7506b0220..72b4a1abb 100644 --- a/cmake/libprotoc.cmake +++ b/cmake/libprotoc.cmake @@ -1,117 +1,11 @@ -set(libprotoc_files - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/enum.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/enum_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/extension.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/file.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/padding_optimizer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/parse_function_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/primitive_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/service.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/string_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_enum.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_field_base.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_message_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/context.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/extension.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/extension_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/file.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator_factory.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/kotlin_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/map_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_builder.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_builder_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/primitive_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/primitive_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/service.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/shared_code_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/string_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/string_field_lite.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_file.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_message.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/php_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/helpers.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/pyi_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/subprocess.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/zip_writer.cc -) +# CMake definitions for libprotoc (the protobuf compiler library). -set(libprotoc_headers - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/file.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/names.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_names.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_options.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/kotlin_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/php_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/pyi_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/python_generator.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator.h -) +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) add_library(libprotoc ${protobuf_SHARED_OR_STATIC} - ${libprotoc_files} ${libprotoc_headers} ${protobuf_version_rc_file}) + ${libprotoc_srcs} + ${libprotoc_hdrs} + ${protobuf_version_rc_file}) if(protobuf_HAVE_LD_VERSION_SCRIPT) if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) target_link_options(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map) @@ -122,9 +16,6 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT) LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map) endif() target_link_libraries(libprotoc PRIVATE libprotobuf) -target_include_directories(libprotoc - PRIVATE ${ABSL_ROOT_DIR} -) if(protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotoc PUBLIC PROTOBUF_USE_DLLS diff --git a/examples/AddPerson.java b/examples/AddPerson.java index 2f6a2313f..83971ab49 100644 --- a/examples/AddPerson.java +++ b/examples/AddPerson.java @@ -1,4 +1,4 @@ -// See README.txt for information and build instructions. +// See README.md for information and build instructions. import com.example.tutorial.protos.AddressBook; import com.example.tutorial.protos.Person; diff --git a/examples/ListPeople.java b/examples/ListPeople.java index ab07b7914..d0e037a86 100644 --- a/examples/ListPeople.java +++ b/examples/ListPeople.java @@ -1,4 +1,4 @@ -// See README.txt for information and build instructions. +// See README.md for information and build instructions. import com.example.tutorial.protos.AddressBook; import com.example.tutorial.protos.Person; diff --git a/examples/Makefile b/examples/Makefile index 1c7ec8d63..1ed7f67fd 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,4 +1,4 @@ -# See README.txt. +# See README.md. .PHONY: all cpp java python clean diff --git a/examples/add_person.cc b/examples/add_person.cc index 856e90bb7..d54d0f133 100644 --- a/examples/add_person.cc +++ b/examples/add_person.cc @@ -1,4 +1,4 @@ -// See README.txt for information and build instructions. +// See README.md for information and build instructions. #include #include diff --git a/examples/add_person.py b/examples/add_person.py index aa0fbca73..aa53d58ed 100755 --- a/examples/add_person.py +++ b/examples/add_person.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -# See README.txt for information and build instructions. +# See README.md for information and build instructions. import addressbook_pb2 import sys diff --git a/examples/addressbook.proto b/examples/addressbook.proto index 1bff4ad3b..5f526980d 100644 --- a/examples/addressbook.proto +++ b/examples/addressbook.proto @@ -1,4 +1,4 @@ -// See README.txt for information and build instructions. +// See README.md for information and build instructions. // // Note: START and END tags are used in comments to define sections used in // tutorials. They are not part of the syntax for Protocol Buffers. diff --git a/examples/list_people.cc b/examples/list_people.cc index b309c5968..6f0cf20aa 100644 --- a/examples/list_people.cc +++ b/examples/list_people.cc @@ -1,4 +1,4 @@ -// See README.txt for information and build instructions. +// See README.md for information and build instructions. #include #include diff --git a/examples/list_people.py b/examples/list_people.py index d2c294c6f..98a08eda1 100755 --- a/examples/list_people.py +++ b/examples/list_people.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -# See README.txt for information and build instructions. +# See README.md for information and build instructions. from __future__ import print_function import addressbook_pb2 diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java index f13a94523..3cf98162f 100644 --- a/java/core/src/main/java/com/google/protobuf/ByteString.java +++ b/java/core/src/main/java/com/google/protobuf/ByteString.java @@ -1129,13 +1129,6 @@ public abstract class ByteString implements Iterable, Serializable { return ByteString.copyFrom(flushedBuffers); } - /** Implement java.util.Arrays.copyOf() for jdk 1.5. */ - private byte[] copyArray(byte[] buffer, int length) { - byte[] result = new byte[length]; - System.arraycopy(buffer, 0, result, 0, Math.min(buffer.length, length)); - return result; - } - /** * Writes the complete contents of this byte array output stream to the specified output stream * argument. @@ -1158,7 +1151,7 @@ public abstract class ByteString implements Iterable, Serializable { byteString.writeTo(out); } - out.write(copyArray(cachedBuffer, cachedBufferPos)); + out.write(Arrays.copyOf(cachedBuffer, cachedBufferPos)); } /** @@ -1209,7 +1202,7 @@ public abstract class ByteString implements Iterable, Serializable { private void flushLastBuffer() { if (bufferPos < buffer.length) { if (bufferPos > 0) { - byte[] bufferCopy = copyArray(buffer, bufferPos); + byte[] bufferCopy = Arrays.copyOf(buffer, bufferPos); flushedBuffers.add(new LiteralByteString(bufferCopy)); } // We reuse this buffer for further writes. diff --git a/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java b/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java index fdeccc2f4..bb73a6b36 100644 --- a/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java +++ b/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java @@ -34,6 +34,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static java.lang.Math.min; +import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -48,52 +49,6 @@ import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class SmallSortedMapTest { - // java.util.AbstractMap.SimpleEntry is private in JDK 1.5. We re-implement it - // here for JDK 1.5 users. - private static class SimpleEntry implements Map.Entry { - private final K key; - private V value; - - SimpleEntry(K key, V value) { - this.key = key; - this.value = value; - } - - @Override - public K getKey() { - return key; - } - - @Override - public V getValue() { - return value; - } - - @Override - public V setValue(V value) { - V oldValue = this.value; - this.value = value; - return oldValue; - } - - private static boolean eq(Object o1, Object o2) { - return o1 == null ? o2 == null : o1.equals(o2); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) { - return false; - } - Map.Entry e = (Map.Entry) o; - return eq(key, e.getKey()) && eq(value, e.getValue()); - } - - @Override - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode()); - } - } @Test public void testPutAndGetArrayEntriesOnly() { @@ -242,8 +197,8 @@ public class SmallSortedMapTest { } Set> entrySet = map.entrySet(); for (int i = 0; i < 6; i++) { - assertThat(entrySet).contains(new SimpleEntry(i, i + 1)); - assertThat(entrySet).doesNotContain(new SimpleEntry(i, i)); + assertThat(entrySet).contains(new AbstractMap.SimpleEntry(i, i + 1)); + assertThat(entrySet).doesNotContain(new AbstractMap.SimpleEntry(i, i)); } } @@ -252,7 +207,7 @@ public class SmallSortedMapTest { SmallSortedMap map = SmallSortedMap.newInstanceForTest(3); Set> entrySet = map.entrySet(); for (int i = 0; i < 6; i++) { - Map.Entry entry = new SimpleEntry<>(i, i + 1); + Map.Entry entry = new AbstractMap.SimpleEntry<>(i, i + 1); assertThat(entrySet.add(entry)).isTrue(); assertThat(entrySet.add(entry)).isFalse(); } @@ -272,7 +227,7 @@ public class SmallSortedMapTest { assertThat(map.put(i, i + 1)).isNull(); } for (int i = 0; i < 6; i++) { - Map.Entry entry = new SimpleEntry<>(i, i + 1); + Map.Entry entry = new AbstractMap.SimpleEntry<>(i, i + 1); assertThat(entrySet.remove(entry)).isTrue(); assertThat(entrySet.remove(entry)).isFalse(); } diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc index 66703da89..5e61dbf6b 100644 --- a/python/google/protobuf/pyext/extension_dict.cc +++ b/python/google/protobuf/pyext/extension_dict.cc @@ -125,8 +125,9 @@ static void DeallocExtensionIterator(PyObject* _self) { ExtensionIterator* self = reinterpret_cast(_self); self->fields.clear(); Py_XDECREF(self->extension_dict); + freefunc tp_free = Py_TYPE(_self)->tp_free; self->~ExtensionIterator(); - Py_TYPE(_self)->tp_free(_self); + (*tp_free)(_self); } PyObject* subscript(ExtensionDict* self, PyObject* key) { diff --git a/src/Makefile.am b/src/Makefile.am index e4a0a2b60..f88b75e6f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ else PTHREAD_DEF = endif -PROTOBUF_VERSION = 32:0:0 +PROTOBUF_VERSION = 32:1:0 if GCC # Turn on all warnings except for sign comparison (we ignore sign comparison @@ -542,6 +542,7 @@ EXTRA_DIST = \ $(protoc_inputs) \ BUILD.bazel \ README.md \ + file_lists.cmake \ google/protobuf/BUILD.bazel \ google/protobuf/compiler/BUILD.bazel \ google/protobuf/compiler/cpp/BUILD.bazel \ diff --git a/src/google/protobuf/arenastring.cc b/src/google/protobuf/arenastring.cc index 4dce6df08..d6bef1b27 100644 --- a/src/google/protobuf/arenastring.cc +++ b/src/google/protobuf/arenastring.cc @@ -125,11 +125,14 @@ void ArenaStringPtr::Set(ConstStringParam value, Arena* arena) { } else { #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING if (arena == nullptr) { - Destroy(); + GOOGLE_DCHECK(tagged_ptr_.IsAllocated()); + auto* old = tagged_ptr_.Get(); tagged_ptr_ = CreateString(value); + delete old; } else { - UnsafeMutablePointer()->assign("garbagedata"); + auto* old = UnsafeMutablePointer(); tagged_ptr_ = CreateArenaString(*arena, value); + old->assign("garbagedata"); } #else // PROTOBUF_FORCE_COPY_DEFAULT_STRING UnsafeMutablePointer()->assign(value.data(), value.length()); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc index 50b4285ad..53efded1c 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -145,9 +145,9 @@ FileGenerator::CommonState::CollectMinimalFileDepsContainingExtensionsInternal( return it->second; } - std::set min_deps_collector; - std::set covered_deps_collector; - std::set to_prune; + std::unordered_set min_deps_collector; + std::unordered_set covered_deps_collector; + std::unordered_set to_prune; for (int i = 0; i < file->dependency_count(); i++) { const FileDescriptor* dep = file->dependency(i); MinDepsEntry dep_info = @@ -180,7 +180,7 @@ FileGenerator::CommonState::CollectMinimalFileDepsContainingExtensionsInternal( {file, {file_has_exts, min_deps_collector, covered_deps_collector}}).first->second; } - std::set min_deps; + std::unordered_set min_deps; std::copy_if(min_deps_collector.begin(), min_deps_collector.end(), std::inserter(min_deps, min_deps.end()), [&](const FileDescriptor* value){ @@ -202,7 +202,7 @@ FileGenerator::CommonState::CollectMinimalFileDepsContainingExtensionsInternal( const std::vector FileGenerator::CommonState::CollectMinimalFileDepsContainingExtensions( const FileDescriptor* file) { - std::set min_deps = + std::unordered_set min_deps = CollectMinimalFileDepsContainingExtensionsInternal(file).min_deps; // Sort the list since pointer order isn't stable across runs. std::vector result(min_deps.begin(), min_deps.end()); diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.h b/src/google/protobuf/compiler/objectivec/objectivec_file.h index ef49cf8a7..5db8f6747 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_file.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_file.h @@ -71,13 +71,13 @@ class FileGenerator { private: struct MinDepsEntry { bool has_extensions; - std::set min_deps; + std::unordered_set min_deps; // `covered_deps` are the transtive deps of `min_deps_w_exts` that also // have extensions. - std::set covered_deps; + std::unordered_set covered_deps; }; const MinDepsEntry& CollectMinimalFileDepsContainingExtensionsInternal(const FileDescriptor* file); - std::map deps_info_cache_; + std::unordered_map deps_info_cache_; }; FileGenerator(const FileDescriptor* file, diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 1c497d805..a4ce84c55 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -83,7 +83,7 @@ bool BoolFromEnvVar(const char* env_var, bool default_value) { class SimpleLineCollector : public LineConsumer { public: - SimpleLineCollector(std::unordered_set* inout_set) + explicit SimpleLineCollector(std::unordered_set* inout_set) : set_(inout_set) {} virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override { diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc index 7ae6a9275..736111dd6 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc @@ -244,7 +244,7 @@ TEST(ObjCHelperDeathTest, TextFormatDecodeData_Failures) { class TestLineCollector : public LineConsumer { public: - TestLineCollector(std::vector* inout_lines, + explicit TestLineCollector(std::vector* inout_lines, const std::string* reject_line = nullptr, bool skip_msg = false) : lines_(inout_lines), reject_(reject_line), skip_msg_(skip_msg) {} diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index 7d1b699d4..2e0b8098b 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -72,18 +72,15 @@ class DefaultEmptyOneof; class ExtensionSet; // extension_set.h class WeakFieldMap; // weak_field_map.h -enum { - // Tag used on offsets for fields that don't have a real offset. - // For example, weak message fields go into the WeakFieldMap and not in an - // actual field. - kInvalidFieldOffsetTag = 0x40000000u, +// Tag used on offsets for fields that don't have a real offset. +// For example, weak message fields go into the WeakFieldMap and not in an +// actual field. +constexpr uint32_t kInvalidFieldOffsetTag = 0x40000000u; - // Mask used on offsets for split fields. - kSplitFieldOffsetMask = 0x80000000u, - - kLazyMask = 0x1u, - kInlinedMask = 0x1u, -}; +// Mask used on offsets for split fields. +constexpr uint32_t kSplitFieldOffsetMask = 0x80000000u; +constexpr uint32_t kLazyMask = 0x1u; +constexpr uint32_t kInlinedMask = 0x1u; // This struct describes the internal layout of the message, hence this is // used to act on the message reflectively.