Fixed compilation without OpenCV (#2309)
authorIlya Lavrenov <ilya.lavrenov@intel.com>
Fri, 18 Sep 2020 03:30:29 +0000 (06:30 +0300)
committerGitHub <noreply@github.com>
Fri, 18 Sep 2020 03:30:29 +0000 (06:30 +0300)
inference-engine/ie_bridges/c/tests/CMakeLists.txt
inference-engine/tests/unit/inference_engine/CMakeLists.txt
inference-engine/tests/unit/inference_engine/saturated_cast_test.cpp

index 4feae6b..761c23a 100644 (file)
@@ -7,9 +7,8 @@ set(TARGET_NAME "InferenceEngineCAPITests")
 # Find OpenCV components if exist
 find_package(OpenCV COMPONENTS imgcodecs videoio imgproc QUIET)
 if(NOT OpenCV_FOUND)
-    message(WARNING "OPENCV is disabled or not found, " ${TARGET_NAME} " is built without OPENCV support")
-else()
-    add_definitions(-DUSE_OPENCV)
+    message(WARNING "OPENCV is disabled or not found, " ${TARGET_NAME} " is disabled")
+    return()
 endif()
 
 add_executable(${TARGET_NAME} ie_c_api_test.cpp test_model_repo.hpp)
index e4613f0..a23ca05 100644 (file)
@@ -7,7 +7,7 @@ set(TARGET_NAME ieUnitTests)
 # Find OpenCV components if exist
 find_package(OpenCV COMPONENTS imgcodecs videoio imgproc QUIET)
 if(NOT OpenCV_FOUND)
-    message(ERROR "OPENCV is disabled or not found, " ${TARGET_NAME} " needs OpenCV for its build")
+    message(WARNING "OPENCV is disabled or not found, " ${TARGET_NAME} " needs OpenCV for its build")
 else()
     add_definitions(-DUSE_OPENCV)
 endif()
index c89169e..1667fb9 100644 (file)
@@ -8,6 +8,8 @@
 #include "precision_utils.h"
 #include "ie_precision.hpp"
 
+#ifdef USE_OPENCV
+
 #include <opencv2/core.hpp>
 
 using namespace InferenceEngine;
@@ -112,3 +114,5 @@ TEST_F(SaturateCastTestsU16ToI32, U16toI32FMaxToNonMax) {
     const auto value = std::numeric_limits<fromType>::max();
     EXPECT_EQ(PrecisionUtils::saturate_cast<toType>(value), cv::saturate_cast<toType>(value));
 }
+
+#endif  // USE_OPENCV