Notes on linking Open CV with QMake

So, I'm going to talk about a few additions to linking OpenCV with qmake. The basic part involves setting up the include path, and then adding the needed libraries:

INCLUDEPATH += path/to/opencv/include
LIBS += -Lpath/to/opencv/lib -lopencv_core2410 -lopencv_highgui2410

On linux we can use pkg-config:

CONFIG += link_pkgconfig
PKGCONFIG += opencv

Although this simplicity, there's 2 things I don't like for the windows part of this configuration:

  • The PATH to Open CV binaries must be set for the application to run, or the binaries must be copied to our release manually
  • The version must be specified for each lib, which is a bit annoying when someone using a different version is using your code, and also whn releasing through a build server with a diffrent version, which you then have to configure specifically

To resolve these, I'll look into adding this functionality within an includable qmake project file.

Page : 1