The OpenCV that I use, is installed via brew:
brew install opencv
and this is my .pro file configuration:
INCLUDEPATH += /usr/local/include/opencv4 \
/usr/local/include/opencv4/opencv2
LIBS += /usr/local/lib/libopencv_*
I use the macdeployqt command:
macdeployqt testopencv.app
At this point, the app cannot be opened on other Mac OS.
So, I use the otool -L command to see the path:
otool -L testopencv.app/Contents/MacOS/testopencv
I moved all the OpenCV libraries that I use, to the inside of the app, and changed all OpenCV paths to app internal paths.
Just like this.
cp /usr/local/opt/opencv/lib/libopencv_core.4.5.dylib /Users/plf/qt/testopencv/testopencv.app/Contents/Frameworks/
install_name_tool -change /usr/local/opt/opencv/lib/libopencv_core.4.5.dylib @executable_path/../Frameworks/libopencv_core.4.5.dylib testopencv.app/Contents/MacOS/testopencv
until all OpenCV paths become
@executable_path/... /Frameworks/xxxxxxxxx
But now I moved the packaged app to other Mac OS but it still doesn't work.
What should I have to do? Is there any extra step?