scons,python: Split the marshal binary into a c++ wrapper and script.
The new c++ wrapper is called gem5py, and will run any python script
using gem5's embedded python interpreter. The "marshal" functionality is
split out into a separate python script gem5py can run.
The command line for gem5py should look like this:
gem5py ${SCRIPT TO RUN} ${ARGS TO THE SCRIPT}
So, for instance, to marshal a file called foo.py, the command line
might look like this:
gem5py python/marshal.py foo.py
Also, this change reorders the sources for the python embedding action
and limits the max_sources for Transform() to 1, so that it just shows
the python file being embedded and not gem5py or the marshal.py script.
Those are still sources so dependency tracking works correctly, but they
are also implied and just add visual noise to the build output.
Change-Id: I7ae6bd114973ae44c3b634884b6dafc6577e0788
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49392
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
12
SConstruct
12
SConstruct
@@ -244,9 +244,9 @@ global_vars.AddVariables(
|
||||
('CC', 'C compiler', environ.get('CC', main['CC'])),
|
||||
('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
|
||||
('CCFLAGS_EXTRA', 'Extra C and C++ compiler flags', ''),
|
||||
('GEM5PY_CCFLAGS_EXTRA', 'Extra C and C++ gem5py compiler flags', ''),
|
||||
('GEM5PY_LDFLAGS_EXTRA', 'Extra marshal gem5py flags', ''),
|
||||
('LDFLAGS_EXTRA', 'Extra linker flags', ''),
|
||||
('MARSHAL_CCFLAGS_EXTRA', 'Extra C and C++ marshal compiler flags', ''),
|
||||
('MARSHAL_LDFLAGS_EXTRA', 'Extra marshal linker flags', ''),
|
||||
('PYTHON_CONFIG', 'Python config binary to use',
|
||||
[ 'python3-config', 'python-config']
|
||||
),
|
||||
@@ -530,11 +530,11 @@ if main['USE_PYTHON']:
|
||||
warning('Embedded python library too new. '
|
||||
'Python 3 expected, found %s.' % ver_string)
|
||||
|
||||
marshal_env = main.Clone()
|
||||
gem5py_env = main.Clone()
|
||||
|
||||
# Bare minimum environment that only includes python
|
||||
marshal_env.Append(CCFLAGS='$MARSHAL_CCFLAGS_EXTRA')
|
||||
marshal_env.Append(LINKFLAGS='$MARSHAL_LDFLAGS_EXTRA')
|
||||
gem5py_env.Append(CCFLAGS=['${GEM5PY_CCFLAGS_EXTRA}'])
|
||||
gem5py_env.Append(LINKFLAGS=['${GEM5PY_LDFLAGS_EXTRA}'])
|
||||
|
||||
main['HAVE_PKG_CONFIG'] = main.Detect('pkg-config')
|
||||
|
||||
@@ -708,7 +708,7 @@ Build variables for {dir}:
|
||||
env.Append(CCFLAGS='$CCFLAGS_EXTRA')
|
||||
env.Append(LINKFLAGS='$LDFLAGS_EXTRA')
|
||||
|
||||
exports=['env', 'marshal_env']
|
||||
exports=['env', 'gem5py_env']
|
||||
|
||||
# The src/SConscript file sets up the build rules in 'env' according
|
||||
# to the configured variables. It returns a list of environments,
|
||||
|
||||
Reference in New Issue
Block a user