Re: [Qbs] Is there a feature similar with cmake option?

2019-07-05 Thread Christian Gagneraud
On Sat, 6 Jul 2019 at 02:49, Vincent Hui  wrote:
>
> Hi Richard,
>
> Thank you for your reply,
>
> Sorry, I am not a cmake expert. I cannot explain what CMakeCache.txt is used 
> for. What I can tell is that cmake users either edit CMakeCache.txt directly 
> to change values of options or use CMake GUI to build a project in 
> interactive mode, I am thinking whether we need qbs GUI in order to  let 
> users build a project in interactive mode.

This CMakeCache.txt can be problematic, sometimes with CMake if you
want to reconfigure your project you need to wipe out this file and
sometimes the whole build directory. AFAIU, this is similar to qmake
stash and the so-called "site" files of GNU autotools.


> Why GUI is needed to let users build projects in interactive mode in cmake.
> " Using CMake to build a project in non-interactive mode is a simple process 
> if the project does not have many options. For larger projects like VTK, 
> using ccmake, cmake -i, or CMakeSetup is recommended. This is because as you 
> change options in the CMakeCache.txt file, cmake may add new entries to that 
> file. It can be difficult to know when to stop the run cmake, edit the cache 
> file cycle without the aid of an interface."
> https://cmake.org/runningcmake/

Having to re-run cmake all the time is a real pain, and user
experience with qtcreator goes down big time when you have a big
project as it introduce minute long delay and freeze the UI for 5 to
10 seconds.
As well soemetimes qtcreator get stuck, and you have to re-run cmake
"manually" (hitting ctrl-B doesn't work anymore).
But it sometimes get even worth, there are situation where you need to
close/reopen your project, and unfortunately you sometimes need to
*restart* qtc, due to cmake work dir being completely broken.
All of the above happens when you edit various part of your cmake
files, which is often the case of a project maintainer that tries to
add new features to a project.
I'm quite frustated with that, but i'm patient and hope this will
improve over time.

Initially i didn't like this GUI thing, but latter learned to
appreciate its value, for example QtCreator gives you access to all
these options in the project's build settings, and use the right
widget for the "option" editor.
It is very valuable because as a project maintainer it allows you to
make it easy for other developers to play with these options.
You can define the type of the options (limited set: bool, file, dir
and strings), default value, and a help string.

These options don't belong to profiles as they are project specific.

Having a way to expose project specific options with qbs would be a nice thing.

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


Re: [Qbs] Is there a feature similar with cmake option?

2019-07-05 Thread Vincent Hui
Hi Richard,

Thank you for your reply,

Sorry, I am not a cmake expert. I cannot explain what CMakeCache.txt is
used for. What I can tell is that cmake users either edit CMakeCache.txt
directly to change values of options or use CMake GUI to build a project in
interactive mode, I am thinking whether we need qbs GUI in order to  let
users build a project in interactive mode.

Why GUI is needed to let users build projects in interactive mode in cmake.
" Using CMake to build a project in non-interactive mode is a simple
process if the project does not have many options. For larger projects like
VTK, using ccmake, cmake -i, or CMakeSetup is recommended. This is because
as you change options in the CMakeCache.txt file, cmake may add new entries
to that file. It can be difficult to know when to stop the run cmake, edit
the cache file cycle without the aid of an interface."
https://cmake.org/runningcmake/

Thanks,
Vincent


On Fri, 5 Jul 2019 at 22:06, Richard Weickelt  wrote:

>
> >> Cmake options can be overridden by CMakeCache.txt files inside build
> >> folders. Is there similar feature in qbs?
> >
> > No, and it sounds like a horrible idea.
>
> Regardless of the CMake inherent beauty. If you (Victor) want to have a
> profound answer to your question, you should explain what CMakeCache.txt is
> used for. It would be also helpful if you come up with an understandable
> example of your use-case.
>
> I found this explanation:
>
> https://stackoverflow.com/questions/42160117/what-is-cmakecache-txt-and-why-it-overrides-my-variables
>
> And it sounds like CMakeCache.txt is used to prevent from typing a CMake
> command line with lots of -D. Is that correct? There is no direct
> equivalent in Qbs.
>
> You can override project, product and module options on command line:
> https://doc-snapshots.qt.io/qbs/cli-build.html#parameters
>
> Nothing stops you from putting your custom overrides into a text file and
> then insert them right in place:
>
> # options.txt
> modules.cpp.optimization:fast project.myCoolFeatureEnabled:true
>
> # my-qbs-invocation-script.sh
> qbs build $(cat options.txt)
>
> Richard
> ___
> 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] Is there a feature similar with cmake option?

2019-07-05 Thread Christian Kandeler
On Fri, 5 Jul 2019 16:06:28 +0200
Richard Weickelt  wrote:

> And it sounds like CMakeCache.txt is used to prevent from typing a CMake
> command line with lots of -D. Is that correct? There is no direct
> equivalent in Qbs.

But note that the property values are stored in the build graph, so you only 
have to enter them once.

> You can override project, product and module options on command line:
> https://doc-snapshots.qt.io/qbs/cli-build.html#parameters
> 
> Nothing stops you from putting your custom overrides into a text file and
> then insert them right in place:
> 
> # options.txt
> modules.cpp.optimization:fast project.myCoolFeatureEnabled:true
> 
> # my-qbs-invocation-script.sh
> qbs build $(cat options.txt)

Also, there are profiles.


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


Re: [Qbs] Is there a feature similar with cmake option?

2019-07-05 Thread Richard Weickelt

>> Cmake options can be overridden by CMakeCache.txt files inside build
>> folders. Is there similar feature in qbs?
> 
> No, and it sounds like a horrible idea.

Regardless of the CMake inherent beauty. If you (Victor) want to have a
profound answer to your question, you should explain what CMakeCache.txt is
used for. It would be also helpful if you come up with an understandable
example of your use-case.

I found this explanation:
https://stackoverflow.com/questions/42160117/what-is-cmakecache-txt-and-why-it-overrides-my-variables

And it sounds like CMakeCache.txt is used to prevent from typing a CMake
command line with lots of -D. Is that correct? There is no direct
equivalent in Qbs.

You can override project, product and module options on command line:
https://doc-snapshots.qt.io/qbs/cli-build.html#parameters

Nothing stops you from putting your custom overrides into a text file and
then insert them right in place:

# options.txt
modules.cpp.optimization:fast project.myCoolFeatureEnabled:true

# my-qbs-invocation-script.sh
qbs build $(cat options.txt)

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


Re: [Qbs] Is there a feature similar with cmake option?

2019-07-05 Thread Christian Kandeler
On Fri, 5 Jul 2019 21:33:12 +0800
Vincent Hui  wrote:

> Cmake options can be overridden by CMakeCache.txt files inside build
> folders. Is there similar feature in qbs?

No, and it sounds like a horrible idea.


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


Re: [Qbs] Is there a feature similar with cmake option?

2019-07-05 Thread Vincent Hui
Hi Christian,

Thank you for your reply.

Cmake options can be overridden by CMakeCache.txt files inside build
folders. Is there similar feature in qbs?

Thanks,
Vincent


On Fri, 5 Jul 2019 at 19:51, Christian Kandeler 
wrote:

> On Fri, 5 Jul 2019 16:01:02 +0800
> Vincent Hui  wrote:
>
> > In qbs, is there a feature similar with cmake option
> > ?
>
> Doesn't that just map to properties?
>
>
> 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] How to add -pthread option into projects? a bug in qbs ?

2019-07-05 Thread Richard Weickelt
> My next question is how to fix the bug in conan qbs generator? driverFlags
> does not exist in conan qbs generator.

You can either 

1. Wait for this fix to be integrated:
https://github.com/conan-io/conan/pull/5452
2. Modify the Qbs generator in your Conan installation
3. Implement your own Qbs generator into the project you want to build.

The cpp_info object model of Conan is very limited. Conan does not know about
driver flags and I doubt it will any time soon. So there is not much we can do
about that. I don't think it is dangerous to put -pthread into cpp.cxxFlags
although it is not entirely correct either. You can try to add -pthread to
cpp.driverFlags in your product. That might result in doubling -pthread on the
command line since it is applied by cxxFlags as well. If the compiler (g++?)
complains, you can also use cpp.driverLinker flags instead. This will apply
-pthread only to the invocation of the linker driver. The compiler is then
covered by cpp.cxxFlags provided by the dependency.

Richard

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


Re: [Qbs] Is there a feature similar with cmake option?

2019-07-05 Thread Christian Kandeler
On Fri, 5 Jul 2019 16:01:02 +0800
Vincent Hui  wrote:

> In qbs, is there a feature similar with cmake option
> ?

Doesn't that just map to properties?


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


[Qbs] Is there a feature similar with cmake option?

2019-07-05 Thread Vincent Hui
Hi,

In qbs, is there a feature similar with cmake option
?

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


Re: [Qbs] How to add -pthread option into projects? a bug in qbs ?

2019-07-05 Thread Vincent Hui
Hi,

Thank all of you for your replies.

I can build my project with cpp.driverFlags: "-pthread".

My next question is how to fix the bug in conan qbs generator? driverFlags
does not exist in conan qbs generator.

Thanks,
Vincent


On Thu, 4 Jul 2019 at 16:07, Christian Kandeler 
wrote:

> On Thu, 4 Jul 2019 14:20:09 +0800
> Vincent Hui  wrote:
>
> > cpp.cppFlags: ["-pthread"]
>
> cpp.driverFlags: "-pthread"
>
>
> 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