Boost logo

Boost-Build :

Subject: [Boost-build] pch depends on generated files
From: Anatoly Shirokov (shirokov_a_at_[hidden])
Date: 2009-08-04 13:14:06


Hi everybody!

My pch file depends on generated filed which are produced by generator
from CLS file to CPP and H.

The following does not work:

alias wrappers :
     ../../models/aorder.cls
     ../../models/deed.cls
     ../../models/discrete.cls ;

cpp-pch stdafx_pch
   : # sources
     stdafx.h
   : # requirements
     <source>stdafx.cpp <use>wrappers
   ;

bjam does not inherit include path for searching produced header files.
What's wrong?

Here is the generator:

# wrapper.jam
import type ;
import generators ;
import feature ;
import common ;
import os ;
import "class" : new ;

type.register CLS : cls ;

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 * )
     {
         if ! $(sources[2])
         {
             local t = [ $(sources[1]).type ] ;
             local n = [ $(sources[1]).name ] ;
             if $(t) = CLS
             {
                n = C$(n:B) ;
                 local a = [ new action $(sources[1]) : wrapper.gensrc :
$(property-set) ] ;

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

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

             }
         }
     }
}

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

actions gensrc
{
      ECHO wrappergenerator $(>) $(<)
      wrappergenerator $(>) $(<)
}


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