[Moved] Deployment including external libraries
-
I would like to know what is the best practice to get the external libraries (not the Qt Libraries) linked against my application into the release folder of me compiled application.
Step by step:
- I am compiling my application that includes some external libraries which are also written by myself.
- If i run the application thru Qt Creator, then it works fine. Thru windows explorer it tells me of course, that the dll's are missing.
- I would like within my build process, that this libraries are copied to the same folder as my executable is getting created.
What are the different ways to achieve this or what is the best practice?
-
You can define a destination folder in the pro file.
@
#define the directory, where the binary is placed
CONFIG(debug, debug|release) {
DESTDIR = ../debug
}
else {
DESTDIR = ../release
}
@ -
Thanks Gerolf, but this will specify the location of the executeable created. But this does not copy my linked libraries to the same folder.
-
AFAIK there is no means in qmake to achieve this directly. But you can get there with a little trick:
- write a script that copies everything into the right place
- add QMAKE_POST_LINK=/path/to/your/script to the .pro file
This will call your script every time your application is built (after the link step).
-
That worked perfect, thank you very much.
-
[quote author="Volker" date="1322649165"]AFAIK there is no means in qmake to achieve this directly. But you can get there with a little trick:
- write a script that copies everything into the right place
- add QMAKE_POST_LINK=/path/to/your/script to the .pro file
This will call your script every time your application is built (after the link step).[/quote]
[quote author="Stefan Walter" date="1323093437"]That worked perfect, thank you very much.[/quote]
Can you are give more information about scripting for this case?
-
[quote author="qxoz" date="1323098620"]
[quote author="Volker" date="1322649165"]AFAIK there is no means in qmake to achieve this directly. But you can get there with a little trick:- write a script that copies everything into the right place
- add QMAKE_POST_LINK=/path/to/your/script to the .pro file
This will call your script every time your application is built (after the link step).[/quote]
[quote author="Stefan Walter" date="1323093437"]That worked perfect, thank you very much.[/quote]
Can you are give more information about scripting for this case?
[/quote]
What i did is that i've used a variable "LIBS_TO_PUBLISH". In all my libraries include (*.pri) files, i am adding the required libraries (based on release or debug, windows, linux or macos).Then in my project file i created the following entry:
QMAKE_POST_LINK=copy_libs.bat ${TARGET_PATH} ${LIBS_TO_PUBLISH}i hope that explains enough, feel free to try it yourself :-)
-
Thanks a lot!