@@ -2,8 +2,8 @@ if(WINRT)
2
2
ocv_module_disable (dnn )
3
3
endif ()
4
4
5
- include (${CMAKE_CURRENT_SOURCE_DIR } /cmake/OpenCVFindLibProtobuf.cmake )
6
- if (NOT DEFINED PROTOBUF_INCLUDE_DIR )
5
+ include (${OpenCV_SOURCE_DIR } /cmake/OpenCVFindLibProtobuf.cmake )
6
+ if (NOT Protobuf_FOUND )
7
7
ocv_module_disable (opencv_dnn )
8
8
endif ()
9
9
@@ -37,28 +37,36 @@ if(ANDROID)
37
37
add_definitions (-DDISABLE_POSIX_MEMALIGN -DTH_DISABLE_HEAP_TRACKING )
38
38
endif ()
39
39
40
- # ----------------------------------------------------------------------------
41
- # Resolve libprotobuf dependency
42
- # ----------------------------------------------------------------------------
43
- if (NOT PROTOBUF_FOUND )
44
- add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /3rdparty/protobuf "${PROTOBUF_CPP_PATH} " )
45
- add_definitions (-DHAVE_PROTOBUF=1 )
40
+ #supress warnings in autogenerated caffe.pb.* files
41
+ add_definitions (-DHAVE_PROTOBUF=1 )
42
+ ocv_warnings_disable (CMAKE_CXX_FLAGS
43
+ -Wunused-parameter -Wundef -Wignored-qualifiers -Wno-enum-compare
44
+ -Wdeprecated-declarations
45
+ /wd4125 /wd4267 /wd4127 /wd4244 /wd4512 /wd4702
46
+ /wd4456 /wd4510 /wd4610 /wd4800
47
+ -wd858 -wd2196
48
+ )
46
49
47
- #supress warnings in autogenerated caffe.pb.* files
48
- ocv_warnings_disable (CMAKE_CXX_FLAGS
49
- -Wunused-parameter -Wundef -Wignored-qualifiers -Wno-enum-compare
50
- -Wdeprecated-declarations
51
- /wd4125 /wd4267 /wd4127 /wd4244 /wd4512 /wd4702
52
- /wd4456 /wd4510 /wd4610 /wd4800
53
- -wd858 -wd2196
54
- )
50
+ if (PROTOBUF_UPDATE_FILES )
51
+ file (GLOB proto_files src/tensorflow/*.proto )
52
+ list (APPEND proto_files src/caffe/caffe.proto )
53
+ PROTOBUF_GENERATE_CPP (Protobuf_HDRS Protobuf_SRCS ${proto_files} )
54
+ else ()
55
+ file (GLOB fw_srcs ${CMAKE_CURRENT_SOURCE_DIR} /misc/tensorflow/*.cc )
56
+ file (GLOB fw_hdrs ${CMAKE_CURRENT_SOURCE_DIR} /misc/tensorflow/*.h )
57
+ list (APPEND fw_srcs ${CMAKE_CURRENT_SOURCE_DIR} /misc/caffe/caffe.pb.cc )
58
+ list (APPEND fw_hdrs ${CMAKE_CURRENT_SOURCE_DIR} /misc/caffe/caffe.pb.h )
59
+ list (APPEND Protobuf_SRCS ${fw_srcs} )
60
+ list (APPEND Protobuf_HDRS ${fw_hdrs} )
61
+ list (APPEND Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} /misc/caffe )
62
+ list (APPEND Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} /misc/tensorflow )
55
63
endif ()
56
64
57
- ocv_source_group ("Src\\ protobuf" FILES ${PROTOBUF_SRCS } ${PROTOBUF_HDRS } )
58
- ocv_module_include_directories (include ${PROTOBUF_INCLUDE_DIR } )
65
+ ocv_source_group ("Src\\ protobuf" FILES ${Protobuf_SRCS } ${Protobuf_HDRS } )
66
+ ocv_module_include_directories (include ${Protobuf_INCLUDE_DIRS } )
59
67
60
- ocv_glob_module_sources (${PROTOBUF_SRCS } ${PROTOBUF_HDRS } ${CBLAS_H_PROXY_PATH} )
61
- ocv_create_module (${PROTOBUF_LIBRARIES } ${LAPACK_LIBRARIES} )
68
+ ocv_glob_module_sources (${Protobuf_SRCS } ${Protobuf_HDRS } ${CBLAS_H_PROXY_PATH} )
69
+ ocv_create_module (${Protobuf_LIBRARIES } ${LAPACK_LIBRARIES} )
62
70
ocv_add_samples ()
63
71
ocv_add_accuracy_tests ()
64
72
ocv_add_perf_tests ()
0 commit comments