PDA

View Full Version : QtCreator project with libs, apps. Deployment to end user.



googie
28th February 2013, 21:33
Hi,

My setup: QtCreator 2.6.2, Qt 5.0.1, Linux slackware 32bit (current).

I'm trying to setup my QtCreator (or "pro" file?), so I can build application which has 1 shared library and 2 applications - both linking dynamically to that library. I've created Subdirs project, added library project, added 2 application projects, everything builds fine and runs fine under QtCreator.

Problem is that when the time comes and I'd like to prepare package for end users I need to have directory structure somehow like:
MyApp/
lib/
App1
App2and the problem here is that linker won't see those libraries. One solution is to add ./lib to LD_LIBRARY_PATH, but 1) this is not very nice solution, requires scripts for running the app, 2) it's not portable and I want to deploy my App to windows and mac in future.

How should it be done? How to tell QtCreator to create application binaries which point to specific relative path, regardless of platform? I assume that for final "Release" configuration I would have fixed directory structure and I can provide fixed relative paths for libs.

Santosh Reddy
28th February 2013, 21:43
How to tell QtCreator to create application binaries which point to specific relative path, regardless of platform?
I guess relative to the path containing the .pro file.


# this will create the binary in the .pro file path
DESTDIR = $$_PRO_FILE_PWD_

googie
28th February 2013, 21:47
EDIT:
Forget below. Just found http://qt-project.org/doc/qt-5.0/qtdoc/deployment.html Thread can be closed.


No, I don't mean "how to tell where to create binary". I mean "how to tell the binary application where is the library placed in relative position to the application binary" - in a portable way.

EDIT:
In other words:
Is there a way to define in qmake, that my "App1" should look for dynamically linked libraries in a subdirectory "./lib/"?

I want to be able to build on unix:
App/
lib/
libapp.so
app1
app2 and on windows
App\
lib\
app.dll
app1.exe
app2.exeby just defining "app" library to be a dynamically loaded library in app1 and app2 binary applications.