[QBS] Link static libraries with shared library.
Ruslan Nigmatullin
EuroElessar at yandex.ru
Fri Sep 28 14:24:01 CEST 2012
I guess that QBS script for application should be able to have access to all other products somehow, smth like this:
CppApplication {
name: "myapp"
cpp.staticLibraries: {
var libraries = [];
for (var i in project.products) {
var product = project.products[i];
if (product.type.indexOf('staticplugin')) {
var plugins = product.artficats.staticplugin;
for (var j in plugins)
libraries.push(plugins[j].fileName);
}
}
return libraries;
}
}
But it's ugly as we can't resolve product dependencies. May be it's possible to create automatic Depends notation? Like this:
CppApplication {
name: "myapp"
// Pick up all artifacts with this tag from all products
Depends {
id: staticPlugins
fileTags: "staticplugin"
}
// So qbs could determine all out dependencies and application will be built correctly
cpp.staticLibraries: {
var result = [];
for (var i in staticPlugins)
result.push(staticPlugins[i].fileName);
return result;
}
This looks better, but breaks current idea that all dependencies are listed directly.
Ruslan
24.09.2012, 17:38, "Bornemann Joerg" <Joerg.Bornemann at digia.com>:
> Hi Sergei,
>
>> I have a library (lib.so) and some plugins depends on this library.
>> So all plugins build as shared libraries and link with lib.so.
>
> If I understand you correctly, you have a dynamic library lib.so and a bunch of static libraries (the "plugins").
> You want to let lib.so link against the static libs but you don't want to specify the dependencies in lib.qbp but in the project files of the plugins.
>
> Picking up dependencies automatically from a subdirectory or subproject is not supported unless you do some magic in a .js file.
>
> BR,
>
> Jörg
More information about the Qbs
mailing list