base,misc: Added version to code

This version ID string can be accessed from elsewhere in the CPP
codebase using `extern const char *gem5Version;`. The python variable
"gem5Version" may be accessed in by importing the generated
"defines.py". When gem5 now runs it will output the version
currently being used to the CLI.

Change-Id: I4feb6b7317cd2922c56eb8ce3e532b0bfa0e6ed3
Issue-on: https://gem5.atlassian.net/browse/GEM5-411
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27787
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Bobby R. Bruce
2020-04-13 14:01:11 -07:00
parent 9884641603
commit 571ab4ad70
6 changed files with 36 additions and 0 deletions

View File

@@ -273,6 +273,7 @@ def main(*args):
done = True
print('Build information:')
print()
print('gem5 version %s' % defines.gem5Version)
print('compiled %s' % defines.compileDate)
print('build options:')
keys = list(defines.buildEnv.keys())
@@ -336,6 +337,7 @@ def main(*args):
print(brief_copyright)
print()
print("gem5 version %s" % defines.gem5Version)
print("gem5 compiled %s" % defines.compileDate)
print("gem5 started %s" %

View File

@@ -79,6 +79,7 @@ PybindSimObjectResolver::resolveSimObject(const std::string &name)
}
extern const char *compileDate;
extern const char *gem5Version;
#ifdef DEBUG
const bool flag_DEBUG = true;
@@ -260,6 +261,7 @@ pybind_init_core(py::module &m_native)
/* TODO: These should be read-only */
m_core.attr("compileDate") = py::cast(compileDate);
m_core.attr("gem5Version") = py::cast(gem5Version);
m_core.attr("flag_DEBUG") = py::cast(flag_DEBUG);
m_core.attr("flag_DEBUG") = py::cast(flag_DEBUG);