libprotobuf is a separate 3rdparty lib now

pull/265/head
Vitaliy Lyudvichenko 9 years ago
parent 4929177904
commit fc9795b4bc
  1. 34
      modules/dnn/3rdparty/protobuf/CMakeLists.txt
  2. 2
      modules/dnn/3rdparty/protobuf/cmake/.gitignore
  3. 1
      modules/dnn/3rdparty/protobuf/cmake/CheckCxxHashmap.cmake
  4. 0
      modules/dnn/3rdparty/protobuf/cmake/CheckCxxHashset.cmake
  5. 0
      modules/dnn/3rdparty/protobuf/cmake/LICENSE
  6. 0
      modules/dnn/3rdparty/protobuf/cmake/config.h.in
  7. 6
      modules/dnn/CMakeLists.txt
  8. 23
      modules/dnn/cmake/find_protobuf.cmake
  9. 26878
      modules/dnn/src/caffe/compiled/caffe.pb.cc
  10. 20399
      modules/dnn/src/caffe/compiled/caffe.pb.h
  11. BIN
      modules/dnn/src/caffe/compiled/caffe.tar.gz

@ -1,3 +1,5 @@
project(libprotobuf)
include(CheckIncludeFiles)
include(cmake/CheckCxxHashset.cmake)
include(cmake/CheckCxxHashmap.cmake)
@ -89,13 +91,13 @@ endif()
add_definitions( -D_GNU_SOURCE=1 )
add_definitions( -DHAVE_CONFIG_H )
configure_file("cmake/libporobuf_config.h.in" "config.h")
configure_file("cmake/config.h.in" "config.h")
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)
else()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated -Wunused-parameter -Wunused-local-typedefs -Wsign-compare -Wundef)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated -Wshadow -Wmissing-declarations -Wunused-parameter -Wunused-local-typedefs -Wsign-compare -Wsign-promo -Wundef)
endif()
# Easier to support different versions of protobufs
@ -105,15 +107,15 @@ function(append_if_exist OUTPUT_LIST)
if(EXISTS ${fil})
list(APPEND ${OUTPUT_LIST} "${fil}")
else()
message("Warning: file missing: ${fil}")
message(WARNING "file missing: ${fil}")
endif()
endforeach()
set(${OUTPUT_LIST} ${${OUTPUT_LIST}} PARENT_SCOPE)
endfunction()
set(PROTOBUF_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/protobuf)
set(PROTOBUF_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
append_if_exist(PROTO_SRCS
append_if_exist(PROTOBUF_SRCS
${PROTOBUF_ROOT}/src/google/protobuf/compiler/importer.cc
${PROTOBUF_ROOT}/src/google/protobuf/compiler/parser.cc
${PROTOBUF_ROOT}/src/google/protobuf/descriptor.cc
@ -150,3 +152,25 @@ append_if_exist(PROTO_SRCS
${PROTOBUF_ROOT}/src/google/protobuf/wire_format_lite.cc
# ${PROTOBUF_ROOT}/src/google/protobuf/stubs/hash.cc
)
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
add_library(libprotobuf STATIC ${PROTOBUF_SRCS})
include_directories(${PROTOBUF_ROOT}/src ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(libprotobuf
PROPERTIES
OUTPUT_NAME libprotobuf
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(libprotobuf PROPERTIES FOLDER "3rdparty")
endif()
#if(NOT BUILD_SHARED_LIBS)
# ocv_install_target(libprotobuf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
#endif()

@ -53,4 +53,3 @@ macro(CHECK_HASHMAP)
endif(NOT HAVE_GNU_EXT_HASH_MAP)
endmacro(CHECK_HASHMAP)

@ -5,13 +5,13 @@ if(${CMAKE_PROJECT_NAME} STREQUAL "OpenCV")#build as OpenCV module
set(the_description "Deep neural network module. It allows to load models and to make forward pass")
set(OPENCV_MODULE_IS_PART_OF_WORLD OFF)
OCV_OPTION(BUILD_LIBPROTOBUF_FROM_SOURCES "Build libprotobuf from sources or try to find it in system" OFF)
OCV_OPTION(BUILD_LIBPROTOBUF_FROM_SOURCES "Force to build libprotobuf from sources (don't try to find it in system)" OFF)
include(cmake/find_protobuf.cmake)
ocv_add_module(dnn opencv_imgproc opencv_core opencv_highgui WRAP python matlab)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-shadow -Wno-parentheses -Wmaybe-uninitialized -Wsign-promo -Wmissing-declarations -Wmissing-prototypes)
ocv_glob_module_sources(${PROTO_SRCS} ${PROTO_HDRS})
ocv_source_group("Src\\protobuf" FILES ${PROTO_SRCS} ${PROTO_HDRS})
ocv_glob_module_sources(${PROTOBUF_SRCS} ${PROTOBUF_HDRS})
ocv_source_group("Src\\protobuf" FILES ${PROTOBUF_SRCS} ${PROTOBUF_HDRS})
ocv_module_include_directories(include ${PROTOBUF_INCLUDE_DIR})
ocv_create_module(${PROTOBUF_LIBRARIES})

@ -5,7 +5,7 @@ endif()
if(NOT BUILD_LIBPROTOBUF_FROM_SOURCES AND PROTOBUF_FOUND AND EXISTS ${PROTOBUF_PROTOC_EXECUTABLE})
message(STATUS "The protocol buffer compiler and libprotobuf were found")
PROTOBUF_GENERATE_CPP(PROTO_HDRS PROTO_SRCS src/caffe/caffe.proto)
PROTOBUF_GENERATE_CPP(PROTOBUF_HDRS PROTOBUF_SRCS src/caffe/caffe.proto)
add_definitions(-DHAVE_PROTOBUF=1)
else()
if(NOT PROTOBUF_FOUND)
@ -14,12 +14,23 @@ else()
message(STATUS "The protocol buffer compiler not found")
endif()
include(cmake/libprotobuf.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if(NOT OPENCV_INITIAL_PASS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/protobuf)
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/caffe.pb.cc
${CMAKE_CURRENT_BINARY_DIR}/caffe.pb.h
COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_CURRENT_SOURCE_DIR}/src/caffe/compiled/caffe.tar.gz
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Unpacking compiled caffe protobuf files"
VERBATIM
)
set(PROTOBUF_INCLUDE_DIR ${PROTOBUF_ROOT}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/caffe/compiled)
list(APPEND PROTO_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/caffe/compiled/caffe.pb.cc)
set(PROTOBUF_LIBRARIES "")
set(PROTOBUF_LIBRARIES libprotobuf)
set(PROTOBUF_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/protobuf/src ${CMAKE_CURRENT_BINARY_DIR})
set(PROTOBUF_SRCS ${CMAKE_CURRENT_BINARY_DIR}/caffe.pb.cc)
set(PROTOBUF_HDRS ${CMAKE_CURRENT_BINARY_DIR}/caffe.pb.h)
set(PROTOBUF_PROTOC_EXECUTABLE "")
add_definitions(-DHAVE_PROTOBUF=1)
endif()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save