Probably, I haven't made myself clear enough. Here's an example setup.
This is a dummy generator's module definition:

import qbs

import qbs.FileInfo

import qbs.TextFile


Module {

    id: testgen


    Rule {

        inputs: ["genxx"]

        Artifact {

            id: artifact

            filePath: FileInfo.path(input.filePath)  + "/" +
FileInfo.baseName(input.filePath) + "-gen.cpp"

            fileTags: ["cpp"]

        }

        prepare: {


            var cmd = new JavaScriptCommand();

            cmd.description =  'Running test generator';

            cmd.sourceCode = function(){

                var file = new TextFile(output.filePath, TextFile.WriteOnly);

                file.write("const int c = 5;");

                file.close();


            }


            return cmd;


        }

    }

}

This is a dependent product's description:

import qbs
DynamicLibrary
{    Group {        name: "generatorInput"        files: [
"testinput.h"        ]        fileTags: ['hpp', "genxx"]    }
    Group {        files:[            "a.h"        ]    }
    Depends {name: "cpp" }    Depends {name: "testgen" }
}

"testinput.h" file contains "#include "a.h" directive. Changing
testinput.h results in a generator run followed by a C++ compiler run.
Changing a.h results in no action, although in this case the generator
is intended to reprocess its input.


вт, 15 сент. 2020 г. в 17:47, Dan Pat <danni...@gmail.com>:

> Yes, the product does depend on the 'cpp' module. The include paths are
> fine, since the same header files are later used by the compiler. A little
> more detail: I use the Group language item to tag such headers
> appropriately.
> Assuming that the generator inputs tag is "genxx", the fileTags of the
> Group is  fileTags: ['hpp', 'genxx'].
>
> пн, 14 сент. 2020 г. в 20:52, Jochen Ulrich <jochen.ulr...@clausmark.com>:
>
>> But it will only scan for dependent header files if the product using the
>> code generator depends on the `cpp` module and if the `cpp.includePaths`
>> are set up correctly, right?
>> Is this the case?
>>
>> Best
>> Jochen
>>
>>
>>
_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

Reply via email to