[QBS] Depends and cpp.includePaths

Joerg Bornemann joerg.bornemann at nokia.com
Mon Feb 27 15:32:10 CET 2012

On 27/02/2012 13:22, ext Ruslan Nigmatullin wrote:

> Is qbs user have to name directory with sources in the same way and the same structure as it will be installed in /usr/include directory? Or user must have external pregenerated directory with pseudo headers fore each included header for each "possibly-not-system" library in source dir (for example libpng)?

No the user doesn't have to use the same directory layout for its source 
tree and the installed headers. See tests/manual/localDeployment for an 

 > Currently qbs doesn't handle dependencies to generated headers at all 
(so boo.cpp, which includes foo.h, can be processed before foo.h will be 
generated, which leads to compile error).

Of course does qbs handle dependencies to generated headers. Otherwise 
building Qt programs with .ui files wouldn't work at all.
Can you provide an example of something that's broken?

> The same issue is reproduced if "cpp" file is generated and it contains Q_OBJECT macro (Generated file "boo.cpp" contains directive for including "boo.moc"). Automoc doesn't handle it at all (as file is not created at the moment when check is performing). If tag "moc_cpp" is set manually qbs crashes. If crash is fixed and artifact for moc is created cpp's "obj" parent doesn't depend on it, so "g++" is called before "moc" and it again leads to compile error.

That automoc thingy cannot handle generated files ATM. That's true.

> The only way I found is to scan file for dependencies again right after it was generated and reapplying rules for it (that will add "moc_*" tag for generated files with Q_OBJECT macro). Also may be it's needed to check somehow for generatable headers at includes processing state. For example if "generated/foo.h" with fileTag "hpp" is generated by Rule from "foo.txt" and "boo.cpp" contains "#include<generated/foo.h>" the last one should depend on "foo.h".

Why does your .cpp generator not know whether its generating .cpp files 
that need to be moc'ed? It could just add the "moc_cpp" and "cpp" 
filetags and doesn't have to rely on automoc.



More information about the Qbs mailing list