summaryrefslogtreecommitdiff
path: root/ext/systemc/SConscript
diff options
context:
space:
mode:
Diffstat (limited to 'ext/systemc/SConscript')
-rw-r--r--ext/systemc/SConscript71
1 files changed, 45 insertions, 26 deletions
diff --git a/ext/systemc/SConscript b/ext/systemc/SConscript
index 804f7abfc..c2e67ae1c 100644
--- a/ext/systemc/SConscript
+++ b/ext/systemc/SConscript
@@ -24,41 +24,60 @@
# Matthias Jung
import os
+from m5.util.terminal import get_termcap
Import('main')
+systemc = main.Clone()
-main.Prepend(CPPPATH=Dir('./src'))
-main.Prepend(CPATH=Dir('./src'))
+build_root = Dir('.').abspath
+src_root = Dir('.').srcdir.abspath
-main.Prepend(CXXFLAGS=['-DSC_INCLUDE_FX', '-pthread'])
-main.Prepend(CFLAGS=['-DSC_INCLUDE_FX', '-pthread'])
+systemc.Prepend(CPPPATH=Dir('./src'))
+systemc.Prepend(CPATH=Dir('./src'))
-conf = Configure(main)
+systemc.Prepend(CXXFLAGS=['-DSC_INCLUDE_FX'])
+systemc.Prepend(CFLAGS=['-DSC_INCLUDE_FX'])
-if main['PLATFORM'] == 'darwin':
- main.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
+conf = Configure(systemc,
+ conf_dir = os.path.join(build_root, '.scons_config'),
+ log_file = os.path.join(build_root, 'scons_config.log'))
+
+if systemc['PLATFORM'] == 'darwin':
+ systemc.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
+
+arch = None
+systemc['COROUTINE_LIB'] = ''
+if conf.CheckDeclaration('__i386__'):
+ systemc['COROUTINE_LIB'] = 'qt'
+ systemc['QT_ARCH'] = 'i386'
+ arch = 'i386'
+elif conf.CheckDeclaration('__x86_64__'):
+ systemc['COROUTINE_LIB'] = 'qt'
+ systemc['QT_ARCH'] = 'iX86_64'
+ arch = 'x86_64'
+else:
+ termcap = get_termcap(GetOption('use_colors'))
+ print termcap.Yellow + termcap.Bold + \
+ "Warning: Unrecognized architecture for systemc." + termcap.Normal
-s_file = None
-if conf.CheckDeclaration("__i386__"):
- s_file = 'i386.s'
-if conf.CheckDeclaration("__x86_64__"):
- s_file = 'iX86_64.s'
conf.Finish()
-if s_file is None:
- print 'Unsupported CPU architecture!'
- Exit(1)
+if systemc['COROUTINE_LIB'] == 'pthreads':
+ systemc.Prepend(CXXFLAGS=['-DSC_USE_PTHREADS'])
+
+systemc_files = []
+def SystemCSource(*args):
+ for arg in args:
+ systemc_files.append(systemc.File(arg))
-systemc_files = Glob('src/sysc/kernel/*.cpp')
-systemc_files += ['src/sysc/qt/qt.c', 'src/sysc/qt/md/' + s_file]
-systemc_files += Glob('src/sysc/communication/*.cpp')
-systemc_files += Glob('src/sysc/tracing/*.cpp')
-systemc_files += Glob('src/sysc/utils/*.cpp')
-systemc_files += Glob('src/sysc/datatypes/bit/*.cpp')
-systemc_files += Glob('src/sysc/datatypes/fx/*.cpp')
-systemc_files += Glob('src/sysc/datatypes/int/*.cpp')
-systemc_files += Glob('src/sysc/datatypes/misc/*.cpp')
+if arch:
+ for root, dirs, files in os.walk(src_root):
+ if 'SConscript.sc' in files:
+ build_dir = os.path.relpath(root, src_root)
+ systemc.SConscript(os.path.join(root, 'SConscript.sc'),
+ exports=['systemc', 'SystemCSource'],
+ variant_dir=os.path.join(build_root, build_dir))
-main.Library('libsystemc', systemc_files)
-main.SharedLibrary('libsystemc', systemc_files)
+ systemc.Library('libsystemc', systemc_files)
+ systemc.SharedLibrary('libsystemc', systemc_files)