Merge pull request #20026 from ilya-lavrenov:inference-engine-version-from-cmake
authorIlya Lavrenov <ilya.lavrenov@intel.com>
Mon, 24 May 2021 16:19:07 +0000 (19:19 +0300)
committerGitHub <noreply@github.com>
Mon, 24 May 2021 16:19:07 +0000 (16:19 +0000)
* Extract IE version from IE cmake config

* Update cmake/OpenCVDetectInferenceEngine.cmake

Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
cmake/OpenCVDetectInferenceEngine.cmake

index 216c02c3ccc255f1a169527e7774a6508f38a0dd..2c0296d6346381192a40b1df88508367cd2e1be1 100644 (file)
@@ -134,10 +134,14 @@ endif()
 # Add more features to the target
 
 if(INF_ENGINE_TARGET)
+  if(InferenceEngine_VERSION VERSION_GREATER_EQUAL "2021.4")
+    math(EXPR INF_ENGINE_RELEASE "${InferenceEngine_VERSION_MAJOR} * 1000000 + ${InferenceEngine_VERSION_MINOR} * 10000 + ${InferenceEngine_VERSION_PATCH} * 100")
+  endif()
   if(NOT INF_ENGINE_RELEASE)
     message(WARNING "InferenceEngine version has not been set, 2021.3 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
+    set(INF_ENGINE_RELEASE "2021030000")
   endif()
-  set(INF_ENGINE_RELEASE "2021030000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)")
+  set(INF_ENGINE_RELEASE "${INF_ENGINE_RELEASE}" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)")
   set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
     INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
   )