20
20
# along with this program; if not, write to the Free Software
21
21
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
22
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.
25
25
# Changes:
26
26
# - 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
37
48
# - disable configuration check of cmake's mimimum version
38
49
# - disable configuration zlib check
39
50
# - disable installation script
40
51
# - fix minor compilation issues on SunPro 5.14.0
41
- # - fix minor issues to satisfy UBSAN
42
52
43
53
44
- cmake_minimum_required (VERSION 2.8 )
54
+ cmake_minimum_required (VERSION 3.1 )
45
55
PROJECT (Protobuf )
46
56
47
57
include (../cmake/setup.cmake )
48
58
include (platform )
49
59
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" )
56
61
57
62
#
58
63
# Produce position independent code.
59
64
# Note: This is crucial on Solaris
60
65
#
61
66
62
67
enable_pic ()
63
- enable_cxx11 ()
64
-
65
-
66
- if (SUNPRO )
67
- set_arch_m64 ()
68
- endif ()
69
68
70
69
#
71
70
# Do not export any symbols
@@ -75,261 +74,36 @@ endif()
75
74
76
75
set_visibility (hidden )
77
76
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 )
91
79
endif ()
92
80
93
-
94
81
#
95
82
# Configure static runtime library on Windows if requested
96
83
#
97
84
98
85
OPTION (STATIC_MSVCRT "Use static MSVC runtime library" OFF )
86
+ SET (protobuf_MSVC_STATIC_RUNTIME ${STATIC_MSVCRT} CACHE INTERNAL "" )
99
87
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
- )
153
88
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 "" )
199
93
94
+ ADD_SUBDIRECTORY (${PROTO_SRC_DIR} /cmake )
200
95
201
- SET (PROTO_SRC_DIR
202
- "${PROJECT_SOURCE_DIR} /protobuf-3.6.1/src" )
203
-
96
+ # Export targets
204
97
205
98
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 "
207
100
)
208
101
209
102
macro (pb_export )
210
103
export (TARGETS ${ARGV} NAMESPACE pb_
211
104
APPEND FILE "${PROJECT_BINARY_DIR} /exports.cmake" )
212
105
endmacro ()
213
106
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 )
335
109
pb_export (protoc )
0 commit comments