[QBS] Functions in QBS scripts and accessing properties from them.

Denis Shienkov denis.shienkov at gmail.com
Thu May 15 11:53:19 CEST 2014


> Well I guess it is fairly special - I'm compiling stuff for a
microcontroller using gcc for arm embedded.

As I know, you can create a custom *.config file in which to specify paths
to your toolchain, and then pass to qbs this your config file. Then qbs
will take your profile as default profile..
If I am not mistaken...

PS: For me too very interestingly any HOWTO for setup of custom
toolchain/profile for qbs. So, I also join to this question. :)


BR,
Denis


2014-05-15 13:44 GMT+04:00 Tim Hutt <tdhutt at gmail.com>:

> Well I guess it is fairly special - I'm compiling stuff for a
> microcontroller using gcc for arm embedded. It needs specific flags and
> linker scripts and so on. Is there any documentation on profiles? The only
> thing I could find was on listing them with the qbs binary which I don't
> have (since I'm using Qt Creator). If I made a profile would I be able to
> make it automatically find the arm gcc, and could I distribute it with my
> code easily?
>
> Thanks for the info Denis!
>
>
> On 15 May 2014 10:33, Christian Kandeler <christian.kandeler at digia.com>wrote:
>
>> On 05/15/2014 10:30 AM, Tim Hutt wrote:
>> > I have a QBS script that depends on using the GNU Arm toolchain, and I
>> > want it to automatically find them (on Windows for now).
>>
>> Are you sure that's really what you want? Toolchain information
>> typically comes from the "outside" via a profile, and then it just works
>> automatically and its properties are available via the cpp module.
>> Unless you use your toolchain in a very "special" way (i.e. not to
>> compile your sources), then your current approach is probably wrong.
>>
>>
>> Christian
>>
>>
>> In my QBS I
>> > have this line:
>> >
>> >       property  string  gnuToolsDir:  "C:/Program  Files/GNU  Tools
>>  ARM  Embedded/4.8  2014q1"
>> >
>> >
>> > And then I use that elsewhere. I want to set it to be a function, like
>> this:
>> >
>> >       function  findGnuToolsDir()
>> >
>> >       {
>> >
>> >               //  TODO:  Fancy  searching  function.
>> >
>> >               return  "C:/Program  Files/GNU  Tools  ARM  Embedded/4.8
>>  2014q1";
>> >
>> >       }
>> >
>> >
>> >
>> >       property  string  gnuToolsDir:  findGnuToolsDir();
>> >
>> >
>> > But that doesn't work (says it can't find the function).Additionally, I
>> can't seem to access the property in my Rules - it says the variable
>> doesn't exist.
>> >
>> >
>> >
>> >       Rule  {
>> >
>> >               //  ...
>> >
>> >
>> >
>> >               prepare:  {
>> >
>> >
>> >                       //  None  of  these  work:
>> >
>> >
>> >
>> >                       var  objCopyPath  =  gnuToolsDir  +
>>  "/bin/arm-none-eabi-objcopy.exe";
>> >
>> >
>> >
>> >                       var  objCopyPath  =  parent.gnuToolsDir  +
>>  "/bin/arm-none-eabi-objcopy.exe";
>> >
>> >
>> >
>> >                       var  objCopyPath  =  product.gnuToolsDir  +
>>  "/bin/arm-none-eabi-objcopy.exe";
>> >
>> >
>> >
>> >
>> >                       //  ...
>> >
>> >
>> >
>> >               }
>> >
>> >       }
>> >
>> >
>> >
>> >
>> > Any ideas? I've seen the Probe item but it doesn't seem suitable - as
>> far as I can tell it just determines the existence of a library or tool
>> rather than its location.
>> >
>> >
>> > Cheers,
>> >
>> >
>> > Tim
>> >
>> >
>> >
>> > _______________________________________________
>> > QBS mailing list
>> > QBS at qt-project.org
>> > http://lists.qt-project.org/mailman/listinfo/qbs
>> >
>>
>> _______________________________________________
>> QBS mailing list
>> QBS at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qbs
>>
>
>
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20140515/f5584074/attachment.html>


More information about the Qbs mailing list