it is desirable to support the case of several instances of the same logical module (i.e., modules with the same name) competing with each other within a Product's context.
fundamentally, there are two axes along which these instances can be distinguished:
- content (QBS-995): the modules have the same name, but differ by other properties which limit their suitability for a particular build. some such properties are:
- everything that affects ABI (target OS and architecture, toolchain vendor and version, exception model, etc.)
- build options that enforce dependencies, e.g. debug vs. release runtime on Windows
- build options that disable optional features
- source (QBS-1604, QBS-1658): the modules differ only by where they come from:
- a project may want to use a library which is already installed on the system, but still have an own copy of the library to have a fallback - think libpng in qt
- the system's library may be provided by several modules, like a pkg-config based probe, and a "hand-crafted" one ("inline" in the new qt configure's terms).
- external libraries will ideally come with own qbs files, one for each build.
- qbs iterates over products, collecting dependencies
- each dependency must be satisfied by a module or product
- which of these it should be (preferentially) is decided by examining qbsModuleSources (QBS-1658)
- if a product is chosen, that may cause it to be built in the first place (QBS-581) and decide about how it is built (QBS-1197)
- if a native module is chosen, qbsSearchPaths is scanned for it
- if a generated module is chosen, a provider needs to generate it (
- which provider(s) are used is decided by examining qbsModuleProviders (QBS-1604), and conversely, providers may be told which modules to actually generate (QBS-1662)
- providers may be configured by packages (QBS-1452)
- logically, all providers are executed, and the first module in the list (ordered by qbsModuleProviders) that matches the requirements (QBS-995) is used, though for efficiency the providers may be fed the desired module properties as well, so unsuitable modules can be omitted from generation a priori, and the search can be cut short after the first match