Re: [Qbs] Specify custom applications and application arguments in qbs project

2020-09-21 Thread Christian Kandeler
On Mon, 21 Sep 2020 13:15:58 +
Jochen Ulrich  wrote:

> PS: And if you want to run an executable which is built as part of your 
> project, then the product should of course depend on that executable to make 
> sure it is built before.

Yes.

> And the rule should use the executable's `Product.targetName` and ` 
> Product.destinationDirectory` properties to determine the path of the 
> executable.

No. Instead, the rule should take "application" (or a more unique tag if 
necessary) as "explicitlyDependsOnFromDependencies" and access the executable 
via the artifact, i.e. "explicitlyDependsOn.application[0].filePath".


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


Re: [Qbs] Specify custom applications and application arguments in qbs project

2020-09-21 Thread Jochen Ulrich
PS: And if you want to run an executable which is built as part of your 
project, then the product should of course depend on that executable to make 
sure it is built before.
And the rule should use the executable's `Product.targetName` and ` 
Product.destinationDirectory` properties to determine the path of the 
executable.

Best
Jochen


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


Re: [Qbs] Specify custom applications and application arguments in qbs project

2020-09-21 Thread Jochen Ulrich
Hi Yury!

> I want to specify in the qbs project that there are several predefined 
> command line arguments which will be visible as separate runnables in 
> QtCreator.

The "several predefined command line arguments" parts should be possible by 
writing a Product with a corresponding Rule.

Something like this (UNTESTED!):

Product {
name: "my-command"
type: [ "command" ]
builtByDefault: false

Rule {
multiplex: true
alwaysRun: true
inputs: []

Artifact {
filePath: "dummy"
fileTags: [ "command" ]
}

prepare: {
let cmd = new Command();
cmd.description = "Running my-command";
cmd.program = "path/to/my-command";
cmd.arguments = [ "--arg1", "--arg2" ];
return cmd;
}
}
}

Then, *building* the product "my-command" will run the command.
Maybe you need to tune the Rule's properties to have it work as expected (as 
written above: this is untested).
See also https://doc.qt.io/qbs/qml-qbslanguageitems-rule.html and 
https://doc.qt.io/qbs/commands.html for more info.

However, this won't show up as a runnable in QtCreator because the execution of 
the command is happening as a build step and there is no artifact to be 
executed after building.
But "my-command" would show up in QtCreator's project view and there it could 
be triggered by right-click -> Build.
Maybe that's good enough for you?

Best
Jochen

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


[Qbs] Specify custom applications and application arguments in qbs project

2020-09-21 Thread юрий нуждин
I have a project which creates an executable which accepts different
command line arguments
I want to specify in the qbs project that there are several predefined
command line arguments which will be visible as separate runnables in
QtCreator.
It would be also nice if I can specify 3d party executables as well with
arguments and environment.

Currently for a work-around I copy run configuration and specify all
arguments manually, downside is that these changes are stored in .user
file, and on a different machine (and a platform) I need to specify it
again, which is not convenient and error-prone.

Maybe you know a way how I can achieve this? Or at least point to me how
QtCreator understands that the artifact can be executed?

Best regards,
Yury
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs