SConscript revision 12046
112027Sjungma@eit.uni-kl.de# Copyright (c) 2017, TU Dresden 212027Sjungma@eit.uni-kl.de# Copyright (c) 2017, University of Kaiserslautern 312027Sjungma@eit.uni-kl.de# All rights reserved. 412027Sjungma@eit.uni-kl.de 512027Sjungma@eit.uni-kl.de# Permission is hereby granted, free of charge, to any person obtaining a copy 612027Sjungma@eit.uni-kl.de# of this software and associated documentation files (the "Software"), to deal 712027Sjungma@eit.uni-kl.de# in the Software without restriction, including without limitation the rights 812027Sjungma@eit.uni-kl.de# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 912027Sjungma@eit.uni-kl.de# copies of the Software, and to permit persons to whom the Software is 1012027Sjungma@eit.uni-kl.de# furnished to do so, subject to the following conditions: 1112027Sjungma@eit.uni-kl.de# 1212027Sjungma@eit.uni-kl.de# The above copyright notice and this permission notice shall be included in 1312027Sjungma@eit.uni-kl.de# all copies or substantial portions of the Software. 1412027Sjungma@eit.uni-kl.de# 1512027Sjungma@eit.uni-kl.de# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1612027Sjungma@eit.uni-kl.de# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1712027Sjungma@eit.uni-kl.de# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1812027Sjungma@eit.uni-kl.de# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1912027Sjungma@eit.uni-kl.de# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2012027Sjungma@eit.uni-kl.de# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 2112027Sjungma@eit.uni-kl.de# SOFTWARE. 2212027Sjungma@eit.uni-kl.de# 2312027Sjungma@eit.uni-kl.de# Authors: Christian Menard 2412027Sjungma@eit.uni-kl.de# Matthias Jung 2512027Sjungma@eit.uni-kl.de 2612027Sjungma@eit.uni-kl.deimport os 2712046Sgabeblack@google.comfrom m5.util.terminal import get_termcap 2812027Sjungma@eit.uni-kl.de 2912027Sjungma@eit.uni-kl.deImport('main') 3012046Sgabeblack@google.comsystemc = main.Clone() 3112027Sjungma@eit.uni-kl.de 3212046Sgabeblack@google.combuild_root = Dir('.').abspath 3312046Sgabeblack@google.comsrc_root = Dir('.').srcdir.abspath 3412027Sjungma@eit.uni-kl.de 3512046Sgabeblack@google.comsystemc.Prepend(CPPPATH=Dir('./src')) 3612046Sgabeblack@google.comsystemc.Prepend(CPATH=Dir('./src')) 3712027Sjungma@eit.uni-kl.de 3812046Sgabeblack@google.comsystemc.Prepend(CXXFLAGS=['-DSC_INCLUDE_FX']) 3912046Sgabeblack@google.comsystemc.Prepend(CFLAGS=['-DSC_INCLUDE_FX']) 4012027Sjungma@eit.uni-kl.de 4112046Sgabeblack@google.comconf = Configure(systemc, 4212046Sgabeblack@google.com conf_dir = os.path.join(build_root, '.scons_config'), 4312046Sgabeblack@google.com log_file = os.path.join(build_root, 'scons_config.log')) 4412027Sjungma@eit.uni-kl.de 4512046Sgabeblack@google.comif systemc['PLATFORM'] == 'darwin': 4612046Sgabeblack@google.com systemc.Append(LINKFLAGS=['-undefined', 'dynamic_lookup']) 4712046Sgabeblack@google.com 4812046Sgabeblack@google.comarch = None 4912046Sgabeblack@google.comsystemc['COROUTINE_LIB'] = '' 5012046Sgabeblack@google.comif conf.CheckDeclaration('__i386__'): 5112046Sgabeblack@google.com systemc['COROUTINE_LIB'] = 'qt' 5212046Sgabeblack@google.com systemc['QT_ARCH'] = 'i386' 5312046Sgabeblack@google.com arch = 'i386' 5412046Sgabeblack@google.comelif conf.CheckDeclaration('__x86_64__'): 5512046Sgabeblack@google.com systemc['COROUTINE_LIB'] = 'qt' 5612046Sgabeblack@google.com systemc['QT_ARCH'] = 'iX86_64' 5712046Sgabeblack@google.com arch = 'x86_64' 5812046Sgabeblack@google.comelse: 5912046Sgabeblack@google.com termcap = get_termcap(GetOption('use_colors')) 6012046Sgabeblack@google.com print termcap.Yellow + termcap.Bold + \ 6112046Sgabeblack@google.com "Warning: Unrecognized architecture for systemc." + termcap.Normal 6212046Sgabeblack@google.com 6312027Sjungma@eit.uni-kl.deconf.Finish() 6412027Sjungma@eit.uni-kl.de 6512046Sgabeblack@google.comif systemc['COROUTINE_LIB'] == 'pthreads': 6612046Sgabeblack@google.com systemc.Prepend(CXXFLAGS=['-DSC_USE_PTHREADS']) 6712027Sjungma@eit.uni-kl.de 6812046Sgabeblack@google.comsystemc_files = [] 6912046Sgabeblack@google.comdef SystemCSource(*args): 7012046Sgabeblack@google.com for arg in args: 7112046Sgabeblack@google.com systemc_files.append(systemc.File(arg)) 7212027Sjungma@eit.uni-kl.de 7312046Sgabeblack@google.comif arch: 7412046Sgabeblack@google.com for root, dirs, files in os.walk(src_root): 7512046Sgabeblack@google.com if 'SConscript.sc' in files: 7612046Sgabeblack@google.com build_dir = os.path.relpath(root, src_root) 7712046Sgabeblack@google.com systemc.SConscript(os.path.join(root, 'SConscript.sc'), 7812046Sgabeblack@google.com exports=['systemc', 'SystemCSource'], 7912046Sgabeblack@google.com variant_dir=os.path.join(build_root, build_dir)) 8012027Sjungma@eit.uni-kl.de 8112046Sgabeblack@google.com systemc.Library('libsystemc', systemc_files) 8212046Sgabeblack@google.com systemc.SharedLibrary('libsystemc', systemc_files) 8312046Sgabeblack@google.com 84