Skip to content

Commit

Permalink
3rdparty: put protobuf into OpenCV repository
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Jun 22, 2017
1 parent 62ba5d7 commit 8f5c0e0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 229 deletions.
151 changes: 0 additions & 151 deletions modules/dnn/3rdparty/protobuf/CMakeLists.txt

This file was deleted.

48 changes: 28 additions & 20 deletions modules/dnn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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 ${PROTOBUF_SRCS} ${PROTOBUF_HDRS})
ocv_module_include_directories(include ${PROTOBUF_INCLUDE_DIR})
ocv_source_group("Src\\protobuf" FILES ${Protobuf_SRCS} ${Protobuf_HDRS})
ocv_module_include_directories(include ${Protobuf_INCLUDE_DIRS})

ocv_glob_module_sources(${PROTOBUF_SRCS} ${PROTOBUF_HDRS} ${CBLAS_H_PROXY_PATH})
ocv_create_module(${PROTOBUF_LIBRARIES} ${LAPACK_LIBRARIES})
ocv_glob_module_sources(${Protobuf_SRCS} ${Protobuf_HDRS} ${CBLAS_H_PROXY_PATH})
ocv_create_module(${Protobuf_LIBRARIES} ${LAPACK_LIBRARIES})
ocv_add_samples()
ocv_add_accuracy_tests()
ocv_add_perf_tests()
Expand Down
58 changes: 0 additions & 58 deletions modules/dnn/cmake/OpenCVFindLibProtobuf.cmake

This file was deleted.

0 comments on commit 8f5c0e0

Please sign in to comment.