Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/16810 )
Change subject: systemc: Move systemc disabling checks to SConsopts.
......................................................................
systemc: Move systemc disabling checks to SConsopts.
This will ensure that the value of USE_SYSTEMC is consistent throughout
the build. It also has the side effect that USE_SYSTEMC can be forced
to a particular value if you're confident you know what you're doing
and want to override these checks.
Change-Id: I0f2d1153245ff17ce4a828c6b7496cb9ded6bd5b
Reviewed-on: https://gem5-review.googlesource.com/c/16810
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/SConscript
M src/systemc/SConsopts
2 files changed, 26 insertions(+), 18 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
diff --git a/src/systemc/SConscript b/src/systemc/SConscript
index c820b45..b267394 100644
--- a/src/systemc/SConscript
+++ b/src/systemc/SConscript
@@ -27,22 +27,9 @@
Import('*')
-from m5.util import compareVersions
-from m5.util.terminal import termcap
+if not env['USE_SYSTEMC']:
+ Return()
-if env['USE_SYSTEMC']:
- if ('GCC_VERSION' in env and \
- compareVersions(env['GCC_VERSION'], '5.0') < 0) or \
- env['PLATFORM'] == 'darwin':
+env.UseSystemcCheck(warn=True)
- if env['PLATFORM'] == 'darwin':
- print(termcap.Yellow + termcap.Bold +
- 'Warning: Disabling systemc on Mac OS.' + termcap.Normal)
- else:
- print(termcap.Yellow + termcap.Bold +
- 'Warning: Disabling systemc on gcc versions less than
5.0.' +
- termcap.Normal)
- env['USE_SYSTEMC'] = False
- Return()
-
- env.Append(CPPPATH=Dir('ext'))
+env.Append(CPPPATH=Dir('ext'))
diff --git a/src/systemc/SConsopts b/src/systemc/SConsopts
index fc0abb2..172de57 100644
--- a/src/systemc/SConsopts
+++ b/src/systemc/SConsopts
@@ -27,8 +27,29 @@
Import('*')
+from m5.util import compareVersions
+from m5.util.terminal import termcap
+
+def use_systemc_check(env, warn=False):
+ if ('GCC_VERSION' in env and
+ compareVersions(env['GCC_VERSION'], '5.0') < 0):
+ if warn:
+ print(termcap.Yellow + termcap.Bold +
+ 'Warning: Systemc may not work on gcc versions less '
+ 'than 5.0.' + termcap.Normal)
+ return False
+ elif env['PLATFORM'] == 'darwin':
+ if warn:
+ print(termcap.Yellow + termcap.Bold +
+ 'Warning: Systemc may not work on Mac OS.' +
termcap.Normal)
+ return False
+ return True
+
+main.AddMethod(use_systemc_check, 'UseSystemcCheck')
+
sticky_vars.AddVariables(
- BoolVariable('USE_SYSTEMC', 'Enable SystemC API support', True)
+ BoolVariable('USE_SYSTEMC', 'Enable SystemC API support',
+ main.UseSystemcCheck())
)
export_vars.append('USE_SYSTEMC')
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16810
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I0f2d1153245ff17ce4a828c6b7496cb9ded6bd5b
Gerrit-Change-Number: 16810
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andrea Mondelli <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev