So in my case, the name of the library I want to create is called bright.
Scons is aware of swig, all you need is the SwigFlags and the .i in your sources for it all to work nicely.
I have my individual .i files (one per C++ header) mixed in with the source, and a bright.i class that sets the module name, and includes all the other .i files.
Here's an example:
# # Works on linux and Mac, # Mac use scons 0.96.90.D001 or later # linux use 0.96.1 or later # import wx.build.config as conf library = '_bright' wxPrefix = '/usr/' sourceDir = '../../src/' # on linux, it's probably in the system's /usr/local/lib env = Environment() sourceFiles = [ 'bright.i', 'imaging/imageColorFilter.cpp', # ... ] sources = [os.path.join(sourceDir, src) for src in sourceFiles] env['CPPPATH'] = [ '../../src/', '../../libs/crypto521', '/usr/include/python2.4/', '/usr/include/wx-2.6/wx/wxPython/i_files/' ] SwigFlags = "-c++ -Wall -nodefault -python -keyword -new_repr -modern -I/usr/include/wx-2.6/wx/wxPython/i_files/" # Adds the necessary flags for compiling and linking wxWidgets projects env.ParseConfig('wx-config --cppflags --libs') env.Append(CCFLAGS=['-DSWIG_TYPE_TABLE=_wxPython_table']) brightlib = env.SharedLibrary(library, sources, SHLIBPREFIX="", SWIGFLAGS=SwigFlags, build_dir='/tmp/', duplicate=0) # manage dependancies by target's content # this way a change to a comment will cause # a recompile, but not a relink TargetSignatures('content') import pprint pprint.pprint( brightlib)
so all I have to do is type scons to create my wxPython extension, and then I have to go hunt for where it places the various resulting files. The _bright.so ends up in the source directory, and the bright.py file is in the directory where scons is invoked from (if I remember right.)