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'
35 if common.default_platform in ('linux', 'freebsd', 'darwin'):
36 default_drivers = 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe'
37 default_winsys = 'xlib'
38 elif common.default_platform in ('winddk',):
39 default_drivers = 'softpipe,svga,i915,i965,trace,identity'
40 default_winsys = 'all'
41 elif common.default_platform in ('embedded',):
42 default_drivers = 'softpipe,llvmpipe'
43 default_winsys = 'xlib'
45 default_drivers = 'all'
46 default_winsys = 'all'
48 opts = Variables('config.py')
49 common.AddOptions(opts)
50 opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
51 ['mesa', 'python', 'xorg']))
52 opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
53 ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe']))
54 opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
55 ['xlib', 'vmware', 'intel', 'i965', 'gdi', 'radeon']))
57 opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
62 toolpath = ['#scons'],
66 if os.environ.has_key('CC'):
67 env['CC'] = os.environ['CC']
68 if os.environ.has_key('CFLAGS'):
69 env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
70 if os.environ.has_key('CXX'):
71 env['CXX'] = os.environ['CXX']
72 if os.environ.has_key('CXXFLAGS'):
73 env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
74 if os.environ.has_key('LDFLAGS'):
75 env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
77 Help(opts.GenerateHelpText(env))
79 # replicate options values in local variables
82 machine = env['machine']
83 platform = env['platform']
84 drawllvm = 'llvmpipe' in env['drivers']
86 # LLVM support in the Draw module
89 if not env.has_key('LLVM_VERSION'):
93 x86 = machine == 'x86'
94 ppc = machine == 'ppc'
95 gcc = platform in ('linux', 'freebsd', 'darwin', 'embedded')
96 msvc = platform in ('windows', 'winddk')
110 #######################################################################
113 # Always build trace and identity drivers
114 if 'trace' not in env['drivers']:
115 env['drivers'].append('trace')
116 if 'identity' not in env['drivers']:
117 env['drivers'].append('identity')
120 env.Append(CPPPATH = [
122 '#/src/gallium/include',
123 '#/src/gallium/auxiliary',
124 '#/src/gallium/drivers',
125 '#/src/gallium/winsys',
129 env.Append(CPPPATH = ['#include/c99'])
132 if platform == 'embedded':
133 env.Append(CPPDEFINES = [
135 ('_POSIX_C_SOURCE', '199309L'),
149 if platform in ('posix', 'linux', 'freebsd', 'darwin'):
150 env.Append(CPPDEFINES = [
152 ('_POSIX_C_SOURCE', '199309L'),
158 'HAVE_POSIX_MEMALIGN',
160 if platform == 'darwin':
161 env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
162 env.Append(CPPPATH = ['/usr/X11R6/include'])
163 env.Append(LIBPATH = ['/usr/X11R6/lib'])
173 env.ParseConfig('pkg-config --cflags --libs libdrm')
174 env.Append(CPPDEFINES = [
175 ('USE_EXTERNAL_DXTN_LIB', '1'),
177 'GLX_DIRECT_RENDERING',
178 'GLX_INDIRECT_RENDERING',
181 # LLVM support in the Draw module
183 env.Append(CPPDEFINES = ['DRAW_LLVM'])
186 if platform in ('linux', 'freebsd', 'darwin'):
201 #######################################################################
204 # TODO: Build several variants at the same time?
205 # http://www.scons.org/wiki/SimultaneousVariantBuilds
207 if env['platform'] != common.default_platform:
208 # GLSL code has to be built twice -- one for the host OS, another for the target OS...
210 host_env = Environment(
211 # options are ignored
212 # default tool is used
213 tools = ['default', 'custom'],
214 toolpath = ['#scons'],
218 host_env['platform'] = common.default_platform
219 host_env['machine'] = common.default_machine
220 host_env['debug'] = env['debug']
223 'src/glsl/SConscript',
224 variant_dir = os.path.join(env['build'], 'host'),
225 duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
226 exports={'env':host_env},
231 variant_dir = env['build'],
232 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
239 variant_dir = os.path.join('progs', env['build']),
240 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html