Skip to content

Support OpenCV 5; cover both majors in CI#64

Merged
kmatzen merged 1 commit into
mainfrom
feat/opencv5-support
Jul 18, 2026
Merged

Support OpenCV 5; cover both majors in CI#64
kmatzen merged 1 commit into
mainfrom
feat/opencv5-support

Conversation

@kmatzen

@kmatzen kmatzen commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Fixes #56.

OpenCV's config treats major versions as incompatible, so find_package(OpenCV 4.0 REQUIRED) rejected 5.x outright. That is what broke macOS CI when Homebrew moved the opencv formula to 5.0.0. #57 papered over it by pinning to the keg-only opencv@4, which unblocked CI but left the underlying question open.

I checked before changing anything

Rather than relax the constraint and hope, I ran a throwaway probe job (run 29665231151) that built against OpenCV 5.0.0 on macOS with only the version pin changed:

-- Found OpenCV: /opt/homebrew/Cellar/opencv/5.0.0 (found version "5.0.0")
1/1 Test #1: framewright_tests ................   Passed    1.67 sec
100% tests passed out of 1

Library, examples and the full suite all clean. That pass is real, not the empty-suite result from #55ctest runs with --no-tests=error now.

This matches expectations: the OpenCV surface here is small (cv::Mat, cv::Vec3b, CV_8UC3) and none of it changed in 5.x.

Change

The constraint is unversioned with an explicit floor:

find_package(OpenCV REQUIRED)
if(OpenCV_VERSION VERSION_LESS 4.0)
    message(FATAL_ERROR "framewright requires OpenCV 4.0 or newer, found ${OpenCV_VERSION}")
endif()

A genuinely too-old OpenCV still fails, now with a readable message instead of the config-file rejection. The resolved version is printed at configure time.

CI covers both majors

Rather than trade one silent breakage for another. Pinning only to opencv@4 would let a future 5.x incompatibility land unnoticed; testing only 5 would drop the version most distributions still ship — Ubuntu's libopencv-dev is still 4.x, so the Linux job continues to cover that path too.

Matrix is now Linux (4.x via apt), macOS + opencv@4, macOS + opencv (5.x).

🤖 Generated with Claude Code

OpenCV's config treats major versions as incompatible, so
find_package(OpenCV 4.0 REQUIRED) rejected 5.x outright. That is what broke
macOS CI when Homebrew moved the opencv formula to 5.0.0, and #57 papered
over it by pinning to the keg-only opencv@4.

Verified before changing anything that OpenCV 5 actually works: a throwaway
probe job built the library, the examples and the full suite against 5.0.0
on macOS with only the version constraint relaxed, and everything passed.
The OpenCV surface here is small -- cv::Mat, cv::Vec3b, CV_8UC3 -- and none
of it changed in 5.x.

The constraint is now unversioned with an explicit floor, so a genuinely
too-old OpenCV still fails loudly with a readable message rather than the
config-file rejection. The resolved version is reported at configure time.

CI covers both majors rather than trading one silent breakage for another:
pinning only to opencv@4 would let a future 5.x incompatibility land
unnoticed, and testing only 5 would drop the version most distributions
still ship.

Fixes #56

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kmatzen
kmatzen merged commit 954c733 into main Jul 18, 2026
3 checks passed
@kmatzen
kmatzen deleted the feat/opencv5-support branch July 18, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCV 5 is not supported; macOS CI broke when Homebrew moved opencv to 5.0

1 participant