This morning I tried the following solution (see below). got this error

:-1: ошибка: The process '/home/hkarel/CProjects/QGit/build/Debug/bin/sonnet_parsetrigrams'
could not be started: execve: Permission denied.
The full command line invocation was: /home/hkarel/CProjects/QGit/build/Debug/bin/sonnet_parsetrigrams /home/hkarel/CProjects/QGit/src/spellcheck/sonnet/trigrams /home/hkarel/CProjects/QGit/build/Debug/trigrams.map

I assumed that the sonnet_parsetrigrams helper appl would be built earlier than needed in the idtrigrams rule, but that didn't work.


--- qgit_project.qbs ---
import qbs
import "qbs/imports/QbsUtl/qbsutl.js" as QbsUtl

Project {
    name: "QGit (Project)"
    minimumQbsVersion: "1.18.0"
    qbsSearchPaths: ["qbs"]
    ...
    references: [
        "src/qgit.qbs",
        "src/spellcheck/sonnet/parsetrigrams.qbs",
    ]
}

--- parsetrigrams.qbs ---
import qbs
import qbs.FileInfo

Product {
    name: "SonnetParseTrigrams"
    targetName: "sonnet_parsetrigrams"
    condition: true

    type: "application"
    destinationDirectory: "./bin"

    Depends { name: "cpp" }
    Depends { name: "Qt"; submodules: ["core"] }

    cpp.defines: project.cppDefines
    cpp.cxxFlags: project.cxxFlags
    cpp.cxxLanguageVersion: project.cxxLanguageVersion

    // This declaration is needed to suppress Qt warnings
    cpp.systemIncludePaths: Qt.core.cpp.includePaths

    files: [
        "parsetrigrams.cpp"
    ]
}

--- qgit.qbs ---
import qbs
import qbs.FileInfo

Product {
    name: "QGit"
    targetName: "qgit"

    type: "application"
    destinationDirectory: "./bin"

    Depends { name: "cpp" }
    Depends { name: "SonnetParseTrigrams" }
    Depends { name: "Qt"; submodules: ["core", "widgets"] }

    ....

    Group {
        fileTags: "trigrams"
        //files: FileInfo.joinPaths(project.buildDirectory, "*.trgmap")
        //files: "spellcheck/sonnet/trigrams/*.trg"
        files: "/home/hkarel/CProjects/QGit/src/spellcheck/sonnet/trigrams/*"
    }
    Group {
        fileTagsFilter: ["trigrams-map"]
        //fileTagsFilter: ["sonnet-parse-trigrams-run"]
        fileTags: ["qt.core.resource_data"]
    }
    Qt.core.resourceFileBaseName: "trigrams1"
    Qt.core.resourcePrefix: "trigrams1"

    Rule {
        inputs: ["trigrams"]
        multiplex: true

        Artifact {
            fileTags: ["trigrams-map"]
            filePath: FileInfo.joinPaths(product.buildDirectory, "trigrams.map")
        }
        prepare: {
            //var runUtl = input.filePath;
            var runUtl = FileInfo.joinPaths(project.buildDirectory, "bin/sonnet_parsetrigrams");             var sourceDir = FileInfo.joinPaths(product.sourceDirectory, "spellcheck/sonnet/trigrams");             var outputFile = FileInfo.joinPaths(project.buildDirectory, "trigrams.map");

            console.info("=== runUtl ===");
            console.info(input);
            console.info(inputs);
            console.info(runUtl);
            console.info(sourceDir);
            console.info(outputFile);

            var cmd = new Command(runUtl, [sourceDir, outputFile]);
            cmd.description = "sonnet parse trigrams";
            cmd.highlight = "filegen";
            return cmd;
        }
    }
}

--
Pavel



09.02.2021 20:33, Карелин Павел пишет:


09.02.2021 16:06, Christian Kandeler пишет:
On 2/9/21 1:04 PM, Карелин Павел wrote:
Hello!

I need to build  components of the project  in a specific sequence:
1) Build of auxiliary generator program;
2) Generate a resource file using the generator received in step 1;
3) Add the resource file obtained in step 2 to project QRC-file;
4) Build the main project program with the QRC-file obtained in step 3.

I previously asked a similar question (https://lists.qt-project.org/pipermail/qbs/2018-August/002223.html), and how to perform steps 1, 2 I know roughly. However, this decision seems to me to be somewhat confusing (not transparent), so I wanted to know maybe at the moment there is a simpler (transparent) solution.

I have no understanding of how, after points 1,2 to be followed points 3 and 4, so I ask for help with the solution.

If by "add the resource file" you mean you have a hand-written qrc file and you want to merge a generated file into it, then that's not possible (unless you do the merging "manually" in a dedicated rule and tag the result afterwards). However, if you do it "correctly" by having the qrc file be auto-generated from files tagged as resource data, then the whole thing is straightforward.

You might want to tell us what exactly you are struggling with and why, so it becomes easier to help.
Yes, I do not particularly struggle with anything:) This task can be solved in another way (without a resource file). I was just interested in trying out QBS capabilities. Perhaps in the future there will be a problem that can only be solved in this way.

Here is my task: I am making a mechanism for checking spelling. The mechanism requires a map of language trigrams. The trigram map is generated from trigram files (https://github.com/hkarel/qgit/tree/3x-spellcheck/src/spellcheck/sonnet/trigrams). This work is just done by the utility "AuxiliaryApplication." Next, I planned to add this trigram map to the program as a resource.

Regarding auto-generated qrc file: if such a generated file can be used together with the manual qrc file, then I will totally agree such a solution.



Christian

_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

Reply via email to