SConscript (10278:362875aec1ba) | SConscript (10453:d0365cc3d05f) |
---|---|
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 --- 49 unchanged lines hidden (view full) --- 58# 59# When specifying a source file of some type, a set of guards can be 60# specified for that file. When get() is used to find the files, if 61# get specifies a set of filters, only files that match those filters 62# will be accepted (unspecified filters on files are assumed to be 63# false). Current filters are: 64# main -- specifies the gem5 main() function 65# skip_lib -- do not put this file into the gem5 library | 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 --- 49 unchanged lines hidden (view full) --- 58# 59# When specifying a source file of some type, a set of guards can be 60# specified for that file. When get() is used to find the files, if 61# get specifies a set of filters, only files that match those filters 62# will be accepted (unspecified filters on files are assumed to be 63# false). Current filters are: 64# main -- specifies the gem5 main() function 65# skip_lib -- do not put this file into the gem5 library |
66# skip_no_python -- do not put this file into a no_python library 67# as it embeds compiled Python |
|
66# <unittest> -- unit tests use filters based on the unit test name 67# 68# A parent can now be specified for a source file and default filter 69# values will be retrieved recursively from parents (children override 70# parents). 71# 72class SourceMeta(type): 73 '''Meta class for source files that keeps track of all files of a --- 150 unchanged lines hidden (view full) --- 224 225 bisect.insort_right(SimObject.modnames, self.modname) 226 227class SwigSource(SourceFile): 228 '''Add a swig file to build''' 229 230 def __init__(self, package, source, **guards): 231 '''Specify the python package, the source file, and any guards''' | 68# <unittest> -- unit tests use filters based on the unit test name 69# 70# A parent can now be specified for a source file and default filter 71# values will be retrieved recursively from parents (children override 72# parents). 73# 74class SourceMeta(type): 75 '''Meta class for source files that keeps track of all files of a --- 150 unchanged lines hidden (view full) --- 226 227 bisect.insort_right(SimObject.modnames, self.modname) 228 229class SwigSource(SourceFile): 230 '''Add a swig file to build''' 231 232 def __init__(self, package, source, **guards): 233 '''Specify the python package, the source file, and any guards''' |
232 super(SwigSource, self).__init__(source, **guards) | 234 super(SwigSource, self).__init__(source, skip_no_python=True, **guards) |
233 234 modname,ext = self.extname 235 assert ext == 'i' 236 237 self.module = modname 238 cc_file = joinpath(self.dirname, modname + '_wrap.cc') 239 py_file = joinpath(self.dirname, modname + '.py') 240 | 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 |
241 self.cc_source = Source(cc_file, swig=True, parent=self) 242 self.py_source = PySource(package, py_file, parent=self) | 243 self.cc_source = Source(cc_file, swig=True, parent=self, **guards) 244 self.py_source = PySource(package, py_file, parent=self, **guards) |
243 244class ProtoBuf(SourceFile): 245 '''Add a Protocol Buffer to build''' 246 247 def __init__(self, source, **guards): 248 '''Specify the source file, and any guards''' 249 super(ProtoBuf, self).__init__(source, **guards) 250 --- 618 unchanged lines hidden (view full) --- 869 ${{len(data)}}, 870 ${{len(marshalled)}}); 871 872} // anonymous namespace 873''') 874 code.write(str(target[0])) 875 876for source in PySource.all: | 245 246class ProtoBuf(SourceFile): 247 '''Add a Protocol Buffer to build''' 248 249 def __init__(self, source, **guards): 250 '''Specify the source file, and any guards''' 251 super(ProtoBuf, self).__init__(source, **guards) 252 --- 618 unchanged lines hidden (view full) --- 871 ${{len(data)}}, 872 ${{len(marshalled)}}); 873 874} // anonymous namespace 875''') 876 code.write(str(target[0])) 877 878for source in PySource.all: |
877 env.Command(source.cpp, source.tnode, | 879 env.Command(source.cpp, source.tnode, |
878 MakeAction(embedPyFile, Transform("EMBED PY"))) | 880 MakeAction(embedPyFile, Transform("EMBED PY"))) |
879 Source(source.cpp) | 881 Source(source.cpp, skip_no_python=True) |
880 881######################################################################## 882# 883# Define binaries. Each different build type (debug, opt, etc.) gets 884# a slightly different build environment. 885# 886 887# List of constructed environments to pass back to SConstruct --- 80 unchanged lines hidden (view full) --- 968 else: 969 obj = env.SharedObject(source.tnode) 970 971 if extra_deps: 972 env.Depends(obj, extra_deps) 973 974 return obj 975 | 882 883######################################################################## 884# 885# Define binaries. Each different build type (debug, opt, etc.) gets 886# a slightly different build environment. 887# 888 889# List of constructed environments to pass back to SConstruct --- 80 unchanged lines hidden (view full) --- 970 else: 971 obj = env.SharedObject(source.tnode) 972 973 if extra_deps: 974 env.Depends(obj, extra_deps) 975 976 return obj 977 |
976 static_objs = \ 977 [ make_obj(s, True) for s in Source.get(main=False, skip_lib=False) ] 978 shared_objs = \ 979 [ make_obj(s, False) for s in Source.get(main=False, skip_lib=False) ] | 978 lib_guards = {'main': False, 'skip_lib': False} |
980 | 979 |
980 # Without Python, leave out all SWIG and Python content from the 981 # library builds. The option doesn't affect gem5 built as a program 982 if GetOption('without_python'): 983 lib_guards['skip_no_python'] = False 984 985 static_objs = [ make_obj(s, True) for s in Source.get(**lib_guards) ] 986 shared_objs = [ make_obj(s, False) for s in Source.get(**lib_guards) ] 987 |
|
981 static_date = make_obj(date_source, static=True, extra_deps=static_objs) 982 static_objs.append(static_date) | 988 static_date = make_obj(date_source, static=True, extra_deps=static_objs) 989 static_objs.append(static_date) |
983 | 990 |
984 shared_date = make_obj(date_source, static=False, extra_deps=shared_objs) 985 shared_objs.append(shared_date) 986 987 # First make a library of everything but main() so other programs can 988 # link against m5. 989 static_lib = new_env.StaticLibrary(libname, static_objs) 990 shared_lib = new_env.SharedLibrary(libname, shared_objs) 991 --- 170 unchanged lines hidden --- | 991 shared_date = make_obj(date_source, static=False, extra_deps=shared_objs) 992 shared_objs.append(shared_date) 993 994 # First make a library of everything but main() so other programs can 995 # link against m5. 996 static_lib = new_env.StaticLibrary(libname, static_objs) 997 shared_lib = new_env.SharedLibrary(libname, shared_objs) 998 --- 170 unchanged lines hidden --- |