From d8502ee46d356830698d7b96b29e4b27906a2d79 Mon Sep 17 00:00:00 2001 From: Andrew Bardsley Date: Thu, 16 Oct 2014 05:49:32 -0400 Subject: config: Add a --without-python option to build process Add the ability to build libgem5 without embedded Python or the ability to configure with Python. This is a prelude to a patch to allow config.ini files to be loaded into libgem5 using only C++ which would make embedding gem5 within other simulation systems easier. This adds a few registration interfaces to things which cross between Python and C++. Namely: stats dumping and SimObject resolving --- src/python/swig/pyobject.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/python/swig/pyobject.cc') diff --git a/src/python/swig/pyobject.cc b/src/python/swig/pyobject.cc index 51bd1f62f..fed60ba46 100644 --- a/src/python/swig/pyobject.cc +++ b/src/python/swig/pyobject.cc @@ -157,9 +157,12 @@ extern "C" SimObject *convertSwigSimObjectPtr(PyObject *); // these in sim/main.cc as well that are handled without this define. #define PCC(s) const_cast(s) +/** Single instance of PythonSimObjectResolver as its action is effectively + * static but SimObjectResolver can use a non-persistent object */ +PythonSimObjectResolver pythonSimObjectResolver; SimObject * -resolveSimObject(const string &name) +PythonSimObjectResolver::resolveSimObject(const string &name) { PyObject *module = PyImport_ImportModule(PCC("m5.SimObject")); if (module == NULL) @@ -188,3 +191,9 @@ resolveSimObject(const string &name) return obj; } + +Checkpoint * +getCheckpoint(const std::string &cpt_dir) +{ + return new Checkpoint(cpt_dir, pythonSimObjectResolver); +} -- cgit v1.2.3