[QBS] External modules

Ruslan Nigmatullin EuroElessar at yandex.ru
Thu Sep 6 13:26:13 CEST 2012

Firstly, to minimize size of sources we introduced CommonModule with such syntax:

CommonModule {
    frameworkName: "qca"
    pkgConfigName: "qca2"
    libraryNames: ["qca", "qca2"]
    includeNames: ["qca.h"]
    includeSuffix: "QtCrypto"

It looks ugly, but covers most of usecases. As you see module name ("qca") doesn't contain all needed information for package lookup as it's library/framework/pkg-config name may vary and differ from module's one. Internally CommonModule contains several Probe's (Framework, PkgConfig, Library, Include) so it's too hard to implement the same logic for _every_ small module.

Secondly, we've implemented little part of kde's module, but it requires to ask "kde4-config" utility about paths for every submodule. It doesn't change during one execution of program, so may be there should be an mechanism to cache some values? May be some way to write result to session-life container, which would be shared between all modules? Proposed syntaxes:

var includePath;
if (!qbs.cache.contains("kde4-include")) {
    includePath = someHeavyFunction();
    qbs.cache.insert("kde4-include", includePath);
} else {
    includePath = qbs.cache.value("kde4-include");

Or this one:

var includePathCache = qbs.cache("kde4-include");
if (includePathCache.value === undefined)
    includePathCache.value = someHeavyFunction();
var includePath = includePathCache.value;

Or this one:

var includePath = qbs.cache("kde4-include", someHeavyFunction);

Or even introduce Cache element:

Cache {
    property string includePath: someHeavyFunction()

Any ideas?


05.09.2012, 16:49, "Joerg Bornemann" <joerg.bornemann at nokia.com>:
> On 05/09/2012 11:12, ext Ruslan Nigmatullin wrote:
>>  QBS contains already modules for cpp/qt. We've made modules for about 10 another libraries/frameworks, should they be merged to main tree as CMake do? Lookup works for GNU/Linux (or similar systems), MacOS X and Windows (if INCLUDE/PATH/LIB environment variables are set correctly).
> Nice! Having a convenient set of those in the main tree would be cool.
> If they are in the qbs repo the user doesn't have to look for stuff he
> wants in separate repos.
>>  Should I create one big patch or separate them to a lot of small ones?
> Doesn't need to be strictly on small commit per addition. Maybe grouped
> by topic or so.
> Cheers,
> Jörg

More information about the Qbs mailing list