[Qbs] Using ConanfileProbe with yocto cross compiling toolchain
Richard Weickelt
richard at weickelt.de
Fri May 15 11:20:14 CEST 2020
> I just stumbled across a scenario in which we use with multiple profiles for
> different cross compiling toolchains. Yocto creates a script which exports
> environment variables. We normally just extract the needed values from the
> script and set them as additional qbs profile settings.
> This leads to the problem that the ConanfileProbe just calls "conan
> install... -p..." without the needed environment variables.
> Thus when
> install libraries they are getting compiled with the wrong toolchain/settings.
> What is the proper way of doing this? How do I set the
> environment variables? Should I set the variables in the Kit?
That would be one option, but sounds a bit inconvenient. If the environment
variables are only relevant when running the ConanfileProbe, then you would
need to:
1. Add an additionalEnvironmentVariables property to ConanfileProbe
2. Append these to the process environment in ConanfileProbe. See
https://doc.qt.io/qbs/jsextension-process.html#setenv
3. Add an additional Probe item in your project file that extracts
the environment variables from the script.
Probes are currently executed in the order of their appearance in the qbs
file, so make sure it comes first.
Would that be a solution for you? Then I would warmthly welcome a patch.
Note that instead of modifying qbs profile settings globally with your yocto
variables, you should be able to also create an intermediate Profile item in
your project files this way:
Project {
YoctoScriptProbe {
id: yocto
}
// This profile amends the profile set by Qt Creator or on the
// command line
Profile {
name: "yocto-profile"
baseProfile: project.profile
someModule.someProperty: yocto.someExtractedValue
}
// Every product now needs to specify the amended profile
// explicitly
Product {
profile: "yocto-profile"
}
}
Hope that helps.
Richard
More information about the Qbs
mailing list