Skip to content

Commit

Permalink
CMake: Reject OpenCV 4.5.1, prepare for 4.5.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Apr 24, 2021
1 parent 52f2b33 commit eef960a
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/CMakeLists.txt
Expand Up @@ -393,7 +393,14 @@ if(ENABLE_OPENCV)
find_package(OpenCV 4)
if(NOT OpenCV_FOUND)
set(ENABLE_OPENCV FALSE CACHE BOOL
"Build with OpenCV algorithms (requires Boost, Protobuf 3)" FORCE)
"Build with OpenCV algorithms (requires Protobuf 3)" FORCE)
# If we have version 4.5.1, all hope is lost
elseif(OpenCV_VERSION VERSION_EQUAL 4.5.1)
message(SEND_ERROR [[Incompatible OpenCV version detected
OpenCV version 4.5.1 contains header errors which make it unable to be used with OpenShot. OpenCV support wil be disabled. Upgrade to OpenCV 4.5.2+ or downgrade to 4.5.0 or earlier, to enable OpenCV.
See https://github.com/opencv/opencv/issues/19260]])
set(ENABLE_OPENCV FALSE CACHE BOOL
"Build with OpenCV algorithms (requires Protobuf 3)" FORCE)
else()
add_subdirectory(protobuf_messages)
# Add OpenCV source files
Expand All @@ -409,10 +416,20 @@ if(ENABLE_OPENCV)
opencv_tracking
openshot_protobuf
)
set(HAVE_OPENCV TRUE CACHE BOOL "Building with OpenCV effects" FORCE)
mark_as_advanced(HAVE_OPENCV)
set(HAVE_OPENCV TRUE CACHE BOOL "Building with OpenCV effects" FORCE)
mark_as_advanced(HAVE_OPENCV)

# Keep track of OpenCV version, to embed in our version header
set(OPENCV_VERSION_STR "${OpenCV_VERSION}" CACHE STRING "OpenCV version linked with" FORCE)
mark_as_advanced(OPENCV_VERSION_STR)

# We may need to use Tracker as opencv::legacy::Tracker
if(OpenCV_VERSION VERSION_GREATER_EQUAL 4.5.2)
target_compile_definitions(openshot PUBLIC USE_LEGACY_TRACKER=1)
endif()

endif()
endif()
endif() # ENABLE_OPENCV
add_feature_info("OpenCV algorithms" ENABLE_OPENCV "Use OpenCV algorithms")

############### LINK LIBRARY #################
Expand Down

0 comments on commit eef960a

Please sign in to comment.