|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-12-26 17:56:07
On Tuesday 19 December 2006 17:09, Hassan Mehmet wrote:
[personal CC for convenience, please reply to the list]
> Is there any simple overview / examples of how rules, actions and generators are all related?
>
> In particular I'm struggling to understand if I need to create a rule, an action, a standard generator or my own generator subclass. I have not really been able to figure this out from the manual.
>
> The problem is:
> I have taken over some Jamfiles written by someone else. In it they have created an action to generate CPP files from SWIG files which are then used to generate a python-extension. The action to create the CPP from SWIG follows the verbatim example in the manual and is fairly easy to follow.
>
> import type ;
> import generators ;
>
> type.register SWIG : i ;
> actions swig-action { swig -c++ -python -Iinclude -o $(<) $(>) }
>
> generators.register-standard swig-swig-action : SWIG : CPP ;
>
> The build system now knows how to convert SWIG files to CPP which are then used to create the python extension library.
>
> Now I want to generate a C# version. This also creates CPP
> files from SWIG but has different arguments. So I need an action like
Sorry, if you need C# version, then you don't get CPP files. I think C++ and C# are completely
different languages.
>
> actions swig-csharp { swig -c++ -csharp -Iinclude -o $(<) $(>) }
>
> The problem now is I (obviously) cannot use the python-extension rule.
> So I assume I need to create my own rule ?
> How do I get this new rule to call the swig-csharp action.
> Or do I need to do something more complicated?
You did not indicate what syntax in Jamfile you want. If you just want to be
able to convert SWIG files into C# files, using:
cs whatever : whatever.swig ;
then what about the following:
import type ;
import generators ;
type.register SWIG : i ;
actions swig-action-cs { .................. }
generators.register-standard swig-swig-action-cs : SWIG : CS ;
You might need to also define the CS type.
HTH,
Volodya
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