Fix non-OpenCV build: guard TrackedObjectBBox usage, move EffectMask test - #1087
Open
Chzrz89 wants to merge 1 commit into
Open
Fix non-OpenCV build: guard TrackedObjectBBox usage, move EffectMask test#1087Chzrz89 wants to merge 1 commit into
Chzrz89 wants to merge 1 commit into
Conversation
…test
Two issues break builds with ENABLE_OPENCV=OFF:
1. EffectBase::TrackedObjectMask() dereferences TrackedObjectBBox
methods unconditionally, but TrackedObjectBBox.cpp is only compiled
when OpenCV is enabled (it is in OPENSHOT_CV_SOURCES). This causes
undefined-reference linker errors on every non-OpenCV build.
Guard the method body with #ifndef USE_OPENCV and return an empty
mask: bounding boxes are only ever produced by OpenCV-based
trackers, so there is nothing to draw when OpenCV is absent.
Behavior is unchanged for OpenCV builds.
2. tests/EffectMask.cpp includes <opencv2/dnn.hpp> unconditionally,
but was registered in OPENSHOT_TESTS outside the HAVE_OPENCV block,
failing compilation of the test suite without OpenCV. Move it into
the existing if($CACHE{HAVE_OPENCV}) list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small fixes so the project builds with
ENABLE_OPENCV=OFF(currently it fails to link):1.
EffectBase::TrackedObjectMask()linker errorsThe method dereferences
TrackedObjectBBox::Contains()/GetBox()unconditionally, butTrackedObjectBBox.cppis only compiled when OpenCV is enabled (it lives inOPENSHOT_CV_SOURCES). Every non-OpenCV build dies with:Guarded the body with
#ifndef USE_OPENCV, returning an empty mask. This is semantically correct: bounding boxes are only ever produced by the OpenCV-based trackers, so with OpenCV absent there is nothing to draw. Behavior for OpenCV builds is unchanged.2.
tests/EffectMask.cppunconditionally registeredThe test includes
<opencv2/dnn.hpp>but was listed in the always-builtOPENSHOT_TESTSinstead of the existingif($CACHE{HAVE_OPENCV})block, failing test-suite compilation without OpenCV. Moved it under the guard, losing no coverage (it could never build without OpenCV).Testing
openshot-playerexample passes withENABLE_OPENCV=OFF