[Qbs] qm-file build as internal resource

2017-12-11 Thread Карелин Павел

Hi,

I'm build a third-party project. The peculiarity of the project is that 
qm-files are represented as internal resources.

Now I solved the problem with a terrible hack:
1) Created the 'Translations' product
Product {
    name: "Translations"
    type: "qm"
    destinationDirectory: project.sourceDirectory + "/translations"

    Depends { name: "Qt.core" }
    files: ["*.ts"]
}

2) The results of the work 'Translations' are located in the 
project.sourceDirectory + "/translations" directory

3) The main product made dependent on 'Translations'
Depends { name: "Translations" }

4) In the main product I cling the created qm-files through a qrc-resource
    Group {
    name: "translations"
    files: ["translations/translations.qrc"]
    }

Is it possible to solve this task in another way?
qm-resources should be placed by the path ":translations/"

--
BR, Pavel Karelin
___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


Re: [Qbs] Need help with setting up a code generator

2017-12-11 Thread Christian Kandeler
On Mon, 11 Dec 2017 12:38:03 +0100
Ola Røer Thorsen  wrote:

> The code generator (a commandline tool) takes a set of C header files (.h)
> in a given directory, and another set of template files (names matching
> .tpl, .h and .cpp) in another directory. 

StaticLibrary {
Depends { name: "cpp" }
Group { 
name: "header inputs"
files: ["dir1/*.h"]
fileTags: ["generator.in.headers"]
}
Group { 
name: "template inputs"
prefix: "dir2/"
files: ["*.tpl", "*.h", "*.cpp]
fileTags: ["generator.in.templates"]
}

> The output is a set of C++ .h and
> .cpp files in an output directory. The number of output files is not the
> same as the number of input files.

Rule {
// See https://doc.qt.io/qbs/rule-item.html for details.
multiplex: true // Probably. Not entirely clear from your description
inputs: ["generator.in.headers", "generator.in.templates"]

// I assume the number of output files is dynamic and depends on
// the number and/or contents of the input files.
outputFileTags: ["h", "cpp"]
outputArtifacts: {
// The following two are arrays of artifact objects.
// Their file paths are available via the filePath property.
var headerInputs = inputs["generator.in.headers"];
var templateInputs = inputs["generator.in.templates"];

var outList = [];
// Do what you need to do here to calculate the output 
// from the input artifacts. The return value is a list of
// objects with properties filePath and fileTags.
return outList;
}
prepare: {
var generatorArgs = [];
// Generate the command-line arguments for the generator tool
// from the inputs and outputs variables.
var cmd = new Command("generator.exe", generatorArgs);
cmd.description = "Running generator";
return [cmd];
}

// Use this property in the outputArtifacts script above.
property string generatedIncludesDir: product.buildDirectory + "/includes"

> The resulting .h and .cpp files are to be built into a static library. Also
> those header files must be available in the includepath to those needing
> it.

Export {
Depends { name: "cpp" }
cpp.includePaths: product.generatedIncludesDir
}
}

> Whenever any of the C headers or template files are modified, the code
> generator is to be run again.

This is basic built-in functionality.

> I'd really appreciate some hints or examples on how this can be done, I'm
> currently stuck trying to figure it out.

Hope this helps,
Christian
___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


[Qbs] Need help with setting up a code generator

2017-12-11 Thread Ola Røer Thorsen
Hi all,

I've got a code generator tool that I'm trying to include in a qbs project.
Currently it's been used in a project using qmake, but I'd like to move on
to qbs.

The code generator (a commandline tool) takes a set of C header files (.h)
in a given directory, and another set of template files (names matching
.tpl, .h and .cpp) in another directory. The output is a set of C++ .h and
.cpp files in an output directory. The number of output files is not the
same as the number of input files.

The resulting .h and .cpp files are to be built into a static library. Also
those header files must be available in the includepath to those needing
it.

Whenever any of the C headers or template files are modified, the code
generator is to be run again.

I'd really appreciate some hints or examples on how this can be done, I'm
currently stuck trying to figure it out.

Best regards,
Ola
___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


Re: [Qbs] Linking dynamic library with version

2017-12-11 Thread Christian Kandeler
On Sat, 9 Dec 2017 17:00:34 +0300
Карелин Павел  wrote:

> I need to connect the dynamic library 'soxr' to the QBS project.
> The system has a symlink of libsoxr.so.0 (with the version), but not 
> libsoxr.so
> How can I connect to the project libsoxr.so.0?

You can give the full file path in that case. Using ld's ":" syntax 
should also work; at least I don't think we fiddle with the string.


Christian
___
Qbs mailing list
Qbs@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs