Re: [Qbs] A simple project that copy an executable does not work

2019-08-23 Thread Christian Kandeler
On Tue, 13 Aug 2019 11:50:38 +
Christian Kandeler  wrote:

> On Mon, 12 Aug 2019 21:57:34 +0800
> Vincent Hui  wrote:
> 
> > Do you know why the document for Rule is not updated?
> > https://doc-snapshots.qt.io/qbs/qml-qbslanguageitems-rule.html
> 
> The snapshots are probably updated manually, or the script is broken. I'll 
> ask a doc person.

Snapshots have been updated.


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


Re: [Qbs] A simple project that copy an executable does not work

2019-08-19 Thread Vincent Hui
Hi Christian,

Did the doc person you asked reply you?

br,
Vincent


On Tue, 13 Aug 2019 at 19:51, Christian Kandeler 
wrote:

> On Mon, 12 Aug 2019 21:57:34 +0800
> Vincent Hui  wrote:
>
> > Do you know why the document for Rule is not updated?
> > https://doc-snapshots.qt.io/qbs/qml-qbslanguageitems-rule.html
>
> The snapshots are probably updated manually, or the script is broken. I'll
> ask a doc person.
>
>
> 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


Re: [Qbs] A simple project that copy an executable does not work

2019-08-13 Thread Christian Kandeler
On Mon, 12 Aug 2019 21:57:34 +0800
Vincent Hui  wrote:

> Do you know why the document for Rule is not updated?
> https://doc-snapshots.qt.io/qbs/qml-qbslanguageitems-rule.html

The snapshots are probably updated manually, or the script is broken. I'll ask 
a doc person.


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


Re: [Qbs] A simple project that copy an executable does not work

2019-08-12 Thread Vincent Hui
 Hi Christian,

Do you know why the document for Rule is not updated?
https://doc-snapshots.qt.io/qbs/qml-qbslanguageitems-rule.html

Thank you.
br,
Vincent

On Fri, 9 Aug 2019 at 20:21, Christian Gagneraud  wrote:

> On Fri, 9 Aug 2019 at 13:28, Иван Комиссаров  wrote:
> >
> > I guess, documentation is updated manually as a part of the release
> process (which did not happen yet AFAIK).
> > Christian should know better, he is the maintainer:)
> > I hope that some day when we will have a proper CI for Qbs, we can
> update doc on a daily basis
>
> Isn't it what https://doc-snapshots.qt.io/ is for?
>
> Qbs master doc is available at https://doc-snapshots.qt.io/qbs/index.html
>
> Chris
>
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] A simple project that copy an executable does not work

2019-08-09 Thread Christian Gagneraud
On Fri, 9 Aug 2019 at 13:28, Иван Комиссаров  wrote:
>
> I guess, documentation is updated manually as a part of the release process 
> (which did not happen yet AFAIK).
> Christian should know better, he is the maintainer:)
> I hope that some day when we will have a proper CI for Qbs, we can update doc 
> on a daily basis

Isn't it what https://doc-snapshots.qt.io/ is for?

Qbs master doc is available at https://doc-snapshots.qt.io/qbs/index.html

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


Re: [Qbs] A simple project that copy an executable does not work

2019-08-09 Thread Иван Комиссаров
I guess, documentation is updated manually as a part of the release process 
(which did not happen yet AFAIK).
Christian should know better, he is the maintainer:)
I hope that some day when we will have a proper CI for Qbs, we can update doc 
on a daily basis

Иван Комиссаров

> 9 авг. 2019 г., в 4:42, Vincent Hui  написал(а):
> 
> Hi Ivan,
> 
> Do you know why the document for Rule is not updated? Your commit was merged, 
> am I right?
> https://doc-snapshots.qt.io/qbs/qml-qbslanguageitems-rule.html
> 
> Thank you again for making a complete example for Rule.
> 
> br,
> Vincent
> 
> 
>> On Sat, 6 Jul 2019 at 23:15, Иван Комиссаров  wrote:
>> https://codereview.qt-project.org/c/qbs/qbs/+/267333
>> 
>> > 6 июля 2019 г., в 15:51, Иван Комиссаров  написал(а):
>> > 
>> > Ivan.
>> 
>> ___
>> 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


Re: [Qbs] A simple project that copy an executable does not work

2019-08-08 Thread Vincent Hui
Hi Ivan,

Do you know why the document for Rule is not updated? Your commit was
merged, am I right?
https://doc-snapshots.qt.io/qbs/qml-qbslanguageitems-rule.html

Thank you again for making a complete example for Rule.

br,
Vincent


On Sat, 6 Jul 2019 at 23:15, Иван Комиссаров  wrote:

> https://codereview.qt-project.org/c/qbs/qbs/+/267333
>
> > 6 июля 2019 г., в 15:51, Иван Комиссаров  написал(а):
> >
> > Ivan.
>
> ___
> 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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-07 Thread Christian Gagneraud
On Mon, 8 Jul 2019 at 18:15, Vincent Hui  wrote:
>
> Hi Richard and Ivan,
>
> I tried a project called qbs-autoproject that can generate qbs files 
> automatically. I modified the example to try whether multiple executables can 
> be generated without adding CppApplication by myself, the result was that 
> multiple executables were generated successfully without adding 
> CppApplication by myself on Ubuntu 18.04. After qbs-autoproject had been 
> parsed in Qt Creator, qbs-autoproject/.autoproject/example.autoproject.qbs 
> was generated. Two executables "app1d" and "app2d" were generated when the 
> project was built.
>
> You can try the example I modified, the project is attached.
>
> The next thing I want to do is investigating whether qbs-autoproject can be 
> used in complicated projects.

Are you trying to convert an existing project that use a different
build system, or are you trying to create qbs files out of a tree of
source files?
If you're project is not big, IMHO, it will be faster to write your
qbs file by hand, that's the only way to learn.
Start with something simple, and then build up slowly by adding more
libs, apps, plugins, refactor your files as you start to copy/paste
too much, etc...

As mentioned by Ivan, if you want to learn how to deal with
complicated projects, the best is to check QtCreator's use of Qbs and
Qbs' use of Qbs itself. You'll see everything you need to know (and
more!)

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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-07 Thread Vincent Hui
Hi Richard and Ivan,

I tried a project called qbs-autoproject
that can generate qbs
files automatically. I modified the example to try whether multiple
executables can be generated without adding CppApplication by myself, the
result was that multiple executables were generated successfully without
adding CppApplication by myself on Ubuntu 18.04. After qbs-autoproject had
been parsed in Qt Creator,
qbs-autoproject/.autoproject/example.autoproject.qbs was generated. Two
executables "app1d" and "app2d" were generated when the project was built.

You can try the example I modified, the project is attached.

The next thing I want to do is investigating whether qbs-autoproject can be
used in complicated projects.

Thanks,
Vincent


On Mon, 8 Jul 2019 at 00:33, Richard Weickelt  wrote:

> > No, this is not possible. The reason is that in common case those
> products
> > (applications, libraries) will diverge in some way. For example, you
> might
> > want to use different resources - icons (you probably do not want to name
> > them icon1.png and icon2.png, right?), .desktop entires on Linux, plist
> > files on Mac…
> >
> > However, you might want to share some properties among those
> applications -
> > that can be achieved via inheritance - you inherit the CppApplication
> item
> > in a file, say, MyApplication.qbs, specify common properties
> (cpp.cxxFlags,
> > cpp.cxxLanguageVersion, etc…) and then instantiate MyApplication and only
> > specify only what’s different (files: «main1.cpp» and files: «main2.cpp»
> in
> > your case). That way you don’t need to write all that boilerplate code
> over
> > and over again.
>
> Some links to illustrate what Ivan just explained:
>
>
> https://doc.qt.io/qbs/custom-modules.html#making-qbs-aware-of-custom-modules-and-items
>
> A customized Product item:
> https://code.qt.io/cgit/qbs/qbs.git/tree/src/app/qbs/qbs.qbs
>
> The related base item:
> https://code.qt.io/cgit/qbs/qbs.git/tree/qbs-resources/imports/QbsApp.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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-07 Thread Richard Weickelt
> No, this is not possible. The reason is that in common case those products
> (applications, libraries) will diverge in some way. For example, you might
> want to use different resources - icons (you probably do not want to name
> them icon1.png and icon2.png, right?), .desktop entires on Linux, plist
> files on Mac…
> 
> However, you might want to share some properties among those applications -
> that can be achieved via inheritance - you inherit the CppApplication item
> in a file, say, MyApplication.qbs, specify common properties (cpp.cxxFlags,
> cpp.cxxLanguageVersion, etc…) and then instantiate MyApplication and only
> specify only what’s different (files: «main1.cpp» and files: «main2.cpp» in
> your case). That way you don’t need to write all that boilerplate code over
> and over again.

Some links to illustrate what Ivan just explained:

https://doc.qt.io/qbs/custom-modules.html#making-qbs-aware-of-custom-modules-and-items

A customized Product item:
https://code.qt.io/cgit/qbs/qbs.git/tree/src/app/qbs/qbs.qbs

The related base item:
https://code.qt.io/cgit/qbs/qbs.git/tree/qbs-resources/imports/QbsApp.qbs

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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-07 Thread Иван Комиссаров
No, this is not possible. The reason is that in common case those products 
(applications, libraries) will diverge in some way. For example, you might want 
to use different resources - icons (you probably do not want to name them 
icon1.png and icon2.png, right?), .desktop entires on Linux, plist files on Mac…

However, you might want to share some properties among those applications - 
that can be achieved via inheritance - you inherit the CppApplication item in a 
file, say, MyApplication.qbs, specify common properties (cpp.cxxFlags, 
cpp.cxxLanguageVersion, etc…) and then instantiate MyApplication and only 
specify only what’s different (files: «main1.cpp» and files: «main2.cpp» in 
your case). That way you don’t need to write all that boilerplate code over and 
over again.

> 7 июля 2019 г., в 15:58, Vincent Hui  написал(а):
> 
> Hi Ivan,
> 
> Thank you very much for creating a complete example in Rule document. That 
> definitely helps new qbs users.
> 
> I have another question that I didn't find answers after reading qbs doc.
> 
> Is it possible to create CppApplication dynamically to generate multiple 
> executables?
> 
> For example, I have two cpp files "main1.cpp" "main2.cpp" containing one main 
> functions respectively inside "apps" folders. I want my project can add all 
> cpp files automatically can build all executables "main1.exe" "main2.exe" 
> respectively.
> 
> I know I can add all cpp files automatically by using Group. However, I don't 
> know how to build 2 executables without hardcode 2 CppApplication.
> 
> Thank you again,
> Vincent
> 
> 
> On Sat, 6 Jul 2019 at 23:15, Иван Комиссаров  > wrote:
> https://codereview.qt-project.org/c/qbs/qbs/+/267333 
> 
> 
> > 6 июля 2019 г., в 15:51, Иван Комиссаров  > > написал(а):
> > 
> > Ivan.
> 
> ___
> 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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-07 Thread Vincent Hui
Hi Ivan,

Thank you very much for creating a complete example in Rule document. That
definitely helps new qbs users.

I have another question that I didn't find answers after reading qbs doc.

Is it possible to create CppApplication dynamically to generate multiple
executables?

For example, I have two cpp files "main1.cpp" "main2.cpp" containing one
main functions respectively inside "apps" folders. I want my project can
add all cpp files automatically can build all executables "main1.exe"
"main2.exe" respectively.

I know I can add all cpp files automatically by using Group. However, I
don't know how to build 2 executables without hardcode 2 CppApplication.

Thank you again,
Vincent


On Sat, 6 Jul 2019 at 23:15, Иван Комиссаров  wrote:

> https://codereview.qt-project.org/c/qbs/qbs/+/267333
>
> > 6 июля 2019 г., в 15:51, Иван Комиссаров  написал(а):
> >
> > Ivan.
>
> ___
> 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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-06 Thread Иван Комиссаров
https://codereview.qt-project.org/c/qbs/qbs/+/267333

> 6 июля 2019 г., в 15:51, Иван Комиссаров  написал(а):
> 
> Ivan.

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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-06 Thread Иван Комиссаров
Yes, Qbs doc is a bit incomplete and contains some confusing and misleading 
examples.

I even failed to answer your question myself. Well, I understood the reason 
correctly (there’s no dependent product), but failed to provide a working 
example in reasonable time.

Feel free to create tickets (or even provide patch sets) for the doc - I (we?) 
will try to improve what’s unclear. I personally learned Qbs by looking at the 
QtCreator source code (which is not user friendly, but there were almost no doc 
in 2013) so it is not very clear for me which parts of the doc are 
missing/incomplete/misleading. However, the doc is very important as it’s what 
users see.

Your feedback is welcome!

Ivan.

> 6 июля 2019 г., в 15:29, Vincent Hui  написал(а):
> 
> Hi Richard,
> 
> Thank you very much for your reply. 
> 
> I am creating toy projects for learning how to use qbs.
> 
> In the document of Rule, A simple example is not a complete example. It does 
> not tell user to assign the product type to "txt_output" explicitly.
> 
> I hope the document can be improved in the future.
> 
> Thank you again,
> Vincent
> ___
> 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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-06 Thread Vincent Hui
Hi Richard,

Thank you very much for your reply.

I am creating toy projects for learning how to use qbs.

In the document of Rule, A simple example is not a complete example. It
does not tell user to assign the product type to "txt_output" explicitly.

I hope the document can be improved in the future.

Thank you again,
Vincent


On Sat, 6 Jul 2019 at 19:40, Richard Weickelt  wrote:

> > I created a simple project to copy an executable generated by
> > CppApplication. However the executable is not copied.
> >
> > I cannot figure out why? Can anyone tell me why?
>
> Please read
>
> https://doc.qt.io/qbs/qml-qbslanguageitems-rule.html#rules-and-product-types
>
> Your rule is not executed because the product type is "application" and
> there is most likely no other product or rule that depends on an .out file.
>
> You should assign a file tag to the rule's output artifact and add this
> file
> tag to the product type. Something like this:
>
> CppApplication {
> type: [ "outfile"]
> // ...
> Rule {
> Artifact {
> filePath: input.fileName + ".out"
> fileTags: [ "outfile" ]
> }
> // ...
> }
> }
>
> Why do you want to copy an application executable into an .out file? That
> seems pointless. Do you maybe want to change the executable suffix? There
> is
> an undocumented property cpp.executableSuffix which you could try:
>
> CppApplication {
> cpp.executableSuffix: ".out"
> // ...
> }
>
> I don't know why it is undocumented. Maybe some linkers do not allow to
> change the suffix.
>
>
> ___
> 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


Re: [Qbs] A simple project that copy an executable does not work

2019-07-06 Thread Richard Weickelt
> I created a simple project to copy an executable generated by
> CppApplication. However the executable is not copied.
> 
> I cannot figure out why? Can anyone tell me why?

Please read
https://doc.qt.io/qbs/qml-qbslanguageitems-rule.html#rules-and-product-types

Your rule is not executed because the product type is "application" and
there is most likely no other product or rule that depends on an .out file.

You should assign a file tag to the rule's output artifact and add this file
tag to the product type. Something like this:

CppApplication {
type: [ "outfile"]
// ...
Rule {
Artifact {
filePath: input.fileName + ".out"
fileTags: [ "outfile" ]
}
// ...
}
}

Why do you want to copy an application executable into an .out file? That
seems pointless. Do you maybe want to change the executable suffix? There is
an undocumented property cpp.executableSuffix which you could try:

CppApplication {
cpp.executableSuffix: ".out"
// ...
}

I don't know why it is undocumented. Maybe some linkers do not allow to
change the suffix.


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


[Qbs] A simple project that copy an executable does not work

2019-07-06 Thread Vincent Hui
Hi,

I created a simple project to copy an executable generated by
CppApplication. However the executable is not copied.

I cannot figure out why? Can anyone tell me why?

Thank you very much.

Regards,
Vincent

my qbs file
"
import qbs.base
import qbs.File
import qbs.FileInfo

CppApplication {
name: "myapp"
consoleApplication: true
files: "main.cpp"
Depends { name: "Qt.core" }

Group { // Properties for the produced executable
fileTagsFilter: "application"
qbs.install: true
qbs.installDir: "bin"
}

Rule {
inputs: ["application"]
Artifact {
filePath: input.fileName + ".out"
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generating " +
FileInfo.fileName(output.filePath);
cmd.sourceCode = function() {
File.copy(input.filePath, output.filePath);
}
return cmd;
}
}
}
"
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs