Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
It would be cool, if a Product could be configured and multiplexed through a Depends item to it.
Consider the following imaginary project:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Engine is a independently developed product, that is only added as dependency to the project.
The Engine is configurable through defines, that can enable and disable parts of it.
Since Engine has quite a lot of library dependencies, it would make sense if products depending on it can configure it, to avoid unneeded dependencies.
StaticLibrary { name: "Engine" property bool withGraphics: false property bool withAudio: false property bool withNetwork: false property bool withPng: false property bool withJpg: false cpp.defines: { var result = []; if(withGraphics) result.push("HAVE_GRAPHICS"); if(withAudio) result.push("HAVE_AUDIO"); ... return result; } cpp.dynamicLibraries: { var result = []; if(withGraphics) result.concat(["SDL2", "GL"]); if(withAudio) result.push("OpenAL"); ... return result; } }
Product { name: "Some Singleplayer-Game" Depends { name: "Engine"; withGraphics: true; withAudio: true; withPng: true } }
Product { name: "Some Multiplayer-Game" Depends { name: "Engine"; withGraphics: true; withAudio: true; withNetwork: true; withJpg: true } }
If those two products depending on Engine are in the same project, then the Engine would have to be built twice with different configuration (= multiplexed over the passed configuration options).
Syntax-wise this could maybe be achieved by adding a flag to the property definition, like:
property multiplex bool withGraphics: false
Splitting the Engine's components is not possible in our case, because the core would still have to be re-compiled with the defines to make use of the respective components.
Is there a mechanism in qbs to support such a project-setup already, that I wasn't able to find?
Attachments
Issue Links
- depends on
-
QBS-1625 establish syntax & semantics for constraining dependencies
- Reported