Boost logo

Boost-Build :

From: Denis N. Kononenko (denisn.kononenko_at_[hidden])
Date: 2006-12-23 05:13:47

2006/12/19, Hassan Mehmet <hassan_mehmet_at_[hidden]>:


I'm newbie to bbv2, but I'll try to help you.

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

I think you have to parametrize the existing swig-action with using
features. Something, like this:

import feature : feature ;
feature swig-target : python csharp : propagated ;

import toolset : flags ;
flags swig-action SWIG_TARGET <swig-target>python : -python ;
flags swig-action SWIG_TARGET <swig-target>csharp : -csharp ;

actions swig-action { swig -c++ $(SWIG_TARGET) -Iinclude -o $(<) $(>) }

And then, you may explicitly specify a desired target in your Jamfile
by using the feature <swig-target> in requirements:

exe myapp : myapp.i : <swig-target>csharp ;


exe myapp : myapp.i : <swig-target>python ;


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at