Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
1.2.0
-
None
Description
currently, Depends inside Export represent the link-time dependencies of the exported module literally. this is suboptimal:
- the specification is a redundant subset of the Product's Depends, which is unnecessarily verbose, and harder to maintain and tool
- it actually doesn't work: for the product type to be easily switchable (say, choosing on the command line whether to build a library statically or dynamically), the declaration of the dependencies of the Product itself must be complete, irrespective of how the linker needs to be invoked to build it.
- static libraries don't actually use their Depends, but forward them directly to their Export
- dynamic libraries link against their Depends
- there must be a flag to specify how these are forwarded to the Export
- public dependencies on other dynamic libs (which become part of the library's link interface) are exported, so they are added as an -L/-l pair by the user
- private dependencies on other dynamic libs also need to be exported, because some platforms (linux and bb10 at least) may need -rpath-link to resolve transitive dependencies
- there must be a flag to specify how these are forwarded to the Export
- applications also export their dependencies on dlls (privately), as they must be known when launching the application (see
QBS-583)
one possible approach is to "tag" dependencies with a property:
Product { Depends { name: "foo" //exported: false // the default } Depends { name: "bar" exported: true // "export" is a reserved word // publicly: true // alternative name, think "depends publicly" } }
a probably better approach is to nest the exported dependencies into the exports themselves. this mixes well with products that export multiple sub-products, as we do in qt itself:
Product { // equivalent of QT_PRIVATE += multimedia Depends { name: "multimedia" } Export { name: "qt.location" // equivalent of QT += gui Depends { name: "qt.gui" } } Export { name: "qt.location_private" // equivalent of QT_FOR_PRIVATE += quick Depends { name: "qt.quick" } } }
note that using this option would mean that the exported Modules would have to actually contain Export items to properly declare the type of their Depends.