12
votes

QMAKE: Comment copier-la conception du répertoire de sortie .dll / .so?

J'ai un projet QT qui construit une bibliothèque DLL / Shared et un autre projet QT qui teste la bibliothèque.

Y a-t-il un bon moyen d'avoir QMake Copier la DLL au dossier de sortie du projet de test?


0 commentaires

6 Réponses :


2
votes

Cela peut ne pas être une «bonne» voie, mais cela peut faire le tour.

qmake_post_link + = une commande shell pour copier la DLL


0 commentaires


8
votes

Ajoutez ceci à votre fichier PRO:

target.path = ../testProject/$$TARGET
INSTALLS += target 


2 commentaires

Cela ne fonctionne que si vous exécutez faire installer Étape de construction


Cela met la responsabilité sur le projet testé, de connaître le projet qui le teste - qui est en retard.



7
votes
# Copy the dynamic library.
win32 {
   QMAKE_PRE_LINK=copy /Y lib\qextserialport\src\build\qextserialportd.dll debug\ & copy /Y lib\qextserialport\src\build\qextserialport.dll release\
}
else {
   # TODO: Unices
}
This works, for the QextSerialPort library. Supports Qt's debug_and_release mode.QMAKE_POST_LINK also works, but will throw an error if you're trying to run the app immediately: then your .dll will be copied too late. QMAKE_PRE_LINK does copy it in time.

0 commentaires

2
votes

1 commentaires

C'est l'inverse - Copie l'exécutable à Desdir (où peut être). C'était un ajustement encore meilleur pour mon cas, merci pour l'indice.



1
votes
QMAKE_POST_LINK += $$QMAKE_COPY $$quote("yourSrcDir\your.dll") $$quote($$IN_PWD) $$escape_expand(\\n\\t)

0 commentaires