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'
42 default_drivers = 'all'
43 default_winsys = 'all'
45 opts = Variables('config.py')
46 common.AddOptions(opts)
47 opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
48 ['mesa', 'python', 'xorg']))
49 opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
50 ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe']))
51 opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
52 ['xlib', 'vmware', 'intel', 'i965', 'gdi', 'radeon']))
54 opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
59 toolpath = ['#scons'],
63 if os.environ.has_key('CC'):
64 env['CC'] = os.environ['CC']
65 if os.environ.has_key('CFLAGS'):
66 env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
67 if os.environ.has_key('CXX'):
68 env['CXX'] = os.environ['CXX']
69 if os.environ.has_key('CXXFLAGS'):
70 env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
71 if os.environ.has_key('LDFLAGS'):
72 env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
74 Help(opts.GenerateHelpText(env))
76 # replicate options values in local variables
80 machine = env['machine']
81 platform = env['platform']
84 x86 = machine == 'x86'
85 ppc = machine == 'ppc'
86 gcc = platform in ('linux', 'freebsd', 'darwin')
87 msvc = platform in ('windows', 'winddk')
101 #######################################################################
105 env.Append(CPPPATH = [
107 '#/src/gallium/include',
108 '#/src/gallium/auxiliary',
109 '#/src/gallium/drivers',
113 env.Append(CPPPATH = ['#include/c99'])
117 if platform in ('posix', 'linux', 'freebsd', 'darwin'):
118 env.Append(CPPDEFINES = [
120 ('_POSIX_C_SOURCE', '199309L'),
126 'HAVE_POSIX_MEMALIGN',
128 if platform == 'darwin':
129 env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
130 env.Append(CPPPATH = ['/usr/X11R6/include'])
131 env.Append(LIBPATH = ['/usr/X11R6/lib'])
142 env.ParseConfig('pkg-config --cflags --libs libdrm')
143 env.Append(CPPDEFINES = [
144 ('USE_EXTERNAL_DXTN_LIB', '1'),
146 'GLX_DIRECT_RENDERING',
147 'GLX_INDIRECT_RENDERING',
152 # See also http://www.scons.org/wiki/UsingPkgConfig
153 env.ParseConfig('llvm-config --cflags --ldflags --libs backend bitreader engine instrumentation interpreter ipo')
154 env.Append(CPPDEFINES = ['MESA_LLVM'])
156 env['LINK'] = env['CXX']
159 if platform in ('linux', 'freebsd', 'darwin'):
174 #######################################################################
177 # TODO: Build several variants at the same time?
178 # http://www.scons.org/wiki/SimultaneousVariantBuilds
180 if env['platform'] != common.default_platform:
181 # GLSL code has to be built twice -- one for the host OS, another for the target OS...
183 host_env = Environment(
184 # options are ignored
185 # default tool is used
186 tools = ['default', 'custom'],
187 toolpath = ['#scons'],
191 host_env['platform'] = common.default_platform
192 host_env['machine'] = common.default_machine
193 host_env['debug'] = env['debug']
196 'src/glsl/SConscript',
197 variant_dir = os.path.join(env['build'], 'host'),
198 duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
199 exports={'env':host_env},
204 variant_dir = env['build'],
205 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
210 variant_dir = os.path.join('progs', env['build']),
211 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html