Skip to content

Commit 4f6559b

Browse files
committed
protobuf: upgrade to ver 3.11
1 parent 8ccabb0 commit 4f6559b

File tree

684 files changed

+134842
-114063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

684 files changed

+134842
-114063
lines changed

cdk/cmake/DepFindProtobuf.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ add_library(Protobuf::pb-full STATIC IMPORTED GLOBAL)
172172
add_library(Protobuf::pb-lite STATIC IMPORTED GLOBAL)
173173
add_executable(Protobuf::protoc IMPORTED GLOBAL)
174174

175-
set(TGT_protobuf Protobuf::pb-full)
176-
set(TGT_protobuf-lite Protobuf::pb-lite)
175+
set(TGT_libprotobuf Protobuf::pb-full)
176+
set(TGT_libprotobuf-lite Protobuf::pb-lite)
177177
set(TGT_protoc Protobuf::protoc)
178178

179-
foreach(tgt protobuf protobuf-lite protoc)
179+
foreach(tgt libprotobuf libprotobuf-lite protoc)
180180

181181
#message("processing: ${tgt}")
182182

@@ -317,7 +317,6 @@ function(mysqlx_protobuf_generate_cpp SRCS HDRS)
317317
COMMAND Protobuf::protoc
318318
ARGS --cpp_out "${CMAKE_CURRENT_BINARY_DIR}/protobuf"
319319
-I ${ABS_PATH} ${ABS_FIL}
320-
--proto_path=${PROJECT_SOURCE_DIR}/protobuf/protobuf-3.6.1/src
321320
DEPENDS ${ABS_FIL} #${PROTOBUF_PROTOC_EXECUTABLE}
322321
COMMENT "Running C++ protocol buffer compiler on ${FIL}"
323322
VERBATIM

cdk/protobuf/CMakeLists.txt

Lines changed: 37 additions & 263 deletions
Original file line numberDiff line numberDiff line change
@@ -20,52 +20,51 @@
2020
# along with this program; if not, write to the Free Software
2121
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222

23-
# The files in protobuf-3.6.1/ are almost unmodified versions of google
24-
# source files taken from protobuf-cpp-3.6.1.tar.gz archive.
23+
# The files in protobuf-3.11.4/ are almost unmodified versions of google
24+
# source files taken from protobuf-cpp-3.11.4.tar.gz archive.
2525
# Changes:
2626
# - remove directories and files
27-
# protobuf-3.6.1/benchmarks/
28-
# protobuf-3.6.1/conformance/
29-
# protobuf-3.6.1/editors/
30-
# protobuf-3.6.1/examples/
31-
# protobuf-3.6.1/objectivec/
32-
# protobuf-3.6.1/third_party/
33-
# protobuf-3.6.1/python/
34-
# protobuf-3.6.1/util/
35-
# protobuf-3.6.1/ar-lib
36-
# protobuf-3.6.1/test-driver
27+
# protobuf-3.11.4/benchmarks/
28+
# protobuf-3.11.4/conformance/
29+
# protobuf-3.11.4/editors/
30+
# protobuf-3.11.4/examples/
31+
# protobuf-3.11.4/m4/
32+
# protobuf-3.11.4/objectivec/
33+
# protobuf-3.11.4/python/
34+
# protobuf-3.11.4/third_party/
35+
# protobuf-3.11.4/util/
36+
# protobuf-3.11.4/ar-lib
37+
# protobuf-3.11.4/compile
38+
# protobuf-3.11.4/config.guess
39+
# protobuf-3.11.4/config.h.in
40+
# protobuf-3.11.4/config.sub
41+
# protobuf-3.11.4/configure
42+
# protobuf-3.11.4/depcomp
43+
# protobuf-3.11.4/install-sh
44+
# protobuf-3.11.4/ltmain.sh
45+
# protobuf-3.11.4/missing
46+
# protobuf-3.11.4/test-driver
47+
# protobuf-3.11.4/update_file_lists.sh
3748
# - disable configuration check of cmake's mimimum version
3849
# - disable configuration zlib check
3950
# - disable installation script
4051
# - fix minor compilation issues on SunPro 5.14.0
41-
# - fix minor issues to satisfy UBSAN
4252

4353

44-
cmake_minimum_required(VERSION 2.8)
54+
cmake_minimum_required(VERSION 3.1)
4555
PROJECT(Protobuf)
4656

4757
include(../cmake/setup.cmake)
4858
include(platform)
4959

50-
#
51-
# Create empty config.h as Protobuf code includes it.
52-
# TODO: Put some meaningful configuration there.
53-
#
54-
55-
file(WRITE ${PROJECT_BINARY_DIR}/config.h "\n")
60+
SET(PROTO_SRC_DIR "${PROJECT_SOURCE_DIR}/protobuf-3.11.4")
5661

5762
#
5863
# Produce position independent code.
5964
# Note: This is crucial on Solaris
6065
#
6166

6267
enable_pic()
63-
enable_cxx11()
64-
65-
66-
if(SUNPRO)
67-
set_arch_m64()
68-
endif()
6968

7069
#
7170
# Do not export any symbols
@@ -75,261 +74,36 @@ endif()
7574

7675
set_visibility(hidden)
7776

78-
79-
#
80-
# Solaris compile and link settings
81-
#
82-
83-
if(SUNPRO)
84-
85-
add_definitions(-DSOLARIS_64BIT_ENABLED)
86-
87-
if(SPARC)
88-
add_definitions(-DGOOGLE_PROTOBUF_ARCH_SPARC)
89-
endif()
90-
77+
if(NOT MSVC)
78+
add_compile_options(-Wno-stringop-overflow)
9179
endif()
9280

93-
9481
#
9582
# Configure static runtime library on Windows if requested
9683
#
9784

9885
OPTION(STATIC_MSVCRT "Use static MSVC runtime library" OFF)
86+
SET(protobuf_MSVC_STATIC_RUNTIME ${STATIC_MSVCRT} CACHE INTERNAL "")
9987

100-
IF(WIN32 AND STATIC_MSVCRT)
101-
102-
message("Using static runtime library")
103-
set_msvcrt(static)
104-
105-
ENDIF()
106-
107-
108-
#
109-
# Dependency on threads library.
110-
#
111-
# TODO: Use DepFind* instead?
112-
#
113-
114-
INCLUDE(FindThreads)
115-
IF(CMAKE_USE_PTHREADS_INIT)
116-
message("Using pthreads for protobuf code")
117-
ADD_DEFINITIONS(-DHAVE_PTHREAD)
118-
ENDIF()
119-
120-
121-
#
122-
# Skip compression support for now.
123-
#
124-
125-
set(HAVE_ZLIB 0)
126-
ADD_DEFINITIONS(-DHAVE_ZLIB=${HAVE_ZLIB})
127-
128-
129-
#
130-
# Turn off some warning flags when compiling protobuf.
131-
#
132-
133-
134-
if(GCC OR CLANG)
135-
136-
add_compile_options(
137-
-Wno-sign-compare
138-
-Wno-ignored-qualifiers
139-
-Wno-return-type
140-
-Wno-unused-function
141-
-Wno-unused-local-typedefs
142-
-Wno-unused-local-typedefs
143-
)
144-
145-
endif()
146-
147-
if(GCC)
148-
149-
add_compile_options(
150-
-Wno-maybe-uninitialized
151-
-Wno-unused-but-set-parameter
152-
)
15388

154-
endif()
155-
156-
if(APPLE)
157-
158-
# Our version of protobuf uses many constructs (mainly atomic ops)
159-
# which were depracated in OSX 10.12.
160-
# TODO: Upgrade bundled protobuf
161-
162-
add_compile_options(-Wno-deprecated-declarations)
163-
164-
endif()
165-
166-
if(MSVC)
167-
168-
add_compile_options(
169-
/wd4018
170-
/wd4996
171-
/wd4244
172-
/wd4715
173-
/wd4065
174-
/wd4800
175-
/wd4355
176-
/wd4267
177-
/wd4506
178-
/wd4146
179-
)
180-
181-
endif()
182-
183-
if(SUNPRO)
184-
185-
# Option -erroff disables only warnings, actually. This option requires
186-
# a warning tag, which is printed if -errtags option is enabled.
187-
188-
add_compile_options(
189-
-errtags=yes
190-
-erroff=anonnotype
191-
)
192-
193-
endif()
194-
195-
196-
#
197-
# Define Protobuf targets.
198-
#
89+
SET(protobuf_BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
90+
SET(protobuf_BUILD_TESTS OFF CACHE INTERNAL "")
91+
SET(protobuf_BUILD_EXAMPLES OFF CACHE INTERNAL "")
92+
SET(protobuf_WITH_ZLIB OFF CACHE INTERNAL "")
19993

94+
ADD_SUBDIRECTORY(${PROTO_SRC_DIR}/cmake)
20095

201-
SET(PROTO_SRC_DIR
202-
"${PROJECT_SOURCE_DIR}/protobuf-3.6.1/src")
203-
96+
# Export targets
20497

20598
file(WRITE "${PROJECT_BINARY_DIR}/exports.cmake"
206-
"set(PROTOBUF_INCLUDE_DIR \"${PROTO_SRC_DIR}\")\n\n"
99+
"set(PROTOBUF_INCLUDE_DIR \"${PROTO_SRC_DIR}/src\")\n\n"
207100
)
208101

209102
macro(pb_export)
210103
export(TARGETS ${ARGV} NAMESPACE pb_
211104
APPEND FILE "${PROJECT_BINARY_DIR}/exports.cmake")
212105
endmacro()
213106

214-
INCLUDE_DIRECTORIES(
215-
${PROJECT_BINARY_DIR}
216-
${PROTO_SRC_DIR}
217-
${ZLIB_INCLUDE_DIR}
218-
)
219-
220-
221-
SET(LIBPROTOBUF_LITE_SOURCES
222-
${PROTO_SRC_DIR}/google/protobuf/stubs/common.cc
223-
${PROTO_SRC_DIR}/google/protobuf/stubs/hash.h
224-
${PROTO_SRC_DIR}/google/protobuf/stubs/int128.cc
225-
${PROTO_SRC_DIR}/google/protobuf/stubs/io_win32.cc
226-
${PROTO_SRC_DIR}/google/protobuf/stubs/map_util.h
227-
${PROTO_SRC_DIR}/google/protobuf/stubs/status.cc
228-
${PROTO_SRC_DIR}/google/protobuf/stubs/stringpiece.cc
229-
${PROTO_SRC_DIR}/google/protobuf/stubs/stringprintf.cc
230-
${PROTO_SRC_DIR}/google/protobuf/stubs/stringprintf.h
231-
${PROTO_SRC_DIR}/google/protobuf/stubs/structurally_valid.cc
232-
${PROTO_SRC_DIR}/google/protobuf/arena.cc
233-
${PROTO_SRC_DIR}/google/protobuf/extension_set.cc
234-
${PROTO_SRC_DIR}/google/protobuf/generated_message_util.cc
235-
${PROTO_SRC_DIR}/google/protobuf/message_lite.cc
236-
${PROTO_SRC_DIR}/google/protobuf/repeated_field.cc
237-
${PROTO_SRC_DIR}/google/protobuf/wire_format_lite.cc
238-
${PROTO_SRC_DIR}/google/protobuf/io/coded_stream.cc
239-
${PROTO_SRC_DIR}/google/protobuf/io/coded_stream_inl.h
240-
${PROTO_SRC_DIR}/google/protobuf/io/zero_copy_stream.cc
241-
${PROTO_SRC_DIR}/google/protobuf/io/zero_copy_stream_impl_lite.cc
242-
${PROTO_SRC_DIR}/google/protobuf/implicit_weak_message.cc
243-
)
244-
245-
ADD_LIBRARY(protobuf-lite STATIC ${LIBPROTOBUF_LITE_SOURCES})
246-
SET_PROPERTY(TARGET protobuf-lite PROPERTY EXCLUDE_FROM_ALL TRUE)
247-
pb_export(protobuf-lite)
248-
249-
SET(LIBPROTOBUF_SOURCES
250-
${PROTO_SRC_DIR}/google/protobuf/any.cc
251-
252-
${PROTO_SRC_DIR}/google/protobuf/stubs/strutil.cc
253-
${PROTO_SRC_DIR}/google/protobuf/stubs/strutil.h
254-
${PROTO_SRC_DIR}/google/protobuf/stubs/substitute.cc
255-
${PROTO_SRC_DIR}/google/protobuf/stubs/substitute.h
256-
257-
${PROTO_SRC_DIR}/google/protobuf/stubs/structurally_valid.cc
258-
${PROTO_SRC_DIR}/google/protobuf/descriptor.cc
259-
${PROTO_SRC_DIR}/google/protobuf/descriptor.pb.cc
260-
${PROTO_SRC_DIR}/google/protobuf/descriptor_database.cc
261-
${PROTO_SRC_DIR}/google/protobuf/dynamic_message.cc
262-
${PROTO_SRC_DIR}/google/protobuf/extension_set_heavy.cc
263-
${PROTO_SRC_DIR}/google/protobuf/generated_message_reflection.cc
264-
${PROTO_SRC_DIR}/google/protobuf/map_field.cc
265-
${PROTO_SRC_DIR}/google/protobuf/message.cc
266-
${PROTO_SRC_DIR}/google/protobuf/reflection_ops.cc
267-
${PROTO_SRC_DIR}/google/protobuf/service.cc
268-
${PROTO_SRC_DIR}/google/protobuf/text_format.cc
269-
${PROTO_SRC_DIR}/google/protobuf/unknown_field_set.cc
270-
${PROTO_SRC_DIR}/google/protobuf/wire_format.cc
271-
${PROTO_SRC_DIR}/google/protobuf/io/printer.cc
272-
${PROTO_SRC_DIR}/google/protobuf/io/strtod.cc
273-
${PROTO_SRC_DIR}/google/protobuf/io/tokenizer.cc
274-
${PROTO_SRC_DIR}/google/protobuf/io/zero_copy_stream_impl.cc
275-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_map_field.cc
276-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
277-
${PROTO_SRC_DIR}/google/protobuf/compiler/importer.cc
278-
${PROTO_SRC_DIR}/google/protobuf/compiler/parser.cc
279-
)
280-
281-
if(HAVE_ZLIB)
282-
LIST(APPEND LIBPROTOBUF_SOURCES
283-
${PROTO_SRC_DIR}/google/protobuf/io/gzip_stream.cc)
284-
endif()
285-
286-
ADD_LIBRARY(protobuf STATIC ${LIBPROTOBUF_SOURCES})
287-
TARGET_LINK_LIBRARIES(protobuf protobuf-lite
288-
${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARY} ${LIBRT})
289-
290-
pb_export(protobuf)
291-
292-
SET(LIBPROTOC_SOURCES
293-
${PROTO_SRC_DIR}/google/protobuf/compiler/code_generator.cc
294-
${PROTO_SRC_DIR}/google/protobuf/compiler/command_line_interface.cc
295-
${PROTO_SRC_DIR}/google/protobuf/compiler/plugin.cc
296-
${PROTO_SRC_DIR}/google/protobuf/compiler/plugin.pb.cc
297-
${PROTO_SRC_DIR}/google/protobuf/compiler/subprocess.cc
298-
${PROTO_SRC_DIR}/google/protobuf/compiler/subprocess.h
299-
${PROTO_SRC_DIR}/google/protobuf/compiler/zip_writer.cc
300-
${PROTO_SRC_DIR}/google/protobuf/compiler/zip_writer.h
301-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_enum.cc
302-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_enum.h
303-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_enum_field.cc
304-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_enum_field.h
305-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_extension.cc
306-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_extension.h
307-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_field.cc
308-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_field.h
309-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_file.cc
310-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_file.h
311-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_generator.cc
312-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_helpers.cc
313-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_helpers.h
314-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_message.cc
315-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_message.h
316-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_message_field.cc
317-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_message_field.h
318-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_options.h
319-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_primitive_field.cc
320-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_primitive_field.h
321-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_service.cc
322-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_service.h
323-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_string_field.cc
324-
${PROTO_SRC_DIR}/google/protobuf/compiler/cpp/cpp_string_field.h
325-
${PROTO_SRC_DIR}/google/protobuf/stubs/io_win32.cc
326-
)
327-
328-
ADD_LIBRARY(protoclib STATIC ${LIBPROTOC_SOURCES})
329-
TARGET_LINK_LIBRARIES(protoclib protobuf)
330-
331-
ADD_EXECUTABLE(protoc ${PROTO_SRC_DIR}/google/protobuf/compiler/main.cc)
332-
TARGET_COMPILE_DEFINITIONS(protoc PRIVATE OPENSOURCE_PROTOBUF_CPP_BOOTSTRAP)
333-
TARGET_LINK_LIBRARIES(protoc protoclib)
334-
107+
pb_export(libprotobuf-lite)
108+
pb_export(libprotobuf)
335109
pb_export(protoc)

0 commit comments

Comments
 (0)