Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flat directory deployment for Qt 5 applications?

I'm deploying a Qt 5 application, compiled to windows. It turns out that some functionality is stored in plugins that are DLLs that have to be placed in a specific sub-directory, forcing me to use this structure:

applicaton directory
         |
         +------- platforms
         |           |
         +           +-------- qwindows.dll
         |
         +------- qpldrivers
         |           |
         |           +-------- qsqlite.dll
         | 
         +------- myprogram.exe, QtCore5.dll, etc.

I would like to flatten this directory so that qwindows.dll and qsqlite.dll (and any other future plugins) are stored in the same directory as my executable.

applicaton directory
         |
         +------- myprogram.exe, QtCore5.dll, qwindows.dll, qsqlite.dll, etc.

Is there a way to do this?

like image 547
Tamás Szelei Avatar asked Oct 22 '14 11:10

Tamás Szelei


People also ask

How do I deploy a QT program in Windows?

To deploy the application, we must make sure that we copy the relevant Qt DLLs (corresponding to the Qt modules used in the application) and the Windows platform plugin, qwindows. dll , as well as the executable to the same directory tree in the release subdirectory.


2 Answers

You can write a qt.conf file to customize were Qt looks for plugins.

http://doc.qt.io/qt-5/qt-conf.html

like image 186
Finn Avatar answered Oct 25 '22 05:10

Finn


Try to use addLibraryPath:

QCoreApplication::addLibraryPath(".");
QCoreApplication::addLibraryPath("otherLibDir");
like image 31
farcost Avatar answered Oct 25 '22 04:10

farcost