[Qbs] Building more than one binary from the same sources with multiplexing
Алексей Скородумов
2350266 at gmail.com
Tue Sep 4 17:27:16 CEST 2018
Hi Christian and thank you for the help!
Could you please clarify a bit more.
On Tue, Sep 4, 2018 at 4:14 PM Christian Kandeler <christian.kandeler at qt.io>
wrote:
> On Tue, 4 Sep 2018 15:53:59 +0200
> Алексей Скородумов <2350266 at gmail.com> wrote:
>
> > I would like to build several binaries from the same sources with
> different
> > compiler settings (defines). Is this a correct way to go:
> >
> > import qbs
> >
> > CppApplication {
> > name: "foo-bar"
> > multiplexByQbsProperties: ["profiles"]
> > Profile {
> > name: "foo"
> > cpp.defines: ["FOO"]
> > baseProfile: project.profile
> > }
> > Profile {
> > name: "bar"
> > cpp.defines: ["BAR"]
> > baseProfile: project.profile
> > }
> > qbs.profiles: ["foo", "bar"]
> > files: [
> > "main.cpp"
> > ]
> > }
>
> Yes, this looks correct.
> (I assume here that you want to build ony a selected subset of products
> twice. Otherwise, you should of course rather build the project for two
> different configurations:
> $ qbs build config:configBar cpp.defines:BAR config:configFoo
> cpp.defines:FOO)
>
1. Why is it better?
2. I have tried to do this inside project file and I got the following:
CppApplication {
name: "foo-bar"
multiplexByQbsProperties: ["buildVariants"]
qbs.buildVariants: ["FOO", "BAR"]
property var cppDefines: {
var defines = [];
if (qbs.buildVariant === "FOO")
defines.push("FOO");
if (qbs.buildVariant === "BAR")
defines.push("BAR")
return defines;
}
cpp.defines: cppDefines
files: [
"main.cpp"
]
}
It works, but while building from QtCreator I always get a release build. What
is wrong here?
>
> > Also, I noticed that without specifying baseProfile: project.profile
> > property qbs silently switches to a default profile
>
> Not the default profile; that's the value of preferences.defaultProfile.
> What you mean is that all properties except the one you set in the profile
> get their default values. That's exactly the same behavior as for any other
> profile, whether created with qbs-config, qbs-setup-toolchains, or with a
> Profile item.
>
> > regardless of active profile in QtCreator. Is it a bug or feature?
>
> A feature. You specifically request a custom profile, and that's what you
> get. We don't want it to get "polluted by default". As you have found out,
> you can easily opt in to inheriting from the project's main profile.
>
> Christian
>
Clear. Thanks.
> _______________________________________________
> Qbs mailing list
> Qbs at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>
--
--------------------------
Best regards,
Aleksei Skorodumov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20180904/b8998b02/attachment.html>
More information about the Qbs
mailing list