@ -1,83 +1,87 @@
# T h e s c r i p t d e t e c t s Intel ( R ) I n f e r e n c e E n g i n e i n s t a l l a t i o n
#
# P a r a m e t e r s :
# I N T E L _ C V S D K _ D I R - P a t h t o I n f e r e n c e E n g i n e r o o t f o l d e r
# I E _ P L U G I N S _ P A T H - P a t h t o f o l d e r w i t h I n f e r e n c e E n g i n e p l u g i n s
# C a c h e v a r i a b l e s :
# I N F _ E N G I N E _ O M P _ D I R - d i r e c t o r y w i t h O p e n M P l i b r a r y t o l i n k with ( needed by some versions of IE )
# I N F _ E N G I N E _ R E L E A S E - a n u m b e r r e f l e c t i n g I E s o u r c e interface ( linked with OpenVINO release )
#
# O n r e t u r n t h i s w i l l d e f i n e :
# D e t e c t p a r a m e t e r s :
# 1 . N a t i v e c m a k e I E p a c k a g e :
# - e n i r o n m e n t v a r i a b l e I n f e r e n c e E n g i n e _ D I R i s s e t t o l o c a t i o n o f c m a k e m o d u l e
# 2 . C u s t o m l o c a t i o n :
# - I N F _ E N G I N E _ I N C L U D E _ D I R S - h e a d e r s s e a r c h l o c a t i o n
# - I N F _ E N G I N E _ L I B _ D I R S - l i b r a r y s e a r c h l o c a t i o n
# 3 . O p e n V I N O l o c a t i o n :
# - e n v i r o n m e n t v a r i a b l e I N T E L _ C V S D K _ D I R i s s e t t o l o c a t i o n o f O p e n V I N O i n s t a l l a t i o n d i r
# - I N F _ E N G I N E _ P L A T F O R M - p a r t o f n a m e o f l i b r a r y d i r e c t o r y r e p r e s e n t i n g i t s platform ( default ubuntu_16.04 )
#
# H A V E _ I N F _ E N G I N E - T r u e i f I n t e l I n f e r e n c e E n g i n e w a s f o u n d
# I N F _ E N G I N E _ I N C L U D E _ D I R S - I n f e r e n c e E n g i n e i n c l u d e f o l d e r
# I N F _ E N G I N E _ L I B R A R I E S - I n f e r e n c e E n g i n e l i b r a r i e s a n d i t ' s d e p e n d e n c i e s
# R e s u l t :
# I N F _ E N G I N E _ T A R G E T - s e t t o n a m e o f i m p o r t e d l i b r a r y t a r g e t r e p r e s e n t i n g I n f e r e n c e E n g i n e
#
macro ( ie_fail )
set ( HAVE_INF_ENGINE FALSE )
return ( )
endmacro ( )
if ( NOT HAVE_CXX11 )
message ( WARNING "DL Inference engine requires C++11. You can turn it on via ENABLE_CXX11=ON CMake flag." )
ie_fail ( )
endif ( )
find_package ( InferenceEngine QUIET )
if ( InferenceEngine_FOUND )
set ( INF_ENGINE_LIBRARIES "${InferenceEngine_LIBRARIES}" )
set ( INF_ENGINE_INCLUDE_DIRS "${InferenceEngine_INCLUDE_DIRS}" )
set ( INF_ENGINE_VERSION "${InferenceEngine_VERSION}" )
set ( HAVE_INF_ENGINE TRUE )
return ( )
endif ( )
ocv_check_environment_variables ( INTEL_CVSDK_DIR INF_ENGINE_ROOT_DIR IE_PLUGINS_PATH )
# = = = = = = = = = = = = = = = = = = = = = = =
if ( NOT INF_ENGINE_ROOT_DIR OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp" )
set ( ie_root_paths "${INF_ENGINE_ROOT_DIR}" )
if ( DEFINED INTEL_CVSDK_DIR )
list ( APPEND ie_root_paths "${INTEL_CVSDK_DIR}/" )
list ( APPEND ie_root_paths "${INTEL_CVSDK_DIR}/deployment_tools/inference_engine" )
function ( add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg )
if ( NOT _inc OR NOT ( _lib OR _lib_rel OR _lib_dbg ) )
return ( )
endif ( )
if ( NOT ie_root_paths )
list ( APPEND ie_root_paths "/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/" )
add_library ( inference_engine UNKNOWN IMPORTED )
set_target_properties ( inference_engine PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { _ l i b } "
I M P O R T E D _ I M P L I B _ R E L E A S E " $ { _ l i b _ r e l } "
I M P O R T E D _ I M P L I B _ D E B U G " $ { _ l i b _ d b g } "
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S " $ { _ i n c } "
)
find_library ( omp_lib iomp5 PATHS "${INF_ENGINE_OMP_DIR}" NO_DEFAULT_PATH )
if ( NOT omp_lib )
message ( WARNING "OpenMP for IE have not been found. Set INF_ENGINE_OMP_DIR variable if you experience build errors." )
else ( )
set_target_properties ( inference_engine PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${omp_lib}" )
endif ( )
set ( INF_ENGINE_VERSION "Unknown" CACHE STRING "" )
set ( INF_ENGINE_TARGET inference_engine PARENT_SCOPE )
message ( STATUS "Detected InferenceEngine: ${_msg}" )
endfunction ( )
find_path ( INF_ENGINE_ROOT_DIR include/inference_engine.hpp PATHS ${ ie_root_paths } )
if ( INF_ENGINE_ROOT_DIR MATCHES "-NOTFOUND$" )
unset ( INF_ENGINE_ROOT_DIR CACHE )
endif ( )
endif ( )
# = = = = = = = = = = = = = = = = = = = = = =
set ( INF_ENGINE_INCLUDE_DIRS "${INF_ENGINE_ROOT_DIR}/include" CACHE PATH "Path to Inference Engine include directory" )
find_package ( InferenceEngine QUIET )
if ( InferenceEngine_FOUND )
set ( INF_ENGINE_TARGET IE::inference_engine )
set ( INF_ENGINE_VERSION "${InferenceEngine_VERSION}" CACHE STRING "" )
message ( STATUS "Detected InferenceEngine: cmake package" )
endif ( )
if ( NOT INF_ENGINE_ROOT_DIR
O R N O T E X I S T S " $ { I N F _ E N G I N E _ R O O T _ D I R } "
O R N O T E X I S T S " $ { I N F _ E N G I N E _ R O O T _ D I R } / i n c l u d e / i n f e r e n c e _ e n g i n e . h p p "
)
message ( WARNING "DL IE: Can't detect INF_ENGINE_ROOT_DIR location." )
ie_fail ( )
if ( NOT INF_ENGINE_TARGET AND INF_ENGINE_LIB_DIRS AND INF_ENGINE_INCLUDE_DIRS )
find_path ( ie_custom_inc "inference_engine.hpp" PATHS "${INF_ENGINE_INCLUDE_DIRS}" NO_DEFAULT_PATH )
find_library ( ie_custom_lib "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}" NO_DEFAULT_PATH )
find_library ( ie_custom_lib_rel "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Release" NO_DEFAULT_PATH )
find_library ( ie_custom_lib_dbg "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Debug" NO_DEFAULT_PATH )
add_custom_ie_build ( "${ie_custom_inc}" "${ie_custom_lib}" "${ie_custom_lib_rel}" "${ie_custom_lib_dbg}" "INF_ENGINE_{INCLUDE,LIB}_DIRS" )
endif ( )
set ( INF_ENGINE_LIBRARIES "" )
set ( _loc "$ENV{INTEL_CVSDK_DIR}" )
if ( NOT INF_ENGINE_TARGET AND _loc )
set ( INF_ENGINE_PLATFORM "ubuntu_16.04" CACHE STRING "InferenceEngine platform (library dir)" )
find_path ( ie_custom_env_inc "inference_engine.hpp" PATHS "${_loc}/deployment_tools/inference_engine/include" NO_DEFAULT_PATH )
find_library ( ie_custom_env_lib "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/${INF_ENGINE_PLATFORM}/intel64" NO_DEFAULT_PATH )
find_library ( ie_custom_env_lib_rel "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Release" NO_DEFAULT_PATH )
find_library ( ie_custom_env_lib_dbg "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Debug" NO_DEFAULT_PATH )
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 ( )
set ( ie_lib_list inference_engine )
# A d d m o r e f e a t u r e s t o t h e t a r g e t
if ( NOT IS_ABSOLUTE "${IE_PLUGINS_PATH}" )
set ( IE_PLUGINS_PATH "${INF_ENGINE_ROOT_DIR}/${IE_PLUGINS_PATH}" )
if ( INF_ENGINE_TARGET )
if ( NOT INF_ENGINE_RELEASE )
message ( WARNING "InferenceEngine version have not been set, 2018R2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors." )
endif ( )
link_directories (
$ { I N F _ E N G I N E _ R O O T _ D I R } / e x t e r n a l / m k l t i n y _ l n x / l i b
$ { I N F _ E N G I N E _ R O O T _ D I R } / e x t e r n a l / c l d n n / l i b
set ( INF_ENGINE_RELEASE "2018020000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)" )
set_target_properties ( ${ INF_ENGINE_TARGET } PROPERTIES
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 } "
)
foreach ( lib ${ ie_lib_list } )
find_library ( ${ lib } NAMES ${ lib } HINTS ${ IE_PLUGINS_PATH } )
if ( NOT ${ lib } )
message ( WARNING "DL IE: Can't find library: '${lib}'" )
ie_fail ( )
endif ( )
list ( APPEND INF_ENGINE_LIBRARIES ${ ${lib } } )
endforeach ( )
set ( HAVE_INF_ENGINE TRUE )