Merge pull request #11985 from alalek:cmake_update_inference_engine_detection

pull/12029/head
Alexander Alekhin 6 years ago
commit 60994389a6
  1. 33
      cmake/OpenCVDetectInferenceEngine.cmake

@ -16,25 +16,27 @@ macro(ie_fail)
endmacro() endmacro()
if(NOT HAVE_CXX11) 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() ie_fail()
endif() 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") 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}") set(ie_root_paths "${INF_ENGINE_ROOT_DIR}")
if(DEFINED ENV{INTEL_CVSDK_DIR})
list(APPEND ie_root_paths "$ENV{INTEL_CVSDK_DIR}")
list(APPEND ie_root_paths "$ENV{INTEL_CVSDK_DIR}/inference_engine")
endif()
if(DEFINED INTEL_CVSDK_DIR) if(DEFINED INTEL_CVSDK_DIR)
list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}") list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}/")
list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}/inference_engine") list(APPEND ie_root_paths "${INTEL_CVSDK_DIR}/deployment_tools/inference_engine")
endif() endif()
if(NOT ie_root_paths) if(NOT ie_root_paths)
list(APPEND ie_root_paths "/opt/intel/deeplearning_deploymenttoolkit/deployment_tools/inference_engine") list(APPEND ie_root_paths "/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/")
endif() endif()
find_path(INF_ENGINE_ROOT_DIR include/inference_engine.hpp PATHS ${ie_root_paths}) 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() endif()
set(INF_ENGINE_INCLUDE_DIRS "${INF_ENGINE_ROOT_DIR}/include" CACHE PATH "Path to Inference Engine include directory") set(INF_ENGINE_INCLUDE_DIRS "${INF_ENGINE_ROOT_DIR}/include" CACHE PATH "Path to Inference Engine include directory")
@ -43,6 +45,7 @@ if(NOT INF_ENGINE_ROOT_DIR
OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}" OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}"
OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp" OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp"
) )
message(WARNING "DL IE: Can't detect INF_ENGINE_ROOT_DIR location.")
ie_fail() ie_fail()
endif() endif()
@ -50,19 +53,19 @@ set(INF_ENGINE_LIBRARIES "")
set(ie_lib_list inference_engine) set(ie_lib_list inference_engine)
if(NOT IS_ABSOLUTE "${IE_PLUGINS_PATH}")
set(IE_PLUGINS_PATH "${INF_ENGINE_ROOT_DIR}/${IE_PLUGINS_PATH}")
endif()
link_directories( link_directories(
${INTEL_CVSDK_DIR}/inference_engine/external/mkltiny_lnx/lib ${INF_ENGINE_ROOT_DIR}/external/mkltiny_lnx/lib
${INTEL_CVSDK_DIR}/inference_engine/external/cldnn/lib ${INF_ENGINE_ROOT_DIR}/external/cldnn/lib
) )
foreach(lib ${ie_lib_list}) foreach(lib ${ie_lib_list})
find_library(${lib} find_library(${lib} NAMES ${lib} HINTS ${IE_PLUGINS_PATH})
NAMES ${lib}
# For inference_engine
HINTS ${IE_PLUGINS_PATH}
HINTS "$ENV{IE_PLUGINS_PATH}"
)
if(NOT ${lib}) if(NOT ${lib})
message(WARNING "DL IE: Can't find library: '${lib}'")
ie_fail() ie_fail()
endif() endif()
list(APPEND INF_ENGINE_LIBRARIES ${${lib}}) list(APPEND INF_ENGINE_LIBRARIES ${${lib}})

Loading…
Cancel
Save