SConscript (9338:97b4a2be1e5b) SConscript (9396:0c0ec9d87746)
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

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

228
229 self.module = modname
230 cc_file = joinpath(self.dirname, modname + '_wrap.cc')
231 py_file = joinpath(self.dirname, modname + '.py')
232
233 self.cc_source = Source(cc_file, swig=True, parent=self)
234 self.py_source = PySource(package, py_file, parent=self)
235
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

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

228
229 self.module = modname
230 cc_file = joinpath(self.dirname, modname + '_wrap.cc')
231 py_file = joinpath(self.dirname, modname + '.py')
232
233 self.cc_source = Source(cc_file, swig=True, parent=self)
234 self.py_source = PySource(package, py_file, parent=self)
235
236class ProtoBuf(SourceFile):
237 '''Add a Protocol Buffer to build'''
238
239 def __init__(self, source, **guards):
240 '''Specify the source file, and any guards'''
241 super(ProtoBuf, self).__init__(source, **guards)
242
243 # Get the file name and the extension
244 modname,ext = self.extname
245 assert ext == 'proto'
246
247 # Currently, we stick to generating the C++ headers, so we
248 # only need to track the source and header.
249 self.cc_file = File(joinpath(self.dirname, modname + '.pb.cc'))
250 self.hh_file = File(joinpath(self.dirname, modname + '.pb.h'))
251
236class UnitTest(object):
237 '''Create a UnitTest'''
238
239 all = []
240 def __init__(self, target, *sources, **kwargs):
241 '''Specify the target name and any sources. Sources that are
242 not SourceFiles are evalued with Source(). All files are
243 guarded with a guard of the same name as the UnitTest

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

255 self.main = kwargs.get('main', False)
256 UnitTest.all.append(self)
257
258# Children should have access
259Export('Source')
260Export('PySource')
261Export('SimObject')
262Export('SwigSource')
252class UnitTest(object):
253 '''Create a UnitTest'''
254
255 all = []
256 def __init__(self, target, *sources, **kwargs):
257 '''Specify the target name and any sources. Sources that are
258 not SourceFiles are evalued with Source(). All files are
259 guarded with a guard of the same name as the UnitTest

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

271 self.main = kwargs.get('main', False)
272 UnitTest.all.append(self)
273
274# Children should have access
275Export('Source')
276Export('PySource')
277Export('SimObject')
278Export('SwigSource')
279Export('ProtoBuf')
263Export('UnitTest')
264
265########################################################################
266#
267# Debug Flags
268#
269debug_flags = {}
270def DebugFlag(name, desc=None):

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

671 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
672 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG")))
673 cc_file = str(swig.tnode)
674 init_file = '%s/%s_init.cc' % (dirname(cc_file), basename(cc_file))
675 env.Command(init_file, Value(swig.module),
676 MakeAction(makeEmbeddedSwigInit, Transform("EMBED SW")))
677 Source(init_file, **swig.guards)
678
280Export('UnitTest')
281
282########################################################################
283#
284# Debug Flags
285#
286debug_flags = {}
287def DebugFlag(name, desc=None):

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

688 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
689 '-o ${TARGETS[0]} $SOURCES', Transform("SWIG")))
690 cc_file = str(swig.tnode)
691 init_file = '%s/%s_init.cc' % (dirname(cc_file), basename(cc_file))
692 env.Command(init_file, Value(swig.module),
693 MakeAction(makeEmbeddedSwigInit, Transform("EMBED SW")))
694 Source(init_file, **swig.guards)
695
696# Build all protocol buffers if we have got protoc and protobuf available
697if env['HAVE_PROTOBUF']:
698 for proto in ProtoBuf.all:
699 # Use both the source and header as the target, and the .proto
700 # file as the source. When executing the protoc compiler, also
701 # specify the proto_path to avoid having the generated files
702 # include the path.
703 env.Command([proto.cc_file, proto.hh_file], proto.tnode,
704 MakeAction('$PROTOC --cpp_out ${TARGET.dir} '
705 '--proto_path ${SOURCE.dir} $SOURCE',
706 Transform("PROTOC")))
707
708 # Add the C++ source file
709 Source(proto.cc_file, **proto.guards)
710elif ProtoBuf.all:
711 print 'Got protobuf to build, but lacks support!'
712 Exit(1)
713
679#
680# Handle debug flags
681#
682def makeDebugFlagCC(target, source, env):
683 assert(len(target) == 1 and len(source) == 1)
684
685 val = eval(source[0].get_contents())
686 name, compound, desc = val

--- 367 unchanged lines hidden ---
714#
715# Handle debug flags
716#
717def makeDebugFlagCC(target, source, env):
718 assert(len(target) == 1 and len(source) == 1)
719
720 val = eval(source[0].get_contents())
721 name, compound, desc = val

--- 367 unchanged lines hidden ---