Hi,

1. Your function shall be in the functions.js file , e.g. in:
/yourproject/qbs/imports/YourFunctions/functions.js
2. Also your Project should have an option:

Project {
...
qbsSearchPaths: "qbs"
...
}

3. Your Product's file should contains:

...
import YourFunctions
...
...
property string gnuToolsDir: YourFunctions.findGnuToolsDir();
...

I would make it so. Also you can look how this done by analogy, e.g. in
QtCreator's sources.


BR,
Denis




2014-05-15 12:30 GMT+04:00 Tim Hutt <tdh...@gmail.com>:

> Hi,
>
> 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). 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@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>
>
_______________________________________________
QBS mailing list
QBS@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs

Reply via email to