PDA

View Full Version : Is it possible to say to Qmake that copy the target to multiple destination?



tonnot
15th March 2011, 19:32
I'd want to copy the file build to multiple places.
I know I'd can do it with a bat, but it can generate errors (if you forget to execute it)
So I think that the best way can be to do the work when build.
I have seen a post from 2007, suggesting .command (or something like this).
Any help ?
Thanks

wysota
15th March 2011, 21:18
Have you tried what the post suggested? Why do you need to copy the same file into multiple places?

tonnot
16th March 2011, 10:29
mmm. I cant do nothing. But I have seen the system() element.

And... I want to write the code at .pro file.
Now I have :( a piece of .pro)

RESOURCES = icons.qrc
DESTDIR = $(QTDIR)/plugins/designer
message( "This is a message" )
system(copy d:/Qt/plugins/designer/apcplugins.dll d:/I_DESARROLLO/c++ok/MY_DLL)
I see at 'Compile Output window' then next :
Command syntax does not correct
Command syntax does not correct
Command syntax does not correct
RCC: Warning: No resources in '..\APCplugins\icons.qrc'.
mingw32-make: Leaving directory `D:/I_DESARROLLO/c++ok/APCplugins-build-desktop'
RCC: Warning: No resources in '..\APCplugins\icons.qrc'.
Project MESSAGE: This is a message
Project MESSAGE: This is a message
Project MESSAGE: This is a message
Three questions :
1.- system copy does not work
2.- I dont know whats happen, but I see the message and command error 3 times ???
3.- I have the impression that things are not executed in the order I have write at .pro file .
(RCC: Warning: No resources in '..\APCplugins\icons.qrc'. is true, I have nothing at icons.qrc but is does not matter)

Any help ? Thanks

wysota
16th March 2011, 10:46
Your code doesn't make sense (even if the system call was correct). You don't want to execute the command when qmake is ran but rather after the compilation. You should be taking advantage of the "make install" target although I still fail to understand why you would want the same file in two places.

tonnot
16th March 2011, 11:01
I expected that when build the project with Qtcreator, the content of the .pro file is 'executed' in the order I write it, but it seems I'm doing some strange.
What does qtcreator with my file ? It generates a makefile and then execute it , ins't it ? And is there any way to wait for the compilation and then execute the system commands ?
I want to have the same file in two places because it is a plugin dll, so I have to put it at \plugins\designer and at \myplace\mydll.
I have a \myplace\MYdll included into system path, so every program that needs some dll can find it at this place. (so I dont need to copy my dll's to windows/system or to every folder of my progs).
I hope you understand my explanation.
Thanks

wysota
16th March 2011, 11:10
I expected that when build the project with Qtcreator, the content of the .pro file is 'executed' in the order I write it
No, not really.


What does qtcreator with my file ?
It calls qmake and make.

And is there any way to wait for the compilation and then execute the system commands ?
Yes, you use the QMAKE_POST_LINK variable for that.


I want to have the same file in two places because it is a plugin dll, so I have to put it at \plugins\designer and at \myplace\mydll.
What for? If I correctly understand what you are doing then you should split your dll into two libraries where one is a plugin and the other is a functionality provided that the plugin links against. Then you have two libraries and each goes into its proper place.

tonnot
16th March 2011, 11:23
The library is the same, I have

DEFINES +=APCPLUG_LIB at .pro and

#if defined(APCPLUG_LIB)
#define A_TABLESHARED_EXPORT Q_DECL_EXPORT
at every .h of every custom widget I have .

It works for me. I have the dll as a plugin for designer and also for my project.
I'm doing it well isn't ?
I'm going to see QMAKE_POST_LINK
Thanks

wysota
16th March 2011, 11:24
I'm doing it well isn't ?
I would disagree.