if not conf.CheckLib(lib):
error("Can't find library %s required by python." % lib)
-main.Prepend(CPPPATH=Dir('ext/pybind11/include/'))
-# Bare minimum environment that only includes python
-marshal_env = main.Clone()
-marshal_env.Append(CCFLAGS='$MARSHAL_CCFLAGS_EXTRA')
-marshal_env.Append(LINKFLAGS='$MARSHAL_LDFLAGS_EXTRA')
-py_version = conf.CheckPythonLib()
-if not py_version:
- error("Can't find a working Python installation")
-
-# Found a working Python installation. Check if it meets minimum
-# requirements.
-if py_version[0] < 3 or \
- (py_version[0] == 3 and py_version[1] < 6):
- error('Python version too old. Version 3.6 or newer is required.')
-elif py_version[0] > 3:
- warning('Python version too new. Python 3 expected.')
+ main.Prepend(CPPPATH=Dir('ext/pybind11/include/'))
+
+ marshal_env = main.Clone()
+
+ # Bare minimum environment that only includes python
+ marshal_env.Append(CCFLAGS='$MARSHAL_CCFLAGS_EXTRA')
+ marshal_env.Append(LINKFLAGS='$MARSHAL_LDFLAGS_EXTRA')
+
+ py_version = conf.CheckPythonLib()
+ if not py_version:
+ error("Can't find a working Python installation")
+
+ # Found a working Python installation. Check if it meets minimum
+ # requirements.
+ if py_version[0] < 3 or \
+ (py_version[0] == 3 and py_version[1] < 6):
+ error('Python version too old. Version 3.6 or newer is required.')
+ elif py_version[0] > 3:
+ warning('Python version too new. Python 3 expected.')
# On Solaris you need to use libsocket for socket ops
if not conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):
env.Append(CCFLAGS='$CCFLAGS_EXTRA')
env.Append(LINKFLAGS='$LDFLAGS_EXTRA')
+ exports=['env']
+ if main['USE_PYTHON']:
+ exports.append('marshal_env')
+
# The src/SConscript file sets up the build rules in 'env' according
# to the configured variables. It returns a list of environments,
# one for each variant build (debug, opt, etc.)
- SConscript('src/SConscript', variant_dir=variant_path,
- exports=['env', 'marshal_env'])
+ SConscript('src/SConscript', variant_dir=variant_path, exports=exports)
atexit.register(summarize_warnings)
Transform("VER TAGS")))
env.AlwaysBuild(tags)
-# Build a small helper that marshals the Python code using the same
-# version of Python as gem5. This is in an unorthodox location to
-# avoid building it for every variant.
-py_marshal = marshal_env.Program('marshal', 'python/marshal.cc')[0]
-
# Embed python files. All .py files that have been indicated by a
# PySource() call in a SConscript need to be embedded into the M5
# library. To do that, we compile the file to byte code, marshal the
''')
code.write(str(target[0]))
-for source in PySource.all:
- marshal_env.Command(source.cpp, [ py_marshal, source.tnode ],
+if main['USE_PYTHON']:
+ # Build a small helper that marshals the Python code using the same
+ # version of Python as gem5. This is in an unorthodox location to
+ # avoid building it for every variant.
+ py_marshal = marshal_env.Program('marshal', 'python/marshal.cc')[0]
+
+ for source in PySource.all:
+ marshal_env.Command(source.cpp, [ py_marshal, source.tnode ],
MakeAction(embedPyFile, Transform("EMBED PY")))
- Source(source.cpp, tags=source.tags, add_tags='python')
+ Source(source.cpp, tags=source.tags, add_tags='python')
########################################################################
#