Boost logo

Boost-Build :

Subject: Re: [Boost-build] how to determine location of jamroot ?
From: Anatoly Shirokov (shirokov_a_at_[hidden])
Date: 2009-08-18 10:22:57


Hi there!

Here is my generator:

import type ;
import generators ;
import feature ;
import common ;
import os ;
import "class" : new ;

type.register CLS : xml ;

class wrapper-generator : generator
{
     import "class" : new ;

     rule __init__ ( * : * )
     {
         generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) :
$(7) : $(8) : $(9) ;
     }

     rule run ( project name ? : property-set : sources * )
     {
          import os ;
         if ! $(sources[2])
         {
             local t = [ $(sources[1]).type ] ;
             local n = [ $(sources[1]).name ] ;
             local w = c:/work/buildroot/generated ;
             if $(t) = CLS
             {
                n = $(n:B) ;
                 n = C$(n:B) ;
                l = [ $(project).get location ] ;

                 local a = [ new action $(sources[1]) : wrapper.gensrc :
$(property-set) ] ;

                 local t1 = [ new file-target $(n) : CPP : $(project) :
$(a) : $(w) ] ;
                 local t2 = [ new file-target $(n) : H : $(project) :
$(a) : $(w) ] ;

                 return [ virtual-target.register $(t1) ]
                        [ virtual-target.register $(t2) ] ;

             }
         }
     }
}

generators.register [ new wrapper-generator wrapper.wrapper : CLS : H
CPP ] ;

actions gensrc
{
      ECHO wrappergenerator $(>) $(<)
      wrappergenerator $(>) $(<[1]:D)
}

I want to replace the hardcoded path :

local w = c:/work/generated ;

with something like this:

local w = [ os.environ GENERATED_DIR ] ;

But I get the following error:

wrapper.jam:27: in object(wrapper-generator)@149.run
rule os.environ unknown in module object(wrapper-generator)@149.

What is wrong?

Thanks in advance,
Anatoly.


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk