Skip to content

Commit 1daf3e8

Browse files
committed
snapshot-macos: disable HAVE_COCOA -> headless highgui (match linux)
OpenCV 5 sets HAVE_COCOA unconditionally on APPLE+clang (no WITH_COCOA switch), pulling window_cocoa.mm which mcpp can't compile (.mm unsupported) -> undefined Cocoa symbols at link. Neutralize the one cmake line so highgui falls through to the headless path, identical API surface to linux (no GUI window backend).
1 parent 7b27f0e commit 1daf3e8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/snapshot-macos-opencv.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ jobs:
2323
echo "b0528f5a1d379d59d4701cb28c36e22214cc51cf64594e5b56f2d3e6c0233095 opencv.tar.gz" | shasum -a 256 -c -
2424
tar -xzf opencv.tar.gz
2525
echo "OPENCV_SRC=$PWD/opencv-5.0.0" >> "$GITHUB_ENV"
26+
# Headless highgui on macOS to MATCH linux (same API surface, no GUI backend):
27+
# mcpp cannot compile window_cocoa.mm (.mm/Objective-C++ unsupported), and
28+
# OpenCV 5 has no WITH_COCOA switch — HAVE_COCOA is set unconditionally on
29+
# APPLE+clang in cmake/OpenCVFindLibsGUI.cmake. Neutralize that one line so the
30+
# highgui elseif-chain falls through to the headless path (like linux w/o GTK/Qt).
31+
sed -i.bak 's/set(HAVE_COCOA YES)/message(STATUS "mcpp: HAVE_COCOA disabled -> headless highgui (matches linux)")/' \
32+
"$PWD/opencv-5.0.0/cmake/OpenCVFindLibsGUI.cmake"
33+
grep -n 'HAVE_COCOA\|mcpp: HAVE_COCOA' "$PWD/opencv-5.0.0/cmake/OpenCVFindLibsGUI.cmake" || true
2634
- name: build static ffmpeg prefix (videoio backend discovery)
2735
run: |
2836
set -eux

0 commit comments

Comments
 (0)