PDA

View Full Version : QMake Project Files....



TemporalBeing
24th March 2009, 19:45
I have a structure like follows:




include
src
src/src.pro
src/<project>/<project stuff>
src/<project group>/<project>/<project stuff>
lib
lib.debug


I essentially have a number of widgets/objects/etc that I'd like to bundle into a series of static libraries for other projects to link against. I'd also like this to be centralized so the developer only has to do 'qmake && make' once and all the projects (or a sub-set thereof) get built and put into the 'lib' (for release) and 'lib.debug' (for debug) as needed. Then the main application can just search that one location during its link for its required libraries that I am providing.

I discovered the 'subdirs' template and it works very well, for the most part - allowing me to have a single point to compile the various projects. (cool). However, I am having some trouble with the release/debug side of doing the build.

I added the following to one of the sub-projects:




CONFIG += debug_and_release
CONFIG(debug,debug|release) {
DESTDIR = ../../lib.debug
} else {
DESTDIR = ../../lib
}



However, when I ran 'qmake && make' it only put binaries in the 'lib' folder - not the 'lib.debug' folder. I also could not do a 'make debug' or 'make release' at the parent (e.g. where src.pro is located). Is there any way to correct this? I am new to do all of this in qmake this way. (I have previously written scripts to manage VC++ projects in a lot more complicated manner that retrieved and built dependencies; but new to doing this part in Qt.)

Also, if possible, I'd rather have a line like:



DESTDIR = ${baseDir}/lib


instead of



DESTDIR = ../../lib


as I may have different depths involved and it would make building/modifying each project's pro file a lot simpler. Is there any variable I can use in this manner?

fullmetalcoder
24th March 2009, 21:28
I added the following to one of the sub-projects:




CONFIG += debug_and_release
CONFIG(debug,debug|release) {
DESTDIR = ../../lib.debug
} else {
DESTDIR = ../../lib
}

However, when I ran 'qmake && make' it only put binaries in the 'lib' folder - not the 'lib.debug' folder. I also could not do a 'make debug' or 'make release' at the parent (e.g. where src.pro is located). Is there any way to correct this?

You could add this to your project file

CONFIG += build_all

alternatively, if you don't want to force both modes to be build all the time you have to put this in every project file of the hierarchy (including those with subdirs template) :

CONFIG += debug_and_release

TemporalBeing
6th May 2009, 16:15
Okay - the 'debug_and_release' does manage that pretty well.

However, how do I get a parent project to build a child project:

mainprogram.src
dependency/dep1/dep1.src
dependency/dep2/dep2.src

I've tried using 'include' but that doesn't seem to work. Right now, I have to explicitly build the dependencies before building the main program.

This seems like something that the build system should be able to handle if told about the child dependency, but I can't figure it out.

I have figured out how to get the dependencies to build the PRL files though the mainprogram doesn't seem to be using them despite 'link_prl' being specified...