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

2014-05-15 Thread Denis Shienkov
oops, of course,

property string gnuToolsDir: MyFunctions.findGnuToolsDir();

instead of

property string gnuToolsDir: YourFunctions.findGnuToolsDir();

BR,
Denis


2014-05-15 15:39 GMT+04:00 Denis Shienkov :

> E.g. IMHO, in your case should be like this:
>
>
> = myproject/myproject.qbs =
>
> import qbs 1.0
>
> Project {
> qbsSearchPaths: "qbs"
>
> references: [
> "app/app.qbs",
> ]
> }
>
>
> = myproject/qbs/imports/MyFunctions/functions.js =
>
> function findGnuToolsDir()
> {
> ...
> }
>
>
> = myproject/app/app.qbs =
>
> import qbs.base 1.0
> import MyFunctions
>
> Application {
> name: "myapplication"
>
> ...
> ...
> property string gnuToolsDir: YourFunctions.findGnuToolsDir();
> ...
> ...
>
> }
>
> But, if to be honest, I do not know how to do it by other way (I even do
> not trying do check other way). :)
>
> BR,
> Denis
>
>
>
> 2014-05-15 15:26 GMT+04:00 Tim Hutt :
>
> Is there no way to do this in two files instead of three? It doesn't seem
>> like I can put the `import YourFunctions` before the `Project`, so I need a
>> separate file for the Project and Product, and then a third for the
>> javascript. Is that right?
>>
>> Cheers,
>>
>> Tim
>>
>>
>> On 15 May 2014 10:37, Denis Shienkov  wrote:
>>
>>> 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 :
>>>
  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


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

2014-05-15 Thread Denis Shienkov
E.g. IMHO, in your case should be like this:


= myproject/myproject.qbs =

import qbs 1.0

Project {
qbsSearchPaths: "qbs"

references: [
"app/app.qbs",
]
}


= myproject/qbs/imports/MyFunctions/functions.js =

function findGnuToolsDir()
{
...
}


= myproject/app/app.qbs =

import qbs.base 1.0
import MyFunctions

Application {
name: "myapplication"
...
...
property string gnuToolsDir: YourFunctions.findGnuToolsDir();
...
...

}

But, if to be honest, I do not know how to do it by other way (I even do
not trying do check other way). :)

BR,
Denis



2014-05-15 15:26 GMT+04:00 Tim Hutt :

> Is there no way to do this in two files instead of three? It doesn't seem
> like I can put the `import YourFunctions` before the `Project`, so I need a
> separate file for the Project and Product, and then a third for the
> javascript. Is that right?
>
> Cheers,
>
> Tim
>
>
> On 15 May 2014 10:37, Denis Shienkov  wrote:
>
>> 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 :
>>
>>>  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


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

2014-05-15 Thread Tim Hutt
Is there no way to do this in two files instead of three? It doesn't seem
like I can put the `import YourFunctions` before the `Project`, so I need a
separate file for the Project and Product, and then a third for the
javascript. Is that right?

Cheers,

Tim


On 15 May 2014 10:37, Denis Shienkov  wrote:

> 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 :
>
>>  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


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

2014-05-15 Thread Tim Hutt
> It makes no sense to distribute this information as the location of the
toolchain is dependent on the host system.

True, but I'd like to be able to distribute a build file which is a little
bit intelligent about finding the tool chain. For example on Windows, the
default install directory is

C:\Program Files\GNU Tools ARM Embedded\4.8 2014q1

Obviously the version can change, so I'd like to be able to have something
that detects that so my instructions are:

1. Install the Gnu arm tools in the default location.
2. Run qbs my-project.qbs.

Rather than:

1. Install the Gnu arm tools.
2. Set up a profile, pointing it to the location of your tool chain.
3. Add all the custom compile and linker options that are required to the
profile.
4. Select the profile in the build setup.
5. Build the project.

I know that's probably not exactly how it would work, but I'm trying to
make a QBS file that others can easily use, so as much as possible
everything that needs to be set up should be distributable, and not depend
on hard-coded or manually specified paths. I think I'll stick with my
current somewhat hacky solution for now!

Cheers,

Tim


On 15 May 2014 10:58, Christian Kandeler wrote:

> On 05/15/2014 11:44 AM, Tim Hutt wrote:
> > 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.
>
> See http://qt-project.org/doc/qbs-1.2/cpp-module.html for information on
> the cpp module.
>
> > Is there any documentation on profiles?
>
> For the command line, see the "qbs setup-toolchains" command. It comes
> with a "--help" option that should tell you everything you need to know.
>
> > 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).
>
> Qt Creator will automatically create a qbs profile from your Kit.
> Additional properties can be set in Qt Creator's build step (or in your
> project files).
>
> > 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?
>
> The profile does not "find" anything, it *knows* where the toolchain is
> because it was given that information when it was created. It makes no
> sense to distribute this information as the location of the toolchain is
> dependent on the host system.
>
>
> Christian
>
> >
> > Thanks for the info Denis!
> >
> >
> > On 15 May 2014 10:33, Christian Kandeler  > > 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";
> >  >
> >  >
> >  >
> >  >
> >  >   //  ...
> >  >
> >  >
> >  >
> >  >   }
> >  >
> >  >   }
> >  >
> >  >
> >  >
> >   

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

2014-05-15 Thread Christian Kandeler
On 05/15/2014 11:53 AM, Denis Shienkov wrote:
>  > 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.

That's news to me.

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

qbs-setup-toolchains and qbs-config are the tools you need. See also 
http://qt-project.org/doc/qbs-1.2/configuring.html.


Christian

>
>
> BR,
> Denis
>
>
> 2014-05-15 13:44 GMT+04:00 Tim Hutt  >:
>
> 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
> mailto:christian.kande...@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@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
>
>
>
> ___
> 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-proje

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

2014-05-15 Thread Christian Kandeler
On 05/15/2014 11:44 AM, Tim Hutt wrote:
> 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.

See http://qt-project.org/doc/qbs-1.2/cpp-module.html for information on 
the cpp module.

> Is there any documentation on profiles?

For the command line, see the "qbs setup-toolchains" command. It comes 
with a "--help" option that should tell you everything you need to know.

> 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).

Qt Creator will automatically create a qbs profile from your Kit. 
Additional properties can be set in Qt Creator's build step (or in your 
project files).

> 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?

The profile does not "find" anything, it *knows* where the toolchain is 
because it was given that information when it was created. It makes no 
sense to distribute this information as the location of the toolchain is 
dependent on the host system.


Christian

>
> Thanks for the info Denis!
>
>
> On 15 May 2014 10:33, Christian Kandeler  > 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@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
>
>
>
>
> ___
> 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


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

2014-05-15 Thread Denis Shienkov
> 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 :

> 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 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@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
>>
>
>
> ___
> 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


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

2014-05-15 Thread Tim Hutt
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 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@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
>
___
QBS mailing list
QBS@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


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

2014-05-15 Thread Denis Shienkov
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 :

> 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


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

2014-05-15 Thread Christian Kandeler
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@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


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

2014-05-15 Thread Tim Hutt
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