Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
e6f63c7a
Commit
e6f63c7a
authored
Jun 26, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1247 from alalek:protobuf_sources
parents
637e82dd
8f5c0e0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
229 deletions
+28
-229
CMakeLists.txt
modules/dnn/3rdparty/protobuf/CMakeLists.txt
+0
-151
CMakeLists.txt
modules/dnn/CMakeLists.txt
+28
-20
OpenCVFindLibProtobuf.cmake
modules/dnn/cmake/OpenCVFindLibProtobuf.cmake
+0
-58
No files found.
modules/dnn/3rdparty/protobuf/CMakeLists.txt
deleted
100644 → 0
View file @
637e82dd
project
(
libprotobuf
)
include
(
CheckIncludeFiles
)
if
(
NOT MSVC
)
check_include_files
(
"pthread.h"
HAVE_PTHREAD
)
if
(
HAVE_PTHREAD
)
add_definitions
(
-DHAVE_PTHREAD=1
)
endif
()
endif
()
if
(
MSVC
)
add_definitions
(
-D_CRT_SECURE_NO_WARNINGS=1
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS /wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146
/wd4305 /wd4127 /wd4100 /wd4512 /wd4125 /wd4389 /wd4510 /wd4610
/wd4702 /wd4456 /wd4457 /wd4065 /wd4310 /wd4661 /wd4506
)
else
()
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wno-deprecated -Wmissing-prototypes -Wmissing-declarations -Wshadow
-Wunused-parameter -Wunused-local-typedefs -Wsign-compare -Wsign-promo
-Wundef -Wtautological-undefined-compare -Wignored-qualifiers -Wextra
-Wunused-function -Wunused-const-variable
)
endif
()
if
(
CV_ICC
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS
-wd265 -wd858 -wd873 -wd2196
)
endif
()
# Easier to support different versions of protobufs
function
(
append_if_exist OUTPUT_LIST
)
set
(
${
OUTPUT_LIST
}
)
foreach
(
fil
${
ARGN
}
)
if
(
EXISTS
${
fil
}
)
list
(
APPEND
${
OUTPUT_LIST
}
"
${
fil
}
"
)
else
()
message
(
WARNING
"file missing:
${
fil
}
"
)
endif
()
endforeach
()
set
(
${
OUTPUT_LIST
}
${${
OUTPUT_LIST
}}
PARENT_SCOPE
)
endfunction
()
set
(
PROTOBUF_ROOT
"
${
PROTOBUF_CPP_ROOT
}
"
)
if
(
MSVC
)
set
(
ATOMICOPS_INTERNALS
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
)
else
()
set
(
ATOMICOPS_INTERNALS
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
)
endif
()
append_if_exist
(
PROTOBUF_SRCS
# libprotobuf-lite
${
PROTOBUF_ROOT
}
/src/google/protobuf/arena.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/arenastring.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/extension_set.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/generated_message_util.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/coded_stream.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/zero_copy_stream.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/message_lite.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/repeated_field.cc
${
ATOMICOPS_INTERNALS
}
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/bytestream.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/common.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/int128.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/once.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/status.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/statusor.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/stringpiece.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/stringprintf.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/structurally_valid.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/strutil.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/time.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/wire_format_lite.cc
# libprotobuf
${
PROTOBUF_ROOT
}
/src/google/protobuf/any.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/any.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/api.pb.cc
# ${PROTOBUF_ROOT}/src/google/protobuf/compiler/importer.cc
# ${PROTOBUF_ROOT}/src/google/protobuf/compiler/parser.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/descriptor.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/descriptor.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/descriptor_database.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/duration.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/dynamic_message.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/empty.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/extension_set_heavy.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/field_mask.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/generated_message_reflection.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/gzip_stream.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/printer.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/strtod.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/tokenizer.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/io/zero_copy_stream_impl.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/map_field.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/message.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/reflection_ops.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/service.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/source_context.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/struct.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/mathlimits.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/stubs/substitute.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/text_format.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/timestamp.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/type.pb.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/unknown_field_set.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/field_comparator.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/field_mask_util.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/datapiece.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/default_value_objectwriter.cc
# ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/error_listener.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/field_mask_utility.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/json_escaping.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/json_objectwriter.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/json_stream_parser.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/object_writer.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/proto_writer.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/protostream_objectsource.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/protostream_objectwriter.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/type_info.cc
# ${PROTOBUF_ROOT}/src/google/protobuf/util/internal/type_info_test_helper.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/internal/utility.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/json_util.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/message_differencer.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/time_util.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/util/type_resolver_util.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/wire_format.cc
${
PROTOBUF_ROOT
}
/src/google/protobuf/wrappers.pb.cc
)
if
(
CMAKE_VERSION VERSION_LESS 2.8.9 AND UNIX
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fPIC"
)
endif
()
add_library
(
libprotobuf STATIC
${
PROTOBUF_SRCS
}
)
include_directories
(
${
PROTOBUF_ROOT
}
/src
)
set_target_properties
(
libprotobuf
PROPERTIES
FOLDER
"3rdparty"
POSITION_INDEPENDENT_CODE 1
# CMake 2.8.9+
OUTPUT_NAME libprotobuf
DEBUG_POSTFIX
"
${
OPENCV_DEBUG_POSTFIX
}
"
ARCHIVE_OUTPUT_DIRECTORY
${
3P_LIBRARY_OUTPUT_PATH
}
)
if
(
NOT BUILD_SHARED_LIBS
)
ocv_install_target
(
libprotobuf EXPORT OpenCVModules ARCHIVE DESTINATION
${
OPENCV_3P_LIB_INSTALL_PATH
}
COMPONENT dev
)
endif
()
modules/dnn/CMakeLists.txt
View file @
e6f63c7a
...
...
@@ -2,8 +2,8 @@ if(WINRT)
ocv_module_disable
(
dnn
)
endif
()
include
(
${
CMAKE_CURRENT
_SOURCE_DIR
}
/cmake/OpenCVFindLibProtobuf.cmake
)
if
(
NOT
DEFINED PROTOBUF_INCLUDE_DIR
)
include
(
${
OpenCV
_SOURCE_DIR
}
/cmake/OpenCVFindLibProtobuf.cmake
)
if
(
NOT
Protobuf_FOUND
)
ocv_module_disable
(
opencv_dnn
)
endif
()
...
...
@@ -37,28 +37,36 @@ if(ANDROID)
add_definitions
(
-DDISABLE_POSIX_MEMALIGN -DTH_DISABLE_HEAP_TRACKING
)
endif
()
# ----------------------------------------------------------------------------
# Resolve libprotobuf dependency
# ----------------------------------------------------------------------------
if
(
NOT PROTOBUF_FOUND
)
add_subdirectory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/3rdparty/protobuf
"
${
PROTOBUF_CPP_PATH
}
"
)
add_definitions
(
-DHAVE_PROTOBUF=1
)
#supress warnings in autogenerated caffe.pb.* files
add_definitions
(
-DHAVE_PROTOBUF=1
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS
-Wunused-parameter -Wundef -Wignored-qualifiers -Wno-enum-compare
-Wdeprecated-declarations
/wd4125 /wd4267 /wd4127 /wd4244 /wd4512 /wd4702
/wd4456 /wd4510 /wd4610 /wd4800
-wd858 -wd2196
)
#supress warnings in autogenerated caffe.pb.* files
ocv_warnings_disable
(
CMAKE_CXX_FLAGS
-Wunused-parameter -Wundef -Wignored-qualifiers -Wno-enum-compare
-Wdeprecated-declarations
/wd4125 /wd4267 /wd4127 /wd4244 /wd4512 /wd4702
/wd4456 /wd4510 /wd4610 /wd4800
-wd858 -wd2196
)
if
(
PROTOBUF_UPDATE_FILES
)
file
(
GLOB proto_files src/tensorflow/*.proto
)
list
(
APPEND proto_files src/caffe/caffe.proto
)
PROTOBUF_GENERATE_CPP
(
Protobuf_HDRS Protobuf_SRCS
${
proto_files
}
)
else
()
file
(
GLOB fw_srcs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/tensorflow/*.cc
)
file
(
GLOB fw_hdrs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/tensorflow/*.h
)
list
(
APPEND fw_srcs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/caffe/caffe.pb.cc
)
list
(
APPEND fw_hdrs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/caffe/caffe.pb.h
)
list
(
APPEND Protobuf_SRCS
${
fw_srcs
}
)
list
(
APPEND Protobuf_HDRS
${
fw_hdrs
}
)
list
(
APPEND Protobuf_INCLUDE_DIRS
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/caffe
)
list
(
APPEND Protobuf_INCLUDE_DIRS
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/tensorflow
)
endif
()
ocv_source_group
(
"Src
\\
protobuf"
FILES
${
P
ROTOBUF_SRCS
}
${
PROTOBUF
_HDRS
}
)
ocv_module_include_directories
(
include
${
P
ROTOBUF_INCLUDE_DIR
}
)
ocv_source_group
(
"Src
\\
protobuf"
FILES
${
P
rotobuf_SRCS
}
${
Protobuf
_HDRS
}
)
ocv_module_include_directories
(
include
${
P
rotobuf_INCLUDE_DIRS
}
)
ocv_glob_module_sources
(
${
P
ROTOBUF_SRCS
}
${
PROTOBUF
_HDRS
}
${
CBLAS_H_PROXY_PATH
}
)
ocv_create_module
(
${
P
ROTOBUF
_LIBRARIES
}
${
LAPACK_LIBRARIES
}
)
ocv_glob_module_sources
(
${
P
rotobuf_SRCS
}
${
Protobuf
_HDRS
}
${
CBLAS_H_PROXY_PATH
}
)
ocv_create_module
(
${
P
rotobuf
_LIBRARIES
}
${
LAPACK_LIBRARIES
}
)
ocv_add_samples
()
ocv_add_accuracy_tests
()
ocv_add_perf_tests
()
...
...
modules/dnn/cmake/OpenCVFindLibProtobuf.cmake
deleted
100644 → 0
View file @
637e82dd
# By default, we use built-in protobuf sources and pre-generated .proto files
# Note: In case of .proto model updates these variables should be used:
# - PROTOBUF_PROTOC_EXECUTABLE (required)
# - PROTOBUF_INCLUDE_DIR
# - PROTOBUF_LIBRARIES or PROTOBUF_LIBRARY / PROTOBUF_LIBRARY_DEBUG for find_package()
OCV_OPTION
(
BUILD_PROTOBUF
"Force to build libprotobuf from sources"
ON
)
OCV_OPTION
(
UPDATE_PROTO_FILES
"Force to rebuild .proto files"
OFF
)
if
(
UPDATE_PROTO_FILES
)
if
(
NOT DEFINED PROTOBUF_PROTOC_EXECUTABLE
)
find_package
(
Protobuf QUIET
)
endif
()
if
(
DEFINED PROTOBUF_PROTOC_EXECUTABLE AND EXISTS
${
PROTOBUF_PROTOC_EXECUTABLE
}
)
message
(
STATUS
"The protocol buffer compiler is found (
${
PROTOBUF_PROTOC_EXECUTABLE
}
)"
)
file
(
GLOB proto_files src/tensorflow/*.proto
)
list
(
APPEND proto_files src/caffe/caffe.proto
)
PROTOBUF_GENERATE_CPP
(
PROTOBUF_HDRS PROTOBUF_SRCS
${
proto_files
}
)
else
()
message
(
FATAL_ERROR
"The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='
${
PROTOBUF_PROTOC_EXECUTABLE
}
')"
)
endif
()
endif
()
if
(
NOT BUILD_PROTOBUF AND
NOT
(
DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF_LIBRARIES
))
find_package
(
Protobuf QUIET
)
endif
()
if
(
PROTOBUF_FOUND
)
# nothing
else
()
set
(
PROTOBUF_CPP_PATH
"
${
OpenCV_BINARY_DIR
}
/3rdparty/protobuf"
)
set
(
PROTOBUF_CPP_ROOT
"
${
PROTOBUF_CPP_PATH
}
/protobuf-3.1.0"
)
ocv_download
(
FILENAME
"protobuf-cpp-3.1.0.tar.gz"
HASH
"bd5e3eed635a8d32e2b99658633815ef"
URL
"
${
OPENCV_PROTOBUF_URL
}
"
"$ENV{OPENCV_PROTOBUF_URL}"
"https://github.com/google/protobuf/releases/download/v3.1.0/"
DESTINATION_DIR
"
${
PROTOBUF_CPP_PATH
}
"
ID PROTOBUF
STATUS res
UNPACK RELATIVE_URL
)
if
(
NOT res
)
return
()
endif
()
set
(
PROTOBUF_LIBRARIES libprotobuf
)
set
(
PROTOBUF_INCLUDE_DIR
"
${
PROTOBUF_CPP_ROOT
}
/src"
)
endif
()
if
(
NOT UPDATE_PROTO_FILES
)
file
(
GLOB fw_srcs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/tensorflow/*.cc
)
file
(
GLOB fw_hdrs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/tensorflow/*.h
)
list
(
APPEND fw_srcs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/caffe/caffe.pb.cc
)
list
(
APPEND fw_hdrs
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/caffe/caffe.pb.h
)
list
(
APPEND PROTOBUF_SRCS
${
fw_srcs
}
)
list
(
APPEND PROTOBUF_HDRS
${
fw_hdrs
}
)
list
(
APPEND PROTOBUF_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/caffe
)
list
(
APPEND PROTOBUF_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/misc/tensorflow
)
endif
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment