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] How to add -pthread option into projects? a bug in qbs ?

2019-07-04 Thread Christian Kandeler
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


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

2019-07-04 Thread Richard Weickelt
> How to add -pthread option into projects?
> ...
>     cpp.cppFlags: ["-pthread"]

Try using cpp.cxxFlags or cpp.driverFlags instead. cpp.cppFlags has a
different meaning. See
https://doc.qt.io/qbs/qml-qbsmodules-cpp.html#cppFlags-prop

> I encountered this error too when use qbs file generated by conan to add
> dependency of opencv 4.0.1 to my project.

This is a bug in the Conan Qbs generator which still exports compiler
options to cpp.cppFlags. See https://github.com/conan-io/conan/issues/4730

If you find the time to fix
https://github.com/conan-io/conan/blob/develop/conans/client/generators/qbs.py
that would be awesome. It's just two letters.

Richard
___
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-04 Thread Richard Weickelt
> How to add -pthread option into projects?
> ...
>     cpp.cppFlags: ["-pthread"]

Try using cpp.cxxFlags or cpp.driverFlags instead. cpp.cppFlags has a
different meaning. See
https://doc.qt.io/qbs/qml-qbsmodules-cpp.html#cppFlags-prop

> I encountered this error too when use qbs file generated by conan to add
> dependency of opencv 4.0.1 to my project.

This is a bug in the Conan Qbs generator which still exports compiler
options to cpp.cppFlags. See https://github.com/conan-io/conan/issues/4730

If you find the time to fix
https://github.com/conan-io/conan/blob/develop/conans/client/generators/qbs.py
that would be awesome. It's just two letters.

Richard
___
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-04 Thread Christian Stenger
Hi,

try using

 cpp.dynamicLibraries: [ "pthread" ]

instead of the cpp.cppFlags part

BR,
Christian


From: Qbs  on behalf of Vincent Hui 

Sent: Thursday, July 4, 2019 8:20:09 AM
To: qbs
Subject: [Qbs] How to add -pthread option into projects? a bug in qbs ?

Hi,

I am using qbs 1.13.1. When I built a simple project generated by Qt Creator, I 
got an error message.
"cc1plus: error: command line option ‘-pthread’ is valid for the driver but not 
for C++"

I encountered this error too when use qbs file generated by conan to add 
dependency of opencv 4.0.1 to my project.

How to add -pthread option into projects?

Thanks,
Vincent

my qbs file
"
import qbs

CppApplication {
consoleApplication: true
files: "main.cpp"
cpp.cppFlags: ["-pthread"]

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

using namespace std;

int main()
{
cout << "Hello World!" << endl;
return 0;
}
"
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


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

2019-07-04 Thread Vincent Hui
Hi,

I am using qbs 1.13.1. When I built a simple project generated by Qt
Creator, I got an error message.
"cc1plus: error: command line option ‘-pthread’ is valid for the driver but
not for C++"

I encountered this error too when use qbs file generated by conan to add
dependency of opencv 4.0.1 to my project.

How to add -pthread option into projects?

Thanks,
Vincent

my qbs file
"
import qbs

CppApplication {
consoleApplication: true
files: "main.cpp"
cpp.cppFlags: ["-pthread"]

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

using namespace std;

int main()
{
cout << "Hello World!" << endl;
return 0;
}
"
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs