Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
d1e76a34
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1e76a34
编写于
1月 15, 2022
作者:
M
Maksim Shabunin
提交者:
Alexander Alekhin
2月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
3.4: Use modern OpenVINO package interface
original commit:
437af37b
上级
5b3d5f9f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
127 addition
and
91 deletion
+127
-91
CMakeLists.txt
CMakeLists.txt
+58
-54
cmake/OpenCVDetectInferenceEngine.cmake
cmake/OpenCVDetectInferenceEngine.cmake
+25
-18
cmake/OpenCVUtils.cmake
cmake/OpenCVUtils.cmake
+41
-0
modules/dnn/CMakeLists.txt
modules/dnn/CMakeLists.txt
+3
-19
未找到文件。
CMakeLists.txt
浏览文件 @
d1e76a34
...
...
@@ -291,12 +291,10 @@ OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OP
OCV_OPTION
(
WITH_HALIDE
"Include Halide support"
OFF
VISIBLE_IF TRUE
VERIFY HAVE_HALIDE
)
OCV_OPTION
(
WITH_INF_ENGINE
"Include Intel Inference Engine support"
OFF
# replacement for deprecated options: WITH_INF_ENGINE, WITH_NGRAPH
OCV_OPTION
(
WITH_OPENVINO
"Include Intel OpenVINO toolkit support"
(
WITH_INF_ENGINE
)
VISIBLE_IF TRUE
VERIFY INF_ENGINE_TARGET
)
OCV_OPTION
(
WITH_NGRAPH
"Include nGraph support"
WITH_INF_ENGINE
VISIBLE_IF TRUE
VERIFY TARGET ngraph::ngraph
)
VERIFY TARGET ocv.3rdparty.openvino
)
OCV_OPTION
(
WITH_JASPER
"Include JPEG2K support"
ON
VISIBLE_IF NOT IOS
VERIFY HAVE_JASPER
)
...
...
@@ -764,7 +762,7 @@ if(WITH_HALIDE)
endif
()
# --- Inference Engine ---
if
(
WITH_INF_ENGINE
)
if
(
WITH_INF_ENGINE
OR WITH_OPENVINO
)
include
(
cmake/OpenCVDetectInferenceEngine.cmake
)
endif
()
...
...
@@ -1524,55 +1522,61 @@ if(WITH_HALIDE OR HAVE_HALIDE)
status
(
" Halide:"
HAVE_HALIDE THEN
"YES (
${
HALIDE_LIBRARIES
}
${
HALIDE_INCLUDE_DIRS
}
)"
ELSE NO
)
endif
()
if
(
WITH_INF_ENGINE OR INF_ENGINE_TARGET
)
if
(
INF_ENGINE_TARGET
)
list
(
GET INF_ENGINE_TARGET 0 ie_target
)
set
(
__msg
"YES (
${
INF_ENGINE_RELEASE
}
/
${
INF_ENGINE_VERSION
}
)"
)
ocv_get_imported_target
(
ie_target
"
${
ie_target
}
"
)
get_target_property
(
_lib
${
ie_target
}
IMPORTED_LOCATION
)
get_target_property
(
_lib_imp_rel
${
ie_target
}
IMPORTED_IMPLIB_RELEASE
)
get_target_property
(
_lib_imp_dbg
${
ie_target
}
IMPORTED_IMPLIB_DEBUG
)
get_target_property
(
_lib_rel
${
ie_target
}
IMPORTED_LOCATION_RELEASE
)
get_target_property
(
_lib_dbg
${
ie_target
}
IMPORTED_LOCATION_DEBUG
)
ocv_build_features_string
(
_lib
IF _lib THEN
"
${
_lib
}
"
IF _lib_imp_rel AND _lib_imp_dbg THEN
"
${
_lib_imp_rel
}
/
${
_lib_imp_dbg
}
"
IF _lib_rel AND _lib_dbg THEN
"
${
_lib_rel
}
/
${
_lib_dbg
}
"
IF _lib_rel THEN
"
${
_lib_rel
}
"
IF _lib_dbg THEN
"
${
_lib_dbg
}
"
ELSE
"unknown"
)
get_target_property
(
_inc
${
ie_target
}
INTERFACE_INCLUDE_DIRECTORIES
)
status
(
" Inference Engine:"
"
${
__msg
}
"
)
status
(
" * libs:"
"
${
_lib
}
"
)
status
(
" * includes:"
"
${
_inc
}
"
)
else
()
status
(
" Inference Engine:"
"NO"
)
if
(
HAVE_OPENVINO
OR
(
WITH_OPENVINO AND NOT WITH_INF_ENGINE AND NOT INF_ENGINE_TARGET
)
)
status
(
" OpenVINO:"
TARGET openvino::runtime THEN
"YES (
${
OpenVINO_VERSION
}
)"
ELSE
"NO"
)
else
()
if
(
WITH_INF_ENGINE OR INF_ENGINE_TARGET
)
if
(
INF_ENGINE_TARGET
)
list
(
GET INF_ENGINE_TARGET 0 ie_target
)
set
(
__msg
"YES (
${
INF_ENGINE_RELEASE
}
/
${
INF_ENGINE_VERSION
}
)"
)
ocv_get_imported_target
(
ie_target
"
${
ie_target
}
"
)
get_target_property
(
_lib
${
ie_target
}
IMPORTED_LOCATION
)
get_target_property
(
_lib_imp_rel
${
ie_target
}
IMPORTED_IMPLIB_RELEASE
)
get_target_property
(
_lib_imp_dbg
${
ie_target
}
IMPORTED_IMPLIB_DEBUG
)
get_target_property
(
_lib_rel
${
ie_target
}
IMPORTED_LOCATION_RELEASE
)
get_target_property
(
_lib_dbg
${
ie_target
}
IMPORTED_LOCATION_DEBUG
)
ocv_build_features_string
(
_lib
IF _lib THEN
"
${
_lib
}
"
IF _lib_imp_rel AND _lib_imp_dbg THEN
"
${
_lib_imp_rel
}
/
${
_lib_imp_dbg
}
"
IF _lib_rel AND _lib_dbg THEN
"
${
_lib_rel
}
/
${
_lib_dbg
}
"
IF _lib_rel THEN
"
${
_lib_rel
}
"
IF _lib_dbg THEN
"
${
_lib_dbg
}
"
ELSE
"unknown"
)
get_target_property
(
_inc
${
ie_target
}
INTERFACE_INCLUDE_DIRECTORIES
)
status
(
" Inference Engine:"
"
${
__msg
}
"
)
status
(
" * libs:"
"
${
_lib
}
"
)
status
(
" * includes:"
"
${
_inc
}
"
)
else
()
status
(
" Inference Engine:"
"NO"
)
endif
()
endif
()
endif
(
)
if
(
WITH_NGRAPH OR
HAVE_NGRAPH
)
if
(
HAVE_NGRAPH
)
ocv_get_imported_target
(
__target ngraph::ngraph
)
set
(
__msg
"YES (
${
ngraph_VERSION
}
)"
)
get_target_property
(
_lib
${
__target
}
IMPORTED_LOCATION
)
get_target_property
(
_lib_imp_rel
${
__target
}
IMPORTED_IMPLIB_RELEASE
)
get_target_property
(
_lib_imp_dbg
${
__target
}
IMPORTED_IMPLIB_DEBUG
)
get_target_property
(
_lib_rel
${
__target
}
IMPORTED_LOCATION_RELEASE
)
get_target_property
(
_lib_dbg
${
__target
}
IMPORTED_LOCATION_DEBUG
)
ocv_build_features_string
(
_lib
IF _lib THEN
"
${
_lib
}
"
IF _lib_imp_rel AND _lib_imp_dbg THEN
"
${
_lib_imp_rel
}
/
${
_lib_imp
_dbg
}
"
IF _lib_rel AND _lib_dbg THEN
"
${
_lib_rel
}
/
${
_lib_dbg
}
"
IF _lib_rel THEN
"
${
_lib_rel
}
"
IF _lib_dbg THEN
"
${
_lib_dbg
}
"
ELSE
"unknown"
)
get_target_property
(
_inc
${
__target
}
INTERFACE_INCLUDE_DIRECTORIES
)
status
(
" nGraph:"
"
${
__msg
}
"
)
status
(
" * libs:"
"
${
_lib
}
"
)
status
(
" * includes:"
"
${
_inc
}
"
)
else
(
)
status
(
" nGraph:"
"NO"
)
if
(
WITH_NGRAPH OR HAVE_NGRAPH
)
if
(
HAVE_NGRAPH
)
ocv_get_imported_target
(
__target ngraph::ngraph
)
set
(
__msg
"YES (
${
ngraph_VERSION
}
)"
)
get_target_property
(
_lib
${
__target
}
IMPORTED_LOCATION
)
get_target_property
(
_lib_imp_rel
${
__target
}
IMPORTED_IMPLIB_RELEASE
)
get_target_property
(
_lib_imp_dbg
${
__target
}
IMPORTED_IMPLIB_DEBUG
)
get_target_property
(
_lib_rel
${
__target
}
IMPORTED_LOCATION_RELEASE
)
get_target_property
(
_lib_dbg
${
__target
}
IMPORTED_LOCATION_DEBUG
)
ocv_build_features_string
(
_lib
IF _lib THEN
"
${
_lib
}
"
IF _lib_imp_rel AND _lib_imp_dbg THEN
"
${
_lib_imp_rel
}
/
${
_lib_imp_dbg
}
"
IF _lib_rel AND _lib_dbg THEN
"
${
_lib_rel
}
/
${
_lib
_dbg
}
"
IF _lib_rel THEN
"
${
_lib_rel
}
"
IF _lib_dbg THEN
"
${
_lib_dbg
}
"
ELSE
"unknown
"
)
get_target_property
(
_inc
${
__target
}
INTERFACE_INCLUDE_DIRECTORIES
)
status
(
" nGraph:"
"
${
__msg
}
"
)
status
(
" * libs:"
"
${
_lib
}
"
)
status
(
" * includes:"
"
${
_inc
}
"
)
else
(
)
status
(
" nGraph:"
"NO"
)
endif
(
)
endif
()
endif
()
...
...
cmake/OpenCVDetectInferenceEngine.cmake
浏览文件 @
d1e76a34
# The script detects Intel(R) Inference Engine installation
#
# Cache variables:
# INF_ENGINE_RELEASE - a number reflecting IE source interface (linked with OpenVINO release)
#
# Detect parameters:
# 1. Native cmake IE package:
# - environment variable InferenceEngine_DIR is set to location of cmake module
# 2. Custom location:
# - INF_ENGINE_INCLUDE_DIRS - headers search location
# - INF_ENGINE_LIB_DIRS - library search location
# 3. OpenVINO location:
# - environment variable INTEL_OPENVINO_DIR is set to location of OpenVINO installation dir
# - INF_ENGINE_PLATFORM - part of name of library directory representing its platform
# The script detects Intel(R) OpenVINO(TM) runtime installation
#
# Result:
# INF_ENGINE_TARGET - set to name of imported library target representing InferenceEngine
#
# - target ocv.3rdparty.openvino
if
(
NOT HAVE_CXX11
)
message
(
WARNING
"DL Inference engine requires C++11. You can turn it on via ENABLE_CXX11=ON CMake flag."
)
...
...
@@ -24,6 +10,19 @@ endif()
# =======================
if
(
WITH_OPENVINO
)
find_package
(
OpenVINO QUIET
)
if
(
OpenVINO_FOUND
)
message
(
STATUS
"OpenVINO FOUND:
${
OpenVINO_VERSION
}
"
)
math
(
EXPR ver
"
${
OpenVINO_VERSION_MAJOR
}
* 1000000 +
${
OpenVINO_VERSION_MINOR
}
* 10000 +
${
OpenVINO_VERSION_PATCH
}
* 100"
)
ocv_add_external_target
(
openvino
""
"openvino::runtime"
"INF_ENGINE_RELEASE=
${
ver
}
;HAVE_NGRAPH;HAVE_DNN_NGRAPH;HAVE_INF_ENGINE"
)
set
(
HAVE_OPENVINO 1
)
return
()
endif
()
endif
()
# ======================
macro
(
ocv_ie_find_extra_libraries find_prefix find_suffix
)
file
(
GLOB libraries
"
${
INF_ENGINE_LIB_DIRS
}
/
${
find_prefix
}
inference_engine*
${
find_suffix
}
"
)
foreach
(
full_path IN LISTS libraries
)
...
...
@@ -151,15 +150,19 @@ if(NOT INF_ENGINE_TARGET AND _loc)
add_custom_ie_build
(
"
${
ie_custom_env_inc
}
"
"
${
ie_custom_env_lib
}
"
"
${
ie_custom_env_lib_rel
}
"
"
${
ie_custom_env_lib_dbg
}
"
"OpenVINO (
${
_loc
}
)"
)
endif
()
# Add more features to the target
set
(
tgts
)
set
(
defs
)
# Add more features to the target
if
(
INF_ENGINE_TARGET
)
set_target_properties
(
${
INF_ENGINE_TARGET
}
PROPERTIES
INTERFACE_COMPILE_DEFINITIONS
"HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=
${
INF_ENGINE_RELEASE
}
"
)
list
(
APPEND tgts
${
INF_ENGINE_TARGET
}
)
list
(
APPEND defs
"INF_ENGINE_RELEASE=
${
INF_ENGINE_RELEASE
}
"
"HAVE_INF_ENGINE"
)
endif
()
if
(
WITH_NGRAPH
)
if
(
WITH_NGRAPH
OR NOT DEFINED WITH_NGRAPH
)
find_package
(
ngraph QUIET
)
if
(
ngraph_FOUND
)
ocv_assert
(
TARGET ngraph::ngraph
)
...
...
@@ -168,5 +171,9 @@ if(WITH_NGRAPH)
endif
()
message
(
STATUS
"Detected ngraph: cmake package (
${
ngraph_VERSION
}
)"
)
set
(
HAVE_NGRAPH ON
)
list
(
APPEND tgts ngraph::ngraph
)
list
(
APPEND defs
"HAVE_NGRAPH"
"HAVE_DNN_NGRAPH"
)
endif
()
endif
()
ocv_add_external_target
(
openvino
""
"
${
tgts
}
"
"
${
defs
}
"
)
cmake/OpenCVUtils.cmake
浏览文件 @
d1e76a34
...
...
@@ -1580,6 +1580,47 @@ function(ocv_add_library target)
endfunction
()
function
(
ocv_add_external_target name inc link def
)
if
(
BUILD_SHARED_LIBS AND link
)
set
(
imp IMPORTED
)
endif
()
add_library
(
ocv.3rdparty.
${
name
}
INTERFACE
${
imp
}
)
if
(
def
)
if
(
NOT
(
CMAKE_VERSION VERSION_LESS
"3.11.0"
))
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1264 : eliminates "Cannot specify compile definitions for imported target" error message
target_compile_definitions
(
ocv.3rdparty.
${
name
}
INTERFACE
"
${
def
}
"
)
else
()
set_target_properties
(
ocv.3rdparty.
${
name
}
PROPERTIES INTERFACE_COMPILE_DEFINITIONS
"
${
def
}
"
)
endif
()
endif
()
if
(
inc
)
if
(
NOT
(
CMAKE_VERSION VERSION_LESS
"3.11.0"
))
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1264 : eliminates "Cannot specify compile definitions for imported target" error message
target_include_directories
(
ocv.3rdparty.
${
name
}
SYSTEM INTERFACE
"$<BUILD_INTERFACE:
${
inc
}
>"
)
else
()
set_target_properties
(
ocv.3rdparty.
${
name
}
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
"$<BUILD_INTERFACE:
${
inc
}
>"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
"$<BUILD_INTERFACE:
${
inc
}
>"
)
endif
()
endif
()
if
(
link
)
# When cmake version is greater than or equal to 3.11, INTERFACE_LINK_LIBRARIES no longer applies to interface library
# See https://github.com/opencv/opencv/pull/18658
if
(
CMAKE_VERSION VERSION_LESS 3.11
)
set_target_properties
(
ocv.3rdparty.
${
name
}
PROPERTIES
INTERFACE_LINK_LIBRARIES
"
${
link
}
"
)
else
()
target_link_libraries
(
ocv.3rdparty.
${
name
}
INTERFACE
${
link
}
)
endif
()
endif
()
# to install used target only upgrade CMake
if
(
NOT BUILD_SHARED_LIBS
AND CMAKE_VERSION VERSION_LESS
"3.13.0"
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/2152
)
install
(
TARGETS ocv.3rdparty.
${
name
}
EXPORT OpenCVModules
)
endif
()
endfunction
()
# Returns the first non-interface target
function
(
ocv_get_imported_target imported interface
)
set
(
__result
"
${
interface
}
"
)
...
...
modules/dnn/CMakeLists.txt
浏览文件 @
d1e76a34
...
...
@@ -115,24 +115,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
endif
()
set
(
dnn_runtime_libs
""
)
if
(
INF_ENGINE_TARGET
)
set
(
use_nn_builder OFF
)
if
(
TARGET inference_engine_nn_builder OR
# custom imported target
TARGET IE::inference_engine_nn_builder OR
# default imported target via InferenceEngineConfig.cmake
INF_ENGINE_RELEASE VERSION_LESS
"2020000000"
)
# compatibility with older versions on IE
set
(
use_nn_builder ON
)
endif
()
ocv_option
(
OPENCV_DNN_IE_NN_BUILDER_2019
"Build with Inference Engine NN Builder API support"
${
use_nn_builder
}
)
# future: NOT HAVE_NGRAPH
if
(
OPENCV_DNN_IE_NN_BUILDER_2019
)
message
(
STATUS
"DNN: Enabling Inference Engine NN Builder API support"
)
add_definitions
(
-DHAVE_DNN_IE_NN_BUILDER_2019=1
)
endif
()
list
(
APPEND dnn_runtime_libs
${
INF_ENGINE_TARGET
}
)
endif
()
if
(
HAVE_NGRAPH
)
message
(
STATUS
"DNN: Enabling Inference Engine nGraph API support"
)
add_definitions
(
-DHAVE_DNN_NGRAPH
)
list
(
APPEND dnn_runtime_libs ngraph::ngraph
)
if
(
TARGET ocv.3rdparty.openvino
)
list
(
APPEND dnn_runtime_libs ocv.3rdparty.openvino
)
endif
()
ocv_glob_module_sources
(
${
sources_options
}
SOURCES
${
fw_srcs
}
)
...
...
@@ -143,7 +127,7 @@ ocv_add_accuracy_tests(${dnn_runtime_libs})
set
(
perf_path
"
${
CMAKE_CURRENT_LIST_DIR
}
/perf"
)
file
(
GLOB_RECURSE perf_srcs
"
${
perf_path
}
/*.cpp"
)
file
(
GLOB_RECURSE perf_hdrs
"
${
perf_path
}
/*.hpp"
"
${
perf_path
}
/*.h"
)
ocv_add_perf_tests
(
${
INF_ENGINE_TARGET
}
ocv_add_perf_tests
(
${
dnn_runtime_libs
}
FILES test_common
"
${
CMAKE_CURRENT_LIST_DIR
}
/test/test_common.hpp"
"
${
CMAKE_CURRENT_LIST_DIR
}
/test/test_common.impl.hpp"
FILES Src
${
perf_srcs
}
FILES Include
${
perf_hdrs
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录