1 #######################################################################
4 # For example, invoke scons as
6 # scons build=debug llvm=yes machine=x86
8 # to set configuration variables. Or you can write those options to a file
20 # to get the full list of options. See scons manpage for more info.
30 #######################################################################
31 # Minimal scons version
33 EnsureSConsVersion(2, 4)
36 #######################################################################
37 # Configuration options
39 opts
= Variables('config.py')
40 common
.AddOptions(opts
)
45 toolpath
= ['#scons'],
49 # XXX: This creates a many problems as it saves...
50 #opts.Save('config.py', env)
52 # Backwards compatability with old target configuration variable
54 targets
= ARGUMENTS
['targets']
58 targets
= targets
.split(',')
59 print('scons: warning: targets option is deprecated; pass the targets on their own such as')
61 print(' scons %s' % ' '.join(targets
))
63 COMMAND_LINE_TARGETS
.append(targets
)
66 Help(opts
.GenerateHelpText(env
))
68 #######################################################################
71 with
open("VERSION") as f
:
72 mesa_version
= f
.read().strip()
73 env
.Append(CPPDEFINES
= [
74 ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version
),
75 ('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'),
79 env
.Prepend(CPPPATH
= [
82 env
.Append(CPPPATH
= [
83 '#/src/gallium/include',
84 '#/src/gallium/auxiliary',
85 '#/src/gallium/drivers',
86 '#/src/gallium/winsys',
93 # Add a check target for running tests
94 check
= env
.Alias('check')
95 env
.AlwaysBuild(check
)
98 #######################################################################
99 # Invoke host SConscripts
101 # For things that are meant to be run on the native host build machine, instead
102 # of the target machine.
105 # Create host environent
106 if env
['crosscompile'] and not env
['embedded']:
107 host_env
= Environment(
111 toolpath
= ['#scons'],
116 host_env
['platform'] = common
.host_platform
117 host_env
['machine'] = common
.host_machine
118 host_env
['toolchain'] = 'default'
119 host_env
['llvm'] = False
121 host_env
.Tool('gallium')
123 host_env
['hostonly'] = True
124 assert host_env
['crosscompile'] == False
132 variant_dir
= host_env
['build_dir'],
133 duplicate
= 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
140 #######################################################################
143 # TODO: Build several variants at the same time?
144 # http://www.scons.org/wiki/SimultaneousVariantBuilds
148 variant_dir
= env
['build_dir'],
149 duplicate
= 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
153 ########################################################################
157 from SCons
.Node
.Alias
import default_ans
161 aliases
= sorted(default_ans
.keys())
163 env
.Help('Recognized targets:\n')
164 for alias
in aliases
:
165 env
.Help(' %s\n' % alias
)