Use modern OpenVINO package interface

This commit is contained in:
Maksim Shabunin
2022-01-15 00:53:19 +03:00
parent a92cba8484
commit 437af37b13
5 changed files with 103 additions and 113 deletions
+3 -19
View File
@@ -165,24 +165,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} ${webnn_srcs})
@@ -193,7 +177,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}
+14 -19
View File
@@ -13,8 +13,14 @@ if(NOT TARGET ade)
return()
endif()
if(INF_ENGINE_TARGET)
ocv_option(OPENCV_GAPI_INF_ENGINE "Build GraphAPI module with Inference Engine support" ON)
if(TARGET ocv.3rdparty.openvino)
# TODO: remove OPENCV_GAPI_INF_ENGINE option
set(initial_value ON)
if(DEFINED OPENCV_GAPI_INF_ENGINE)
set(initial_value ${OPENCV_GAPI_INF_ENGINE})
message(WARNING "OPENCV_GAPI_INF_ENGINE option is deprecated. Use OPENCV_GAPI_WITH_OPENVINO option instead.")
endif()
ocv_option(OPENCV_GAPI_WITH_OPENVINO "G-API: Enable OpenVINO Toolkit support" ${initial_value})
endif()
set(the_description "OpenCV G-API Core Module")
@@ -228,12 +234,8 @@ ocv_create_module()
ocv_target_link_libraries(${the_module} PRIVATE ade)
if(OPENCV_GAPI_INF_ENGINE)
ocv_target_link_libraries(${the_module} PRIVATE ${INF_ENGINE_TARGET})
endif()
if (HAVE_NGRAPH)
ocv_target_link_libraries(${the_module} PRIVATE ngraph::ngraph)
if(TARGET ocv.3rdparty.openvino AND OPENCV_GAPI_WITH_OPENVINO)
ocv_target_link_libraries(${the_module} PRIVATE ocv.3rdparty.openvino)
endif()
if(HAVE_TBB)
@@ -248,11 +250,8 @@ if(CV_TRACE AND HAVE_ITT)
endif()
set(__test_extra_deps "")
if(OPENCV_GAPI_INF_ENGINE)
list(APPEND __test_extra_deps ${INF_ENGINE_TARGET})
endif()
if(HAVE_NGRAPH)
list(APPEND __test_extra_deps ngraph::ngraph)
if(TARGET ocv.3rdparty.openvino AND OPENCV_GAPI_WITH_OPENVINO)
list(APPEND __test_extra_deps ocv.3rdparty.openvino)
endif()
ocv_add_accuracy_tests(${__test_extra_deps})
@@ -263,9 +262,6 @@ ocv_add_accuracy_tests(${__test_extra_deps})
if(TARGET opencv_test_gapi)
target_include_directories(opencv_test_gapi PRIVATE "${CMAKE_CURRENT_LIST_DIR}/src")
target_link_libraries(opencv_test_gapi PRIVATE ade)
if (HAVE_NGRAPH)
ocv_target_compile_definitions(opencv_test_gapi PRIVATE -DHAVE_NGRAPH)
endif()
endif()
if(HAVE_TBB AND TARGET opencv_test_gapi)
@@ -347,9 +343,8 @@ ocv_add_samples()
# Required for sample with inference on host
if(TARGET example_gapi_onevpl_infer_single_roi)
if(OPENCV_GAPI_INF_ENGINE)
ocv_target_link_libraries(example_gapi_onevpl_infer_single_roi PRIVATE ${INF_ENGINE_TARGET})
ocv_target_compile_definitions(example_gapi_onevpl_infer_single_roi PRIVATE -DHAVE_INF_ENGINE)
if(TARGET ocv.3rdparty.openvino AND OPENCV_GAPI_WITH_OPENVINO)
ocv_target_link_libraries(example_gapi_onevpl_infer_single_roi PRIVATE ocv.3rdparty.openvino)
endif()
if(HAVE_D3D11 AND HAVE_OPENCL)
ocv_target_include_directories(example_gapi_onevpl_infer_single_roi SYSTEM PRIVATE ${OPENCL_INCLUDE_DIRS})