13.08.2018 11:31, Christian Kandeler пишет:
On Sun, 12 Aug 2018 22:56:31 +0300
Карелин Павел <[email protected]> wrote:
I have a project in which, in addition to the main application,
auxiliary utilities are builded. In this regard, I have two questions:
1) How do I run an auxiliary utility right after his built, so that it
could generate necessary data?
It works the same way as always: You trigger creation of the data by giving it
some tag, and the tool's tag appears as some sort of input in the respective
rule (which has the data as outputs).
That's the problem, that I do not have clear how to do it.
Not so long ago I made a rule for compiling cuda-files. Here is a
shortened version:
Module {
id: cuda
Depends { name: "cpp" }
FileTagger {
patterns: "*.cu"
fileTags: ["cuda"]
}
Rule {
id: cudaCompiler
inputs: ["cuda"]
auxiliaryInputs: ["hpp"]
Artifact {
fileTags: ["obj"]
filePath: FileInfo.joinPaths(".obj",
Utilities.getHash(input.baseDir), input.fileName + ".o")
}
prepare: {
var args = [];
args.push(...);
var cmd = new Command("/usr/bin/nvcuda", args);
cmd.description = 'cuda compiling ' + input.fileName;
cmd.highlight = "compiler";
return cmd;
}
}
}
Everything is clear: there are files with the extension 'cu', the files
are connected to the project. And there is a cuda compiler: /usr/bin/nvcuda.
In the current project, instead of /usr/bin/nvcuda, the newly-built
utility should be used (call it sonnet_parsetrigrams). I do not
understand how to write it down. Also what should I write in the
FileTagger section? Files do not have an extension, these files are not
connected to the project. All that is - the name of the directory in
which these files are located. The call of the utility is as follows:
sonnet_parsetrigrams MyProjectDir/trigramsDir > trigrams.map
2) How to pass parameters to the auxiliary utility? The matter is that
the utility has one parameter - a directory name. It directory contains
text files without expansion, the utility has to process these files.
The output should be one file with the extension 'map'
You rule has to take care of that when creating the Command.
Christian
_______________________________________________
Qbs mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs
_______________________________________________
Qbs mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs