Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/49421 )

 (

32 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one. )Change subject: python,scons: Add a gem5py_m5 program which supports the m5 module.
......................................................................

python,scons: Add a gem5py_m5 program which supports the m5 module.

Like gem5py which uses the same main source file, this program will run
arbitrary python scripts. Unlike the other program, it will include
support for the m5 module. That will make it capable of generating
SimObject param, enum, etc c++ files.

Change-Id: I15fd7545f6b1ea6559cbe27cef30c778867ebe70
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49421
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/python/SConscript
M src/SConscript
2 files changed, 35 insertions(+), 5 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/SConscript b/src/SConscript
index b19c3c5..d566010 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -81,8 +81,11 @@
 # as gem5. This is in an unorthodox location to avoid building it for every
 # variant.
 gem5py_env = gem5py_env.Clone()
-gem5py = gem5py_env.Program('gem5py', 'python/gem5py.cc')[0]
+gem5py = gem5py_env.File('gem5py')
+gem5py_m5 = gem5py_env.File('gem5py_m5')
 gem5py_env['GEM5PY'] = gem5py
+gem5py_env['GEM5PY_M5'] = gem5py_m5
+gem5py_env['OBJSUFFIX'] = '.pyo'
 # Inject build_tools into PYTHONPATH for when we run gem5py.
 pythonpath = gem5py_env['ENV'].get('PYTHONPATH', '').split(':')
 pythonpath.append(build_tools.abspath)
@@ -134,7 +137,7 @@
                        '"${PYSOURCE_ABSPATH}"',
                        Transform("EMBED PY", max_sources=1)),
             **overrides)
-        Source(cpp, tags=self.tags, add_tags='python')
+        Source(cpp, tags=self.tags, add_tags=['python', 'm5_module'])

 class SimObject(PySource):
     '''Add a SimObject python file as a python source object and add
@@ -640,6 +643,15 @@
             INFOPY_PY=build_tools.File('infopy.py'))
 PySource('m5', 'python/m5/info.py')

+gem5py_m5_env = gem5py_env.Clone()
+gem5py_env.Append(CPPPATH=env['CPPPATH'])
+gem5py_env.Append(LIBS='z')
+gem5py_env.Program(gem5py, 'python/gem5py.cc')[0]
+m5_module_source = \
+        Source.all.with_all_tags(env, 'm5_module', 'gem5 lib')
+m5_module_static = list(map(lambda s: s.static(gem5py_env), m5_module_source))
+gem5py_env.Program(gem5py_m5, [ 'python/gem5py.cc' ] + m5_module_static)
+
 ########################################################################
 #
 # Create all of the SimObject param headers and enum headers
diff --git a/src/python/SConscript b/src/python/SConscript
index c9cd2d4..1939100 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -253,10 +253,10 @@
 PySource('m5.ext.pystats', 'm5/ext/pystats/jsonloader.py')
 PySource('m5.stats', 'm5/stats/gem5stats.py')

-Source('embedded.cc', add_tags='python')
-Source('importer.cc', add_tags='python')
+Source('embedded.cc', add_tags=['python', 'm5_module'])
+Source('importer.cc', add_tags=['python', 'm5_module'])
 cc, hh = env.Blob('m5ImporterCode', 'importer.py')
-Source(cc, add_tags='python')
+Source(cc, add_tags=['python', 'm5_module'])

 Source('pybind11/core.cc', add_tags='python')
 Source('pybind11/debug.cc', add_tags='python')

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49421
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I15fd7545f6b1ea6559cbe27cef30c778867ebe70
Gerrit-Change-Number: 49421
Gerrit-PatchSet: 34
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to