SubProjects
-
how to set the libs generated by the sub projects in to a common folder and other files in to other folders ................................?
-
Use DESTDIR or DLLDESTDIR.
-
DESTDIR just move all the files
and DLLDESTDIR moves the dll files.
but i need to move the .lib files
is there any other ways -
# copies the given files to the destination directory defineTest(copyToDestDir) { files = $$1 dir = $$2 # replace slashes in destination path for Windows win32:dir ~= s,/,\\,g for(file, files) { # replace slashes in source path for Windows win32:file ~= s,/,\\,g QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dir) $$escape_expand(\\n\\t) } export(QMAKE_POST_LINK) } copyToDestDir(from, to)
-
@j-hilk can you explain the code
-
@gregoryjithin
the code & and comments should make it rather self explanatory, don't you think? -
@j-hilk i think it just copy the file.
but I need to organize my build. when i build my app i need to put all the .lib files produced by the sub-projects in to a lib folder in the project directory. also I need to put other files to bin folder in my project directory -
@gregoryjithin it copies the whole content of on folder into the other
-
@j-hilk that's the point. I don't need it.
I already told you what I need in the above reply -
@gregoryjithin said in SubProjects:
@j-hilk that's the point. I don't need it.
I already told you what I need in the above replyis there anyone can help me........................................................?
-
@gregoryjithin said in SubProjects:
DESTDIR just move all the files
What are "all"?
You can use OBJECTS_DIR, RCC_DIR, UIC_DIR and UI_DIR to redirect all build artifacts elsewhere. See https://github.com/sierdzio/spdr/blob/master/definitions.pri (does a different thing, but could help).
-
@sierdzio it doesn't move the .lib file
and unfortunately i need that.
is there any other way -
@gregoryjithin said in SubProjects:
@sierdzio it doesn't move the .lib file
and unfortunately i need that.
is there any other wayPerhaps you've just run into this bug. This is especially tricky in subprojects. Do you run with
CONFIG+=ordered
in your main .pro file? It can help (although it is considered bad practice). -
@sierdzio NO.
i just used Depends keyword.
here is my pro file.and I used pri file to configure the build
here is it.
i need to move .lib files generated by the subprojects to $$PWD/out/lib/debug
but itt move all the other files too. -
@gregoryjithin
that's actually exactly for what I use the post link function, that I posted earlier, use forDESTDIR = plugins # copies the given files to the destination directory defineTest(copyToDestDir) { files = $$1 dir = $$2 # replace slashes in destination path for Windows win32:dir ~= s,/,\\,g for(file, files) { # replace slashes in source path for Windows win32:file ~= s,/,\\,g QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dir) $$escape_expand(\\n\\t) } export(QMAKE_POST_LINK) } copyToDestDir(plugins, ../../MainApplication/deployment/plugins/subProject1)
-
@j-hilk
where do i put this function
also I am using windows .
what you mean byreplace slashes in destination path for Windows
this. I didn't understand.
can you please explain -
@gregoryjithin
it would go inside the project file of your sub projects (once in each, where you want top copy the dlls away from)QMake uses
/
as separator that, that won't work for the native copy call on windows, sowin32:file ~= s,/,\\,g
automatically replaces those, if windows is detected as the target OS -
it copied all files
but i need only the highlighted lib files.
any way to filter them. -
@gregoryjithin
I'm unsure,qmake has a contains check
https://doc.qt.io/qt-5/qmake-test-function-reference.html#contains-variablename-valueso maybe :
for(file, files) { # replace slashes in source path for Windows win32:file ~= s,/,\\,g contains(file, lib){ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dir) $$escape_expand(\\n\\t) } }
untested however
-
@j-hilk said in SubProjects:
contains(file, lib){
No luck bro.
It copy all the files and remove directories but no filtering