2018-02-06 16:57:35 +08:00
|
|
|
# The script detects Intel(R) Inference Engine installation
|
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
# INTEL_CVSDK_DIR - Path to Inference Engine root folder
|
|
|
|
# IE_PLUGINS_PATH - Path to folder with Inference Engine plugins
|
|
|
|
#
|
|
|
|
# On return this will define:
|
|
|
|
#
|
|
|
|
# HAVE_INF_ENGINE - True if Intel Inference Engine was found
|
|
|
|
# INF_ENGINE_INCLUDE_DIRS - Inference Engine include folder
|
|
|
|
# INF_ENGINE_LIBRARIES - Inference Engine libraries and it's dependencies
|
|
|
|
#
|
|
|
|
macro(ie_fail)
|
|
|
|
set(HAVE_INF_ENGINE FALSE)
|
|
|
|
return()
|
|
|
|
endmacro()
|
|
|
|
|
2018-04-19 20:04:57 +08:00
|
|
|
if(NOT HAVE_CXX11)
|
2018-07-16 18:58:59 +08:00
|
|
|
message(WARNING "DL Inference engine requires C++11. You can turn it on via ENABLE_CXX11=ON CMake flag.")
|
2018-04-19 20:04:57 +08:00
|
|
|
ie_fail()
|
|
|
|
endif()
|
|
|
|
|
2018-07-17 20:30:56 +08:00
|
|
|
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()
|
|
|
|
|
2018-07-16 18:58:59 +08:00
|
|
|
ocv_check_environment_variables(INTEL_CVSDK_DIR INF_ENGINE_ROOT_DIR IE_PLUGINS_PATH)
|
|
|
|
|
2018-02-07 16:28:45 +08:00
|
|
|
if(NOT INF_ENGINE_ROOT_DIR OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp")
|
2018-02-06 16:57:35 +08:00
|
|
|
set(ie_root_paths "${INF_ENGINE_ROOT_DIR}")
|
2018-02-06 21:23:18 +08:00
|
|
|
if(DEFINED INTEL_CVSDK_DIR)
|
2018-07-16 18:58:59 +08:00
|
|
|
list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}/")
|
|
|
|
list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}/deployment_tools/inference_engine")
|
2018-02-06 21:23:18 +08:00
|
|
|
endif()
|
2018-02-06 16:57:35 +08:00
|
|
|
|
2018-05-22 19:40:03 +08:00
|
|
|
if(NOT ie_root_paths)
|
2018-07-16 18:58:59 +08:00
|
|
|
list(APPEND ie_root_paths "/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/")
|
2018-02-06 16:57:35 +08:00
|
|
|
endif()
|
|
|
|
|
2018-02-07 16:28:45 +08:00
|
|
|
find_path(INF_ENGINE_ROOT_DIR include/inference_engine.hpp PATHS ${ie_root_paths})
|
2018-07-16 18:58:59 +08:00
|
|
|
if(INF_ENGINE_ROOT_DIR MATCHES "-NOTFOUND$")
|
|
|
|
unset(INF_ENGINE_ROOT_DIR CACHE)
|
|
|
|
endif()
|
2018-02-06 16:57:35 +08:00
|
|
|
endif()
|
|
|
|
|
2018-02-07 16:28:45 +08:00
|
|
|
set(INF_ENGINE_INCLUDE_DIRS "${INF_ENGINE_ROOT_DIR}/include" CACHE PATH "Path to Inference Engine include directory")
|
2018-02-06 16:57:35 +08:00
|
|
|
|
|
|
|
if(NOT INF_ENGINE_ROOT_DIR
|
|
|
|
OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}"
|
2018-05-31 19:05:21 +08:00
|
|
|
OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp"
|
2018-02-06 16:57:35 +08:00
|
|
|
)
|
2018-07-16 18:58:59 +08:00
|
|
|
message(WARNING "DL IE: Can't detect INF_ENGINE_ROOT_DIR location.")
|
2018-02-06 16:57:35 +08:00
|
|
|
ie_fail()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(INF_ENGINE_LIBRARIES "")
|
2018-02-07 16:28:45 +08:00
|
|
|
|
|
|
|
set(ie_lib_list inference_engine)
|
2018-03-28 21:34:37 +08:00
|
|
|
|
2018-07-16 18:58:59 +08:00
|
|
|
if(NOT IS_ABSOLUTE "${IE_PLUGINS_PATH}")
|
|
|
|
set(IE_PLUGINS_PATH "${INF_ENGINE_ROOT_DIR}/${IE_PLUGINS_PATH}")
|
|
|
|
endif()
|
|
|
|
|
2018-03-28 21:34:37 +08:00
|
|
|
link_directories(
|
2018-07-16 18:58:59 +08:00
|
|
|
${INF_ENGINE_ROOT_DIR}/external/mkltiny_lnx/lib
|
|
|
|
${INF_ENGINE_ROOT_DIR}/external/cldnn/lib
|
2018-03-28 21:34:37 +08:00
|
|
|
)
|
2018-02-07 16:28:45 +08:00
|
|
|
|
|
|
|
foreach(lib ${ie_lib_list})
|
2018-07-16 18:58:59 +08:00
|
|
|
find_library(${lib} NAMES ${lib} HINTS ${IE_PLUGINS_PATH})
|
2018-02-06 16:57:35 +08:00
|
|
|
if(NOT ${lib})
|
2018-07-16 18:58:59 +08:00
|
|
|
message(WARNING "DL IE: Can't find library: '${lib}'")
|
2018-02-06 16:57:35 +08:00
|
|
|
ie_fail()
|
|
|
|
endif()
|
|
|
|
list(APPEND INF_ENGINE_LIBRARIES ${${lib}})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set(HAVE_INF_ENGINE TRUE)
|