Re: [Qbs] Exporting libraries to link only for MinGW

2020-02-22 Thread Björn Schäpers

Am 22.02.2020 um 09:56 schrieb Richard Weickelt:

You don't need a group here in the first place. Just
cpp.dynamicLibraries: {
var libs = [];
if(qbs.toolchain.contains("mingw"))
libs = libs.concat(["pthread", "ole32"] )
return libs;
}

Or to be more explicit: You **must** not use the Group item for this purpose. 
The Group item selects file artifacts by name or tag and assigns module 
properties to them. Since You don’t select any artifacts, the Group has no 
effect. You probably want to use the Properties item (which works in modules as 
well. The limitation is that only one Properties item should write the same 
module property at a time (mutual exclusive). But that seems to be the case in 
your example.

Richard


Thanks!

Properties seems to be exactly what I want.

Here what I have now:
   StaticLibrary {
    files: ["date/include/date/*.h", "date/src/*.cpp"]
    name: "date"

    Depends { name: "cpp" }

    cpp.cxxLanguageVersion: "c++17"
    cpp.defines: ["HAS_REMOTE_API=0","AUTO_DOWNLOAD=0","INSTALL=."]
    cpp.includePaths: ["date/include"]

    Export {
    Depends { name: "cpp" }

    cpp.defines: product.cpp.defines
    cpp.includePaths: ["date/include"]

    Properties {
    condition: qbs.toolchain.contains("mingw")

    cpp.dynamicLibraries: ["pthread", "ole32"]
    }
    }
    }

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


Re: [Qbs] Exporting libraries to link only for MinGW

2020-02-22 Thread Richard Weickelt
> You don't need a group here in the first place. Just
> cpp.dynamicLibraries: {
>var libs = [];
>if(qbs.toolchain.contains("mingw"))
>libs = libs.concat(["pthread", "ole32"] )
>return libs;
> }

Or to be more explicit: You **must** not use the Group item for this purpose. 
The Group item selects file artifacts by name or tag and assigns module 
properties to them. Since You don’t select any artifacts, the Group has no 
effect. You probably want to use the Properties item (which works in modules as 
well. The limitation is that only one Properties item should write the same 
module property at a time (mutual exclusive). But that seems to be the case in 
your example.

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] Exporting libraries to link only for MinGW

2020-02-21 Thread NIkolai Marchenko
You don't need a group here in the first place. Just
cpp.dynamicLibraries: {
var libs = [];
if(qbs.toolchain.contains("mingw"))
libs = libs.concat(["pthread", "ole32"] )
return libs;
}

On Sat, Feb 22, 2020 at 12:17 AM Björn Schäpers 
wrote:

> Hi,
>
> I'm trying to incorporate Howard Hinnant's date library and he states
> "mingw users: -lpthread and -lole32 are required"
>
> So I tried
>
>  StaticLibrary {
>  files: ["date/include/date/*.h", "date/src/*.cpp"]
>  name: "date"
>
>  Depends { name: "cpp" }
>
>  cpp.cxxLanguageVersion: "c++17"
>  cpp.defines: ["HAS_REMOTE_API=0","AUTO_DOWNLOAD=0","INSTALL=."]
>  cpp.includePaths: ["date/include"]
>
>  Export {
>  Depends { name: "cpp" }
>
>  cpp.defines: product.cpp.defines
>  cpp.includePaths: ["date/include"]
>
>  Group {
>  condition: qbs.toolchain.contains("mingw")
>
>  cpp.dynamicLibraries: ["pthread", "ole32"]
>  }
>  }
>  }
>
> But that doesn't work, even though QtCreator shows the Group as active. It
> doesn't matter to what I change the condition, only when I remove the
> Group at
> all the Libraries are added to the link command.
>
> How do I correctly state these dependencies?
>
> Best regards,
> Björn.
> ___
> 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


[Qbs] Exporting libraries to link only for MinGW

2020-02-21 Thread Björn Schäpers

Hi,

I'm trying to incorporate Howard Hinnant's date library and he states
"mingw users: -lpthread and -lole32 are required"

So I tried

StaticLibrary {
files: ["date/include/date/*.h", "date/src/*.cpp"]
name: "date"

Depends { name: "cpp" }

cpp.cxxLanguageVersion: "c++17"
cpp.defines: ["HAS_REMOTE_API=0","AUTO_DOWNLOAD=0","INSTALL=."]
cpp.includePaths: ["date/include"]

Export {
Depends { name: "cpp" }

cpp.defines: product.cpp.defines
cpp.includePaths: ["date/include"]

Group {
condition: qbs.toolchain.contains("mingw")

cpp.dynamicLibraries: ["pthread", "ole32"]
}
}
}

But that doesn't work, even though QtCreator shows the Group as active. It 
doesn't matter to what I change the condition, only when I remove the Group at 
all the Libraries are added to the link command.


How do I correctly state these dependencies?

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