Deleted Added
sdiff udiff text old ( 11500:024291dab733 ) new ( 11548:91f58918a76a )
full compact
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 222 unchanged lines hidden (view full) ---

231
232 def __init__(self, package, source, **guards):
233 '''Specify the python package, the source file, and any guards'''
234 super(SwigSource, self).__init__(source, skip_no_python=True, **guards)
235
236 modname,ext = self.extname
237 assert ext == 'i'
238
239 self.module = modname
240 cc_file = joinpath(self.dirname, modname + '_wrap.cc')
241 py_file = joinpath(self.dirname, modname + '.py')
242
243 self.cc_source = Source(cc_file, swig=True, parent=self, **guards)
244 self.py_source = PySource(package, py_file, parent=self, **guards)
245
246class ProtoBuf(SourceFile):

--- 564 unchanged lines hidden (view full) ---

811 extra_deps = [ py_source.tnode ]
812 i_file = File('python/m5/internal/param_%s.i' % name)
813 env.Command(i_file, Value(name),
814 MakeAction(createSimObjectSwigWrapper, Transform("SO SWIG")))
815 env.Depends(i_file, depends + extra_deps)
816 SwigSource('m5.internal', i_file)
817
818# Generate the main swig init file
819def makeEmbeddedSwigInit(target, source, env):
820 code = code_formatter()
821 module = source[0].get_contents()
822 code('''\
823#include "sim/init.hh"
824
825extern "C" {
826 void init_${module}();
827}
828
829EmbeddedSwig embed_swig_${module}(init_${module});
830''')
831 code.write(str(target[0]))
832
833# Build all swig modules
834for swig in SwigSource.all:
835 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode,
836 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
837 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG")))
838 cc_file = str(swig.tnode)
839 init_file = '%s/%s_init.cc' % (dirname(cc_file), basename(cc_file))
840 env.Command(init_file, Value(swig.module),
841 MakeAction(makeEmbeddedSwigInit, Transform("EMBED SW")))
842 env.Depends(SWIG, init_file)
843 Source(init_file, **swig.guards)
844
845# Build all protocol buffers if we have got protoc and protobuf available
846if env['HAVE_PROTOBUF']:
847 for proto in ProtoBuf.all:
848 # Use both the source and header as the target, and the .proto
849 # file as the source. When executing the protoc compiler, also

--- 478 unchanged lines hidden ---