2022-01-15 05:53:19 +08:00
# The script detects Intel(R) OpenVINO(TM) runtime installation
2018-02-06 16:57:35 +08:00
#
2018-07-30 23:21:17 +08:00
# Result:
2022-01-15 05:53:19 +08:00
# - target ocv.3rdparty.openvino
2018-02-06 16:57:35 +08:00
2022-02-07 00:10:43 +08:00
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 )
2018-07-30 23:21:17 +08:00
return ( )
2022-02-07 00:10:43 +08:00
endif ( )
2018-07-17 20:30:56 +08:00
endif ( )
2022-02-07 00:10:43 +08:00
# ======================
2018-07-16 18:58:59 +08:00
2022-01-15 05:53:19 +08:00
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 ( )
# ======================
2018-07-16 18:58:59 +08:00
2018-07-30 23:21:17 +08:00
find_package ( InferenceEngine QUIET )
if ( InferenceEngine_FOUND )
2019-08-23 17:54:07 +08:00
set ( INF_ENGINE_TARGET ${ InferenceEngine_LIBRARIES } )
2022-02-11 20:13:09 +08:00
set ( INF_ENGINE_VERSION "${InferenceEngine_VERSION}" )
2019-12-02 21:16:06 +08:00
message ( STATUS "Detected InferenceEngine: cmake package (${InferenceEngine_VERSION})" )
2018-02-06 16:57:35 +08:00
endif ( )
2021-09-14 12:15:35 +08:00
if ( DEFINED InferenceEngine_VERSION )
message ( STATUS "InferenceEngine: ${InferenceEngine_VERSION}" )
if ( NOT INF_ENGINE_RELEASE AND NOT ( InferenceEngine_VERSION VERSION_LESS "2021.4" ) )
math ( EXPR INF_ENGINE_RELEASE_INIT "${InferenceEngine_VERSION_MAJOR} * 1000000 + ${InferenceEngine_VERSION_MINOR} * 10000 + ${InferenceEngine_VERSION_PATCH} * 100" )
endif ( )
endif ( )
if ( NOT INF_ENGINE_RELEASE AND NOT INF_ENGINE_RELEASE_INIT )
2021-12-14 03:10:02 +08:00
message ( STATUS "WARNING: InferenceEngine version has not been set, 2021.4.2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors." )
set ( INF_ENGINE_RELEASE_INIT "2021040200" )
2021-09-14 12:15:35 +08:00
elseif ( DEFINED INF_ENGINE_RELEASE )
set ( INF_ENGINE_RELEASE_INIT "${INF_ENGINE_RELEASE}" )
endif ( )
set ( INF_ENGINE_RELEASE "${INF_ENGINE_RELEASE_INIT}" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)" )
2022-01-15 05:53:19 +08:00
set ( tgts )
set ( defs )
2018-02-06 16:57:35 +08:00
2022-01-15 05:53:19 +08:00
# Add more features to the target
2018-07-30 23:21:17 +08:00
if ( INF_ENGINE_TARGET )
set_target_properties ( ${ INF_ENGINE_TARGET } PROPERTIES
2021-07-03 05:37:37 +08:00
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S " H A V E _ I N F _ E N G I N E = 1 ; I N F _ E N G I N E _ R E L E A S E = $ { I N F _ E N G I N E _ R E L E A S E } "
2018-07-30 23:21:17 +08:00
)
2022-01-15 05:53:19 +08:00
list ( APPEND tgts ${ INF_ENGINE_TARGET } )
list ( APPEND defs "INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}" "HAVE_INF_ENGINE" )
2018-07-30 23:21:17 +08:00
endif ( )
2019-12-02 21:16:06 +08:00
2022-01-15 05:53:19 +08:00
if ( WITH_NGRAPH OR NOT DEFINED WITH_NGRAPH )
2019-12-02 21:16:06 +08:00
find_package ( ngraph QUIET )
if ( ngraph_FOUND )
ocv_assert ( TARGET ngraph::ngraph )
if ( INF_ENGINE_RELEASE VERSION_LESS "2019039999" )
message ( WARNING "nGraph is not tested with current InferenceEngine version: INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}" )
endif ( )
message ( STATUS "Detected ngraph: cmake package (${ngraph_VERSION})" )
set ( HAVE_NGRAPH ON )
2022-01-15 05:53:19 +08:00
list ( APPEND tgts ngraph::ngraph )
list ( APPEND defs "HAVE_NGRAPH" "HAVE_DNN_NGRAPH" )
2019-12-02 21:16:06 +08:00
endif ( )
endif ( )
2022-01-15 05:53:19 +08:00
ocv_add_external_target ( openvino "" "${tgts}" "${defs}" )