1 #######################################################################
4 # For example, invoke scons as
6 # scons debug=1 dri=0 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 # Configuration options
33 default_statetrackers
= 'mesa'
34 default_targets
= 'none'
36 if common
.default_platform
in ('linux', 'freebsd', 'darwin'):
37 default_drivers
= 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe'
38 default_winsys
= 'xlib'
39 elif common
.default_platform
in ('winddk',):
40 default_drivers
= 'softpipe,svga,i915,i965,trace,identity'
41 default_winsys
= 'all'
42 elif common
.default_platform
in ('embedded',):
43 default_drivers
= 'softpipe,llvmpipe'
44 default_winsys
= 'xlib'
46 default_drivers
= 'all'
47 default_winsys
= 'all'
49 opts
= Variables('config.py')
50 common
.AddOptions(opts
)
51 opts
.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers
,
52 ['mesa', 'python', 'xorg']))
53 opts
.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers
,
54 ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
55 opts
.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys
,
56 ['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'graw-xlib']))
58 opts
.Add(ListVariable('targets', 'driver targets to build', default_targets
,
80 opts
.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values
=('7.1', '8.0', '9.0')))
85 toolpath
= ['#scons'],
89 if os
.environ
.has_key('CC'):
90 env
['CC'] = os
.environ
['CC']
91 if os
.environ
.has_key('CFLAGS'):
92 env
['CCFLAGS'] += SCons
.Util
.CLVar(os
.environ
['CFLAGS'])
93 if os
.environ
.has_key('CXX'):
94 env
['CXX'] = os
.environ
['CXX']
95 if os
.environ
.has_key('CXXFLAGS'):
96 env
['CXXFLAGS'] += SCons
.Util
.CLVar(os
.environ
['CXXFLAGS'])
97 if os
.environ
.has_key('LDFLAGS'):
98 env
['LINKFLAGS'] += SCons
.Util
.CLVar(os
.environ
['LDFLAGS'])
100 Help(opts
.GenerateHelpText(env
))
102 # replicate options values in local variables
105 machine
= env
['machine']
106 platform
= env
['platform']
109 x86
= machine
== 'x86'
110 ppc
= machine
== 'ppc'
111 gcc
= platform
in ('linux', 'freebsd', 'darwin', 'embedded')
112 msvc
= platform
in ('windows', 'winddk')
125 #######################################################################
128 # Always build trace, rbug, identity, softpipe, and llvmpipe (where possible)
129 if 'trace' not in env
['drivers']:
130 env
['drivers'].append('trace')
131 if 'rbug' not in env
['drivers']:
132 env
['drivers'].append('rbug')
133 if 'identity' not in env
['drivers']:
134 env
['drivers'].append('identity')
135 if 'softpipe' not in env
['drivers']:
136 env
['drivers'].append('softpipe')
137 if env
['llvm'] and 'llvmpipe' not in env
['drivers']:
138 env
['drivers'].append('llvmpipe')
141 env
.Prepend(CPPPATH
= [
144 env
.Append(CPPPATH
= [
145 '#/src/gallium/include',
146 '#/src/gallium/auxiliary',
147 '#/src/gallium/drivers',
148 '#/src/gallium/winsys',
152 env
.Append(CPPPATH
= ['#include/c99'])
155 if platform
== 'embedded':
156 env
.Append(CPPDEFINES
= [
158 ('_POSIX_C_SOURCE', '199309L'),
172 if platform
in ('posix', 'linux', 'freebsd', 'darwin'):
173 env
.Append(CPPDEFINES
= [
175 ('_POSIX_C_SOURCE', '199309L'),
180 'HAVE_POSIX_MEMALIGN',
183 env
.Append(CFLAGS
= ['-fvisibility=hidden'])
184 if platform
== 'darwin':
185 env
.Append(CPPDEFINES
= ['_DARWIN_C_SOURCE'])
198 #######################################################################
201 # TODO: Build several variants at the same time?
202 # http://www.scons.org/wiki/SimultaneousVariantBuilds
204 if env
['platform'] != common
.default_platform
:
205 # GLSL code has to be built twice -- one for the host OS, another for the target OS...
207 host_env
= Environment(
208 # options are ignored
209 # default tool is used
210 tools
= ['default', 'custom'],
211 toolpath
= ['#scons'],
215 host_env
['platform'] = common
.default_platform
216 host_env
['machine'] = common
.default_machine
217 host_env
['debug'] = env
['debug']
220 'src/glsl/SConscript',
221 variant_dir
= os
.path
.join(env
['build'], 'host'),
222 duplicate
= 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
223 exports
={'env':host_env
},
228 variant_dir
= env
['build'],
229 duplicate
= 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html