SConscript (12027:1eb7dc7aa10b) | SConscript (12046:35899b7da75f) |
---|---|
1# Copyright (c) 2017, TU Dresden 2# Copyright (c) 2017, University of Kaiserslautern 3# All rights reserved. 4 5# Permission is hereby granted, free of charge, to any person obtaining a copy 6# of this software and associated documentation files (the "Software"), to deal 7# in the Software without restriction, including without limitation the rights 8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- 10 unchanged lines hidden (view full) --- 19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21# SOFTWARE. 22# 23# Authors: Christian Menard 24# Matthias Jung 25 26import os | 1# Copyright (c) 2017, TU Dresden 2# Copyright (c) 2017, University of Kaiserslautern 3# All rights reserved. 4 5# Permission is hereby granted, free of charge, to any person obtaining a copy 6# of this software and associated documentation files (the "Software"), to deal 7# in the Software without restriction, including without limitation the rights 8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- 10 unchanged lines hidden (view full) --- 19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21# SOFTWARE. 22# 23# Authors: Christian Menard 24# Matthias Jung 25 26import os |
27from m5.util.terminal import get_termcap |
|
27 28Import('main') | 28 29Import('main') |
30systemc = main.Clone() |
|
29 | 31 |
30main.Prepend(CPPPATH=Dir('./src')) 31main.Prepend(CPATH=Dir('./src')) | 32build_root = Dir('.').abspath 33src_root = Dir('.').srcdir.abspath |
32 | 34 |
33main.Prepend(CXXFLAGS=['-DSC_INCLUDE_FX', '-pthread']) 34main.Prepend(CFLAGS=['-DSC_INCLUDE_FX', '-pthread']) | 35systemc.Prepend(CPPPATH=Dir('./src')) 36systemc.Prepend(CPATH=Dir('./src')) |
35 | 37 |
36conf = Configure(main) | 38systemc.Prepend(CXXFLAGS=['-DSC_INCLUDE_FX']) 39systemc.Prepend(CFLAGS=['-DSC_INCLUDE_FX']) |
37 | 40 |
38if main['PLATFORM'] == 'darwin': 39 main.Append(LINKFLAGS=['-undefined', 'dynamic_lookup']) | 41conf = Configure(systemc, 42 conf_dir = os.path.join(build_root, '.scons_config'), 43 log_file = os.path.join(build_root, 'scons_config.log')) |
40 | 44 |
41s_file = None 42if conf.CheckDeclaration("__i386__"): 43 s_file = 'i386.s' 44if conf.CheckDeclaration("__x86_64__"): 45 s_file = 'iX86_64.s' | 45if systemc['PLATFORM'] == 'darwin': 46 systemc.Append(LINKFLAGS=['-undefined', 'dynamic_lookup']) 47 48arch = None 49systemc['COROUTINE_LIB'] = '' 50if conf.CheckDeclaration('__i386__'): 51 systemc['COROUTINE_LIB'] = 'qt' 52 systemc['QT_ARCH'] = 'i386' 53 arch = 'i386' 54elif conf.CheckDeclaration('__x86_64__'): 55 systemc['COROUTINE_LIB'] = 'qt' 56 systemc['QT_ARCH'] = 'iX86_64' 57 arch = 'x86_64' 58else: 59 termcap = get_termcap(GetOption('use_colors')) 60 print termcap.Yellow + termcap.Bold + \ 61 "Warning: Unrecognized architecture for systemc." + termcap.Normal 62 |
46conf.Finish() 47 | 63conf.Finish() 64 |
48if s_file is None: 49 print 'Unsupported CPU architecture!' 50 Exit(1) | 65if systemc['COROUTINE_LIB'] == 'pthreads': 66 systemc.Prepend(CXXFLAGS=['-DSC_USE_PTHREADS']) |
51 | 67 |
52systemc_files = Glob('src/sysc/kernel/*.cpp') 53systemc_files += ['src/sysc/qt/qt.c', 'src/sysc/qt/md/' + s_file] 54systemc_files += Glob('src/sysc/communication/*.cpp') 55systemc_files += Glob('src/sysc/tracing/*.cpp') 56systemc_files += Glob('src/sysc/utils/*.cpp') 57systemc_files += Glob('src/sysc/datatypes/bit/*.cpp') 58systemc_files += Glob('src/sysc/datatypes/fx/*.cpp') 59systemc_files += Glob('src/sysc/datatypes/int/*.cpp') 60systemc_files += Glob('src/sysc/datatypes/misc/*.cpp') | 68systemc_files = [] 69def SystemCSource(*args): 70 for arg in args: 71 systemc_files.append(systemc.File(arg)) |
61 | 72 |
62main.Library('libsystemc', systemc_files) 63main.SharedLibrary('libsystemc', systemc_files) | 73if arch: 74 for root, dirs, files in os.walk(src_root): 75 if 'SConscript.sc' in files: 76 build_dir = os.path.relpath(root, src_root) 77 systemc.SConscript(os.path.join(root, 'SConscript.sc'), 78 exports=['systemc', 'SystemCSource'], 79 variant_dir=os.path.join(build_root, build_dir)) |
64 | 80 |
81 systemc.Library('libsystemc', systemc_files) 82 systemc.SharedLibrary('libsystemc', systemc_files) 83 |
|