SConstruct revision 13391:f298f7d04903
1#!python
2
3# Copyright (c) 2016, Dresden University of Technology (TU Dresden)
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met:
9#
10# 1. Redistributions of source code must retain the above copyright notice,
11#    this list of conditions and the following disclaimer.
12#
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16#
17# 3. Neither the name of the copyright holder nor the names of its
18#    contributors may be used to endorse or promote products derived from
19#    this software without specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
25# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33# Authors: Christian Menard
34
35import os
36import sys
37
38
39gem5_arch = 'ARM'
40gem5_variant = 'opt'
41#gem5_variant = 'debug'
42
43gem5_root = Dir('#../..').srcnode().abspath
44
45env = Environment()
46
47#Make the gem5 root available in SConscripts
48env['GEM5_ROOT'] = gem5_root
49
50shlibsuffix = env['SHLIBSUFFIX']
51
52# add include dirs
53env.Append(CPPPATH=[gem5_root + '/build/' + gem5_arch,
54                    gem5_root + '/util/systemc/gem5_within_systemc',
55                    gem5_root + '/ext/systemc/src',
56                    '#src',
57                    '#examples/common',
58                    ])
59
60env.Append(CXXFLAGS=['-std=c++11',
61                     '-DSC_INCLUDE_DYNAMIC_PROCESSES',
62                     '-DTRACING_ON',
63                     ])
64
65if gem5_variant == 'debug':
66    env.Append(CXXFLAGS=['-g', '-DDEBUG'])
67
68deps = [] # keep track of all dependencies required for building the binaries
69
70deps += SConscript('src/SConscript', variant_dir='build/tlm', exports='env')
71
72deps += SConscript('examples/common/SConscript',
73                   variant_dir='build/examples/common',
74                   exports=['env'])
75
76# the SystemC SConscript makes certain assumptions, we need to fulfill these
77# assumptions before calling the SConscript.
78main = env
79sys.path.append(gem5_root + '/src/python')
80AddOption('--no-colors', dest='use_colors', action='store_false',
81          help="Don't add color to abbreviated scons output")
82
83SConscript(gem5_root + '/ext/systemc/SConscript',
84           variant_dir='build/systemc',
85           exports='main')
86
87# By adding libraries as dependencies instead of using LIBS, we avoid that
88# the user needs to set the LD_LIBRARY_PATH
89deps.append(File('build/systemc/libsystemc' + shlibsuffix))
90deps.append(File(os.path.join(gem5_root, 'build', gem5_arch,
91             'libgem5_' + gem5_variant + shlibsuffix)))
92
93ex_master = SConscript('examples/master_port/SConscript',
94                       variant_dir='build/examples/master_port',
95                       exports=['env', 'deps'])
96
97ex_slave = SConscript('examples/slave_port/SConscript',
98                      variant_dir='build/examples/slave_port',
99                      exports=['env', 'deps'])
100
101Default(ex_master + ex_slave)
102