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