Merge pull request #4000 from TheAifam5/protobuf

[protobuf] Update to 3.6.1
This commit is contained in:
Alexander Karatarakis 2018-08-07 12:08:29 -07:00 committed by GitHub
commit a37eb3ce57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 145 deletions

View File

@ -1,70 +0,0 @@
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 7618ba2..d282a60 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -165,8 +165,10 @@ endif (protobuf_UNICODE)
include(libprotobuf-lite.cmake)
include(libprotobuf.cmake)
-include(libprotoc.cmake)
-include(protoc.cmake)
+if(protobuf_BUILD_COMPILER)
+ include(libprotoc.cmake)
+ include(protoc.cmake)
+endif()
if (protobuf_BUILD_TESTS)
include(tests.cmake)
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 441bf55..20b3aa0 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -1,14 +1,17 @@
include(GNUInstallDirs)
+set(LIBRARIES_TO_SET_DEST libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+ list(APPEND LIBRARIES_TO_SET_DEST libprotoc)
+endif()
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY)
foreach(_library
- libprotobuf-lite
- libprotobuf
- libprotoc)
+ ${LIBRARIES_TO_SET_DEST})
set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${protobuf_source_dir}/src>
@@ -19,8 +22,10 @@ foreach(_library
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
endforeach()
-install(TARGETS protoc EXPORT protobuf-targets
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+if(protobuf_BUILD_COMPILER)
+ install(TARGETS protoc EXPORT protobuf-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
@@ -101,7 +106,12 @@ configure_file(protobuf-options.cmake
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
# Allows the build directory to be used as a find directory.
-export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
+set(FIND_DIRS libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+ list(APPEND FIND_DIRS libprotoc protoc)
+endif()
+
+export(TARGETS ${FIND_DIRS}
NAMESPACE protobuf::
FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
)

View File

@ -1,5 +1,5 @@
Source: protobuf
Version: 3.6.1
Version: 3.6.1-1
Description: Protocol Buffers - Google's data interchange format
Feature: zlib

View File

@ -1,13 +0,0 @@
diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h
index 4b1d90b..4c2b3ee 100644
--- a/src/google/protobuf/compiler/code_generator.h
+++ b/src/google/protobuf/compiler/code_generator.h
@@ -166,7 +166,7 @@ typedef GeneratorContext OutputDirectory;
// "foo=bar,baz,qux=corge"
// parses to the pairs:
// ("foo", "bar"), ("baz", ""), ("qux", "corge")
-void ParseGeneratorParameter(
+LIBPROTOC_EXPORT void ParseGeneratorParameter(
const string&, std::vector<std::pair<string, string> >*);
} // namespace compiler

View File

@ -1,25 +0,0 @@
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index 107c1c5..233bcf6 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -73,7 +73,7 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/well_known_types_embed.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
@@ -210,9 +210,9 @@ set(js_well_known_types_sources
)
add_executable(js_embed ${protobuf_source_dir}/src/google/protobuf/compiler/js/embed.cc)
add_custom_command(
- OUTPUT ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/well_known_types_embed.cc
DEPENDS js_embed ${js_well_known_types_sources}
- COMMAND js_embed ${js_well_known_types_sources} > ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
+ COMMAND "$<TARGET_FILE:js_embed>" ${js_well_known_types_sources} > ${CMAKE_CURRENT_BINARY_DIR}/well_known_types_embed.cc
)
add_library(libprotoc ${protobuf_SHARED_OR_STATIC}

View File

@ -7,7 +7,6 @@ vcpkg_from_github(
SHA512 1bc175d24b49de1b1e41eaf39598194e583afffb924c86c8d2e569d935af21874be76b2cbd4d9655a1d38bac3d4cd811de88bc2c72d81bad79115e69e5b0d839
HEAD_REF master
PATCHES
"${CMAKE_CURRENT_LIST_DIR}/js-embed.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch"
)

View File

@ -1,35 +0,0 @@
From 24493eef9395e5b832360e12efabf9c363c9cb15 Mon Sep 17 00:00:00 2001
From: Rodrigo Hernandez <kwizatz@aeongames.com>
Date: Mon, 4 Dec 2017 19:04:42 -0600
Subject: [PATCH] Using binary one's complement to negate an unsigned int
This removes a Visual Studio warning:
warning C4146: unary minus operator applied to unsigned type, result
still unsigned.
---
src/google/protobuf/wire_format_lite.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h
index cf614c02a4..361920b8ec 100644
--- a/src/google/protobuf/wire_format_lite.h
+++ b/src/google/protobuf/wire_format_lite.h
@@ -860,7 +860,7 @@ inline uint32 WireFormatLite::ZigZagEncode32(int32 n) {
inline int32 WireFormatLite::ZigZagDecode32(uint32 n) {
// Note: Using unsigned types prevent undefined behavior
- return static_cast<int32>((n >> 1) ^ -(n & 1));
+ return static_cast<int32>((n >> 1) ^ (~(n & 1) + 1));
}
inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
@@ -871,7 +871,7 @@ inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
inline int64 WireFormatLite::ZigZagDecode64(uint64 n) {
// Note: Using unsigned types prevent undefined behavior
- return static_cast<int64>((n >> 1) ^ -(n & 1));
+ return static_cast<int64>((n >> 1) ^ (~(n & 1) + 1));
}
// String is for UTF-8 text only, but, even so, ReadString() can simply