Library Loading and search paths on OSX

I recently had to deal with linking and runtime loading libraries on Mac OS, which I found to work quite a bit differently than windows and linux systems, so I thought I would share my notes on the matter.


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.

Hello and thanks for dropping by.

This blog is mostly deals with solutions I find in certain areas of programming. The categories I write about can vary depending on what I'm working on at the moment. Within the last period I've been mostly dealing with Qt and C++. 

Page : 1