[QBS] How to specify dependency outside of the project heirarchy?
Tom Sutcliffe
devtomsci at me.com
Thu Mar 15 15:41:33 CET 2012
Hi list,
There was some discussion on earlier (http://lists.qt-project.org/pipermail/qbs/2012-February/000033.html) about how to support external dependencies using something like pkgconfig. I'm not quite that advanced in my package management, I'm in the more basic situation where I need to be able to Depend on something that is only known at the point I run qbs - because I'm adapting a project where I used to do:
qmake myproj.pro LIB_FOO_PRI=c:/path/to/libfoo.pri
---myproj.pro---
!isEmpty(LIB_FOO_PRI) {
DEFINES += FOO_AVAILABLE
SOURCES += foosupport.cpp
include($$LIB_FOO_PRI)
}
The best I can come up with is a qbs that looks like:
Product {
property string libFooDir: null
property bool fooSupport: libFooDir != null // For convenience
....
Depends {
condition: fooSupport
name: "LibFoo" // #### How to find libfoo.qbs??
}
Properties {
condition: fooSupport
cpp.defines: base.concat(['FOO_AVAILABLE'])
}
Group {
condition: fooSupport
files: ['foosupport.cpp']
}
}
And then (once https://bugreports.qt-project.org/browse/QBS-64 and maybe some of the others are fixed) I'd be able to say something like:
qbs product.libFooDir:c:/path/to/libfoo
Firstly I guess does this sound a sensible approach? For a start I don't really like having 3 blocks all with condition:fooSupport (it seems inelegant) and I don't really know if this is the "right" way to do external dependancies - I'm just tring to map from my .pro setup as directly as possible.
Assuming it is reasonable... how do I express the Depends block in the above, to say it needs to look in libFooDir? I tried messing with moduleSearchPaths but setting that within the product didn't seem to do the trick and I'm not really sure if that's intended for what I want anyway. Is there some other property I can set in a Depends block to change the lookup behaviour? On a side note where can I find the grammar for qbs files? I saw a link somewhere but can't find it now.
I'm writing libfoo.qbs at the same time with the intention of contributing it back to the relevant project, in case anyone's wondering why this qbs isn't inside my project heirarchy. I guess I could restructure everything so libfoo and myproject are in a common dir, but having avoided that (and proper package management under Windows) so far with qmake I'm reluctant to resort to it now. Also building the whole of libfoo with qbs is rather more than I dare undertake right now!
Thanks,
Tom
More information about the Qbs
mailing list