Added OpenCV minimal versions (#19231)

This commit is contained in:
Ilya Lavrenov 2023-08-17 16:45:01 +04:00 committed by GitHub
parent 3e0f529700
commit 75b48e9cdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 12 deletions

View File

@ -5,6 +5,9 @@
function(ie_generate_dev_package_config)
# dummy check that OpenCV is here
find_package(OpenCV QUIET)
if(OpenCV_VERSION VERSION_LESS 3.0)
set(OpenCV_FOUND OFF)
endif()
foreach(component IN LISTS openvino_export_components)
# export all targets with prefix and use them during extra modules build
@ -37,6 +40,9 @@ endfunction()
function(ov_generate_dev_package_config)
# dummy check that OpenCV is here
find_package(OpenCV QUIET)
if(OpenCV_VERSION VERSION_LESS 3.0)
set(OpenCV_FOUND OFF)
endif()
foreach(component IN LISTS openvino_export_components)
# filter out targets which are installed by OpenVINOConfig.cmake static build case

View File

@ -38,7 +38,7 @@ endif()
# remove OpenCV related sources
find_package(OpenCV QUIET COMPONENTS core imgcodecs)
if(NOT OpenCV_FOUND)
if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 3)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ShapeInference.cpp")
endif()

View File

@ -16,8 +16,8 @@ add_library(${TARGET_NAME} STATIC ${HEADERS} ${SOURCES})
# Find OpenCV components if exist
find_package(OpenCV QUIET COMPONENTS core imgproc imgcodecs)
if(NOT OpenCV_FOUND)
message(WARNING "OPENCV is disabled or not found, ${TARGET_NAME} is built without OPENCV support")
if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 3)
message(WARNING "OpenCV ver. 3.0+ is not found, ${TARGET_NAME} is built without OPENCV support")
else()
target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV)
endif()

View File

@ -153,8 +153,8 @@ endif()
# Optional OpenCV dependency
find_package(OpenCV QUIET COMPONENTS core)
if(NOT OpenCV_FOUND)
message(WARNING "OpenCV is disabled or not found, ${TARGET_NAME} will be built without OpenCV support. Set OpenCV_DIR")
if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 3)
message(WARNING "OpenCV ver. 3.0+ is not found, ${TARGET_NAME} will be built without OpenCV support. Set OpenCV_DIR")
else()
target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV)
target_link_libraries(${TARGET_NAME} PRIVATE opencv_core)

View File

@ -18,8 +18,8 @@ add_library(${TARGET_NAME} STATIC ${MAIN_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLI
# Find OpenCV components if exist
find_package(OpenCV QUIET COMPONENTS core imgproc imgcodecs)
if(NOT OpenCV_FOUND)
message(WARNING "OpenCV is disabled or not found, ${TARGET_NAME} will be built without OpenCV support")
if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 3)
message(WARNING "OpenCV ver. 3.0+ is not found, ${TARGET_NAME} will be built without OpenCV support")
else()
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCV_LIBRARIES} ie_samples_utils)
if(UNIX AND NOT APPLE)

View File

@ -7,8 +7,8 @@ set(TARGET fluid_preproc_tests)
ov_deprecated_no_errors()
find_package(OpenCV QUIET COMPONENTS gapi core imgproc)
if(NOT OpenCV_FOUND)
message(WARNING "No suitable OpenCV version detected, ${TARGET} skipped")
if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 4)
message(WARNING "OpenCV ver. 4.0+ is not found, ${TARGET} skipped")
return()
endif()

View File

@ -9,11 +9,14 @@ set(TARGET_NAME "template_extension")
find_package(OpenVINO REQUIRED COMPONENTS Runtime OPTIONAL_COMPONENTS ONNX)
find_package(OpenCV QUIET COMPONENTS core)
if(OpenCV_VERSION VERSION_LESS 3)
set(OpenCV_FOUND OFF)
endif()
set(SRC cpu_kernel.cpp extension.cpp op.cpp)
if(OpenCV_FOUND)
set(SRC ${SRC} fft_kernel.cpp fft_op.cpp)
list(APPEND SRC fft_kernel.cpp fft_op.cpp)
endif()
add_library(${TARGET_NAME} MODULE ${SRC})

View File

@ -27,12 +27,12 @@ ov_add_test_target(
find_package(OpenCV QUIET COMPONENTS core imgproc)
if(OpenCV_FOUND)
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER_EQUAL 3.4)
message("-- Reference preprocessing: OpenCV tests are enabled")
target_compile_definitions(${TARGET_NAME} PRIVATE OPENCV_TEMPLATE_TESTS)
target_link_libraries(${TARGET_NAME} PRIVATE opencv_imgproc opencv_core)
else()
message("-- Reference preprocessing: OpenCV tests are disabled")
message("-- Reference preprocessing: OpenCV tests are disabled, because OpenCV ver. 3.4+ is not found")
endif()
if (ENABLE_INTEL_CPU)