3 include(CheckIncludeFiles)
6 add_definitions(-DHAVE_PTHREAD=1)
10 add_definitions( -D_CRT_SECURE_NO_WARNINGS=1 )
11 ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146
12 /wd4305 /wd4127 /wd4100 /wd4512 /wd4125 /wd4389 /wd4510 /wd4610
13 /wd4702 /wd4456 /wd4457 /wd4065 /wd4310 /wd4661 /wd4506
16 ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated -Wmissing-prototypes -Wmissing-declarations -Wshadow
17 -Wunused-parameter -Wunused-local-typedefs -Wsign-compare -Wsign-promo
18 -Wundef -Wtautological-undefined-compare -Wignored-qualifiers -Wextra
19 -Wunused-function -Wunused-const-variable -Wshorten-64-to-32
23 ocv_warnings_disable(CMAKE_CXX_FLAGS
24 -wd265 -wd858 -wd873 -wd2196
28 # Easier to support different versions of protobufs
29 function(append_if_exist OUTPUT_LIST)
33 list(APPEND ${OUTPUT_LIST} "${fil}")
35 message(WARNING "file missing: ${fil}")
38 set(${OUTPUT_LIST} ${${OUTPUT_LIST}} PARENT_SCOPE)
41 set(PROTOBUF_ROOT "${CMAKE_CURRENT_LIST_DIR}")
44 set(ATOMICOPS_INTERNALS ${PROTOBUF_ROOT}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc)
46 set(ATOMICOPS_INTERNALS ${PROTOBUF_ROOT}/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc)
50 append_if_exist(Protobuf_SRCS
52 ${PROTOBUF_ROOT}/src/google/protobuf/arena.cc
53 ${PROTOBUF_ROOT}/src/google/protobuf/arenastring.cc
54 ${PROTOBUF_ROOT}/src/google/protobuf/extension_set.cc
55 ${PROTOBUF_ROOT}/src/google/protobuf/generated_message_util.cc
56 ${PROTOBUF_ROOT}/src/google/protobuf/io/coded_stream.cc
57 ${PROTOBUF_ROOT}/src/google/protobuf/io/zero_copy_stream.cc
58 ${PROTOBUF_ROOT}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
59 ${PROTOBUF_ROOT}/src/google/protobuf/message_lite.cc
60 ${PROTOBUF_ROOT}/src/google/protobuf/repeated_field.cc
61 ${ATOMICOPS_INTERNALS}
62 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/bytestream.cc
63 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/common.cc
64 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/int128.cc
65 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/once.cc
66 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/status.cc
67 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/statusor.cc
68 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/stringpiece.cc
69 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/stringprintf.cc
70 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/structurally_valid.cc
71 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/strutil.cc
72 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/time.cc
73 ${PROTOBUF_ROOT}/src/google/protobuf/wire_format_lite.cc
75 ${PROTOBUF_ROOT}/src/google/protobuf/any.cc
76 ${PROTOBUF_ROOT}/src/google/protobuf/any.pb.cc
77 ${PROTOBUF_ROOT}/src/google/protobuf/api.pb.cc
78 # ${PROTOBUF_ROOT}/src/google/protobuf/compiler/importer.cc
79 # ${PROTOBUF_ROOT}/src/google/protobuf/compiler/parser.cc
80 ${PROTOBUF_ROOT}/src/google/protobuf/descriptor.cc
81 ${PROTOBUF_ROOT}/src/google/protobuf/descriptor.pb.cc
82 ${PROTOBUF_ROOT}/src/google/protobuf/descriptor_database.cc
83 ${PROTOBUF_ROOT}/src/google/protobuf/duration.pb.cc
84 ${PROTOBUF_ROOT}/src/google/protobuf/dynamic_message.cc
85 ${PROTOBUF_ROOT}/src/google/protobuf/empty.pb.cc
86 ${PROTOBUF_ROOT}/src/google/protobuf/extension_set_heavy.cc
87 ${PROTOBUF_ROOT}/src/google/protobuf/field_mask.pb.cc
88 ${PROTOBUF_ROOT}/src/google/protobuf/generated_message_reflection.cc
89 ${PROTOBUF_ROOT}/src/google/protobuf/io/gzip_stream.cc
90 ${PROTOBUF_ROOT}/src/google/protobuf/io/printer.cc
91 ${PROTOBUF_ROOT}/src/google/protobuf/io/strtod.cc
92 ${PROTOBUF_ROOT}/src/google/protobuf/io/tokenizer.cc
93 ${PROTOBUF_ROOT}/src/google/protobuf/io/zero_copy_stream_impl.cc
94 ${PROTOBUF_ROOT}/src/google/protobuf/map_field.cc
95 ${PROTOBUF_ROOT}/src/google/protobuf/message.cc
96 ${PROTOBUF_ROOT}/src/google/protobuf/reflection_ops.cc
97 ${PROTOBUF_ROOT}/src/google/protobuf/service.cc
98 ${PROTOBUF_ROOT}/src/google/protobuf/source_context.pb.cc
99 ${PROTOBUF_ROOT}/src/google/protobuf/struct.pb.cc
100 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/mathlimits.cc
101 ${PROTOBUF_ROOT}/src/google/protobuf/stubs/substitute.cc
102 ${PROTOBUF_ROOT}/src/google/protobuf/text_format.cc
103 ${PROTOBUF_ROOT}/src/google/protobuf/timestamp.pb.cc
104 ${PROTOBUF_ROOT}/src/google/protobuf/type.pb.cc
105 ${PROTOBUF_ROOT}/src/google/protobuf/unknown_field_set.cc
106 ${PROTOBUF_ROOT}/src/google/protobuf/util/field_comparator.cc
107 ${PROTOBUF_ROOT}/src/google/protobuf/util/field_mask_util.cc
108 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/datapiece.cc
109 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/default_value_objectwriter.cc
110 # ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/error_listener.cc
111 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/field_mask_utility.cc
112 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/json_escaping.cc
113 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/json_objectwriter.cc
114 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/json_stream_parser.cc
115 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/object_writer.cc
116 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/proto_writer.cc
117 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/protostream_objectsource.cc
118 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/protostream_objectwriter.cc
119 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/type_info.cc
120 # ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/type_info_test_helper.cc
121 ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/utility.cc
122 ${PROTOBUF_ROOT}/src/google/protobuf/util/json_util.cc
123 ${PROTOBUF_ROOT}/src/google/protobuf/util/message_differencer.cc
124 ${PROTOBUF_ROOT}/src/google/protobuf/util/time_util.cc
125 ${PROTOBUF_ROOT}/src/google/protobuf/util/type_resolver_util.cc
126 ${PROTOBUF_ROOT}/src/google/protobuf/wire_format.cc
127 ${PROTOBUF_ROOT}/src/google/protobuf/wrappers.pb.cc
130 if(CMAKE_VERSION VERSION_LESS 2.8.9 AND UNIX)
131 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
134 add_library(libprotobuf STATIC ${Protobuf_SRCS})
135 ocv_include_directories(${PROTOBUF_ROOT}/src)
137 set_target_properties(libprotobuf
140 POSITION_INDEPENDENT_CODE 1 # CMake 2.8.9+
141 OUTPUT_NAME libprotobuf
142 DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
143 ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
146 if(NOT BUILD_SHARED_LIBS)
147 ocv_install_target(libprotobuf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)