scons,python: Always generate default create() methods.

We were originally generating default create() methods along side the
pybind definitions, but unfortunately those are only included when
python support is included. Since the SimObject Param structs are
unconditionally provided even if the thing calling their create()
methods is not, we need to also unconditionally provide the default
create() definitions. We do that by putting them in their own new .cc
files.

Change-Id: I29d1573d578794b3fe7ec2bc16ef5c8c58e56d0e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42589
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Earl Ou <shunhsingou@google.com>
This commit is contained in:
Gabe Black
2021-03-08 22:16:41 -08:00
parent 6572078a99
commit 7bb690c1ee
2 changed files with 94 additions and 76 deletions

View File

@@ -917,7 +917,7 @@ PySource('m5', 'python/m5/info.py')
# Create all of the SimObject param headers and enum headers
#
def createSimObjectParamStruct(target, source, env):
def createSimObjectParamDecl(target, source, env):
assert len(target) == 1 and len(source) == 1
name = source[0].get_text_contents()
@@ -927,6 +927,16 @@ def createSimObjectParamStruct(target, source, env):
obj.cxx_param_decl(code)
code.write(target[0].abspath)
def createSimObjectParamDef(target, source, env):
assert len(target) == 1 and len(source) == 1
name = source[0].get_text_contents()
obj = sim_objects[name]
code = code_formatter()
obj.cxx_param_def(code)
code.write(target[0].abspath)
def createSimObjectCxxConfig(is_header):
def body(target, source, env):
assert len(target) == 1 and len(source) == 1
@@ -987,9 +997,16 @@ for name,simobj in sorted(sim_objects.items()):
hh_file = File('params/%s.hh' % name)
params_hh_files.append(hh_file)
env.Command(hh_file, Value(name),
MakeAction(createSimObjectParamStruct, Transform("SO PARAM")))
MakeAction(createSimObjectParamDecl, Transform("SOPARMHH")))
env.Depends(hh_file, depends + extra_deps)
if not getattr(simobj, 'abstract', False) and hasattr(simobj, 'type'):
cc_file = File('params/%s.cc' % name)
env.Command(cc_file, Value(name),
MakeAction(createSimObjectParamDef, Transform("SOPARMCC")))
env.Depends(cc_file, depends + extra_deps)
Source(cc_file)
# C++ parameter description files
if GetOption('with_cxx_config'):
for name,simobj in sorted(sim_objects.items()):