Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).
Differences between revisions 7 and 8
Revision 7 as of 2007-07-19 17:46:10
Size: 1154
Editor: StevenKnight
Revision 8 as of 2008-03-12 02:47:06
Size: 1154
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Building SWIG wrappers with SCons

SWIG already works out the the box, you just add your *.i file to the list of source files and it will all turn out fine.

Built-in SWIG doesn't track down dependencies though, so try this snippet from Mattias on the mailing list:

Update 19 July 2007: Support for tracking SWIG dependencies has been added to the SCons code base and will be available next release (most likely 0.97.1). The configuration is controlled by a $SWIGPATH variable that is searched for .i files and which gets translated into -I options on the command line (like the $CPPPATH variable does for C preprocessing).

   1 import SCons.Script
   3 #... then, later...
   5 SWIGScanner = SCons.Scanner.ClassicCPP(
   6     "SWIGScan",
   7     ".i",
   8     "CPPPATH",
   9     '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
  10 )
  12 env.Prepend(SCANNERS=[SWIGScanner])

Mattias also writes: "Regarding the _wrap.h for directors I just add it add a SideEffect and a Clean call for it. You might also considering throwing a Depends() in there. Do the same for the generated .py file."

-- JohnPye

SwigBuilder (last edited 2008-03-12 02:47:06 by localhost)