[QBS] Preserving independent module-properties when applying rules

Johannes.Matokic at microchip.com Johannes.Matokic at microchip.com
Fri Feb 21 11:15:14 CET 2014


I have a generic preprocessing tool that I use almost everywhere for different purposes.
This preprocessing tool generates the real files that are used in my products.
Now in some products there are files that require different module-properties. Let's assume I want to set cpp.optimization for one file.
Now the input for the preprocessor contains the right cpp.optimization while the preprocessed artifact doesn't have it anymore.
How can I preserve the module-properties without adding specific code for each possible property to the preprocessor module?

Below is an simplified example demonstrating this:

// The MyApp.qbs:
import qbs.base 1.0
Project {
    Application {
        name: "myapp"
        Depends { name: "cpp" }
        Depends { name: "preproc" }

        files: ["main.cpp.in", "example.h.in"]
        Group {
            files: ["example.cpp.in"]
            cpp.optimization: "none"

// And the preproc/module.qbs:
import qbs.base 1.0
import "helpers.js" as helpers
Module {
    FileTagger {
        pattern: "*.in"
        fileTags: "preproc_in"
    Rule {
        inputs: "preproc_in"
        Artifact {
            fileName: helpers.resolveName(input)
            fileTags: helpers.resolveTags(input)
        prepare: helpers.preprocCmd(product, inputs, outputs)

Is it possible to pass the cpp.optimization to the artifact without mentioning it explicitely in the preproc-module?
I want this because there are multiple different modules I use, each with its own independent properties.

Thank you

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20140221/8e8af57f/attachment.html>

More information about the Qbs mailing list