Automatically generate m5/internal/__init__.py and swig/init.cc
based on the swig modules that we have --HG-- extra : convert_revision : 2fd12db39d46608a62b9df36c2b36189f1d2bc30
This commit is contained in:
parent
3fb3616be4
commit
a329631edb
1 changed files with 31 additions and 4 deletions
|
@ -99,12 +99,13 @@ pyzip_files.append('m5/info.py')
|
||||||
pyzip_files.append(join(env['ROOT'], 'util/pbs/jobfile.py'))
|
pyzip_files.append(join(env['ROOT'], 'util/pbs/jobfile.py'))
|
||||||
pyzip_files.append(join(env['ROOT'], 'src/base/traceflags.py'))
|
pyzip_files.append(join(env['ROOT'], 'src/base/traceflags.py'))
|
||||||
|
|
||||||
def swig_it(basename):
|
swig_modules = []
|
||||||
env.Command(['swig/%s_wrap.cc' % basename, 'm5/internal/%s.py' % basename],
|
def swig_it(module):
|
||||||
'swig/%s.i' % basename,
|
env.Command(['swig/%s_wrap.cc' % module, 'm5/internal/%s.py' % module],
|
||||||
|
'swig/%s.i' % module,
|
||||||
'$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
|
'$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
|
||||||
'-o ${TARGETS[0]} $SOURCES')
|
'-o ${TARGETS[0]} $SOURCES')
|
||||||
pyzip_dep_files.append('m5/internal/%s.py' % basename)
|
swig_modules.append(module)
|
||||||
|
|
||||||
swig_it('main')
|
swig_it('main')
|
||||||
swig_it('debug')
|
swig_it('debug')
|
||||||
|
@ -113,6 +114,32 @@ swig_it('random')
|
||||||
swig_it('stats')
|
swig_it('stats')
|
||||||
swig_it('trace')
|
swig_it('trace')
|
||||||
|
|
||||||
|
# Automatically generate m5/internals/__init__.py
|
||||||
|
def MakeInternalsInit(target, source, env):
|
||||||
|
f = file(str(target[0]), 'w')
|
||||||
|
for m in swig_modules:
|
||||||
|
print >>f, 'import %s' % m
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
swig_py_files = [ 'm5/internal/%s.py' % m for m in swig_modules ]
|
||||||
|
env.Command('m5/internal/__init__.py', swig_py_files, MakeInternalsInit)
|
||||||
|
pyzip_dep_files.append('m5/internal/__init__.py')
|
||||||
|
|
||||||
|
def MakeSwigInit(target, source, env):
|
||||||
|
f = file(str(target[0]), 'w')
|
||||||
|
print >>f, 'extern "C" {'
|
||||||
|
for m in swig_modules:
|
||||||
|
print >>f, ' void init_%s();' % m
|
||||||
|
print >>f, '}'
|
||||||
|
print >>f, 'void init_swig() {'
|
||||||
|
for m in swig_modules:
|
||||||
|
print >>f, ' init_%s();' % m
|
||||||
|
print >>f, '}'
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
swig_cc_files = [ 'swig/%s_wrap.cc' % m for m in swig_modules ]
|
||||||
|
env.Command('swig/init.cc', swig_cc_files, MakeSwigInit)
|
||||||
|
|
||||||
# Action function to build the zip archive. Uses the PyZipFile module
|
# Action function to build the zip archive. Uses the PyZipFile module
|
||||||
# included in the standard Python library.
|
# included in the standard Python library.
|
||||||
def buildPyZip(target, source, env):
|
def buildPyZip(target, source, env):
|
||||||
|
|
Loading…
Reference in a new issue