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.
29 #######################################################################
30 # Configuration options
32 if common
.default_platform
in ('linux', 'freebsd', 'darwin'):
33 default_statetrackers
= 'mesa'
34 default_drivers
= 'softpipe,failover,i915simple,i965simple'
35 default_winsys
= 'xlib'
36 elif common
.default_platform
in ('winddk',):
37 default_statetrackers
= 'none'
38 default_drivers
= 'softpipe,i915simple'
39 default_winsys
= 'none'
41 default_drivers
= 'all'
42 default_winsys
= 'all'
44 opts
= Options('config.py')
45 common
.AddOptions(opts
)
46 opts
.Add(ListOption('statetrackers', 'state_trackers to build', default_statetrackers
,
48 opts
.Add(ListOption('drivers', 'pipe drivers to build', default_drivers
,
49 ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell']))
50 opts
.Add(ListOption('winsys', 'winsys drivers to build', default_winsys
,
56 Help(opts
.GenerateHelpText(env
))
58 # replicate options values in local variables
62 machine
= env
['machine']
63 platform
= env
['platform']
66 x86
= machine
== 'x86'
67 gcc
= platform
in ('linux', 'freebsd', 'darwin')
68 msvc
= platform
in ('win32', 'winddk')
81 #######################################################################
84 # TODO: put the compiler specific settings in separate files
85 # TODO: auto-detect as much as possible
89 if platform
== 'winddk':
90 env
.Tool('winddk', ['.'])
92 env
.Append(CPPPATH
= [
102 env
.Append(CFLAGS
= '-O0 -g3')
103 env
.Append(CXXFLAGS
= '-O0 -g3')
105 env
.Append(CFLAGS
= '-O3 -g3')
106 env
.Append(CXXFLAGS
= '-O3 -g3')
108 env
.Append(CFLAGS
= '-Wall -Wmissing-prototypes -Wno-long-long -ffast-math -pedantic')
109 env
.Append(CXXFLAGS
= '-Wall -pedantic')
112 env
.Append(CFLAGS
= '-fmessage-length=0')
113 env
.Append(CXXFLAGS
= '-fmessage-length=0')
117 #'/Wp64', # enable 64 bit porting warnings
119 env
.Append(CFLAGS
= cflags
)
120 env
.Append(CXXFLAGS
= cflags
)
121 # Put debugging information in a separate .pdb file for each object file as
122 # descrived in the scons manpage
123 env
['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
127 env
.Append(CPPDEFINES
= ['DEBUG'])
129 env
.Append(CPPDEFINES
= ['NDEBUG'])
133 env
.Append(CPPPATH
= [
135 '#/src/gallium/include',
136 '#/src/gallium/auxiliary',
137 '#/src/gallium/drivers',
143 env
.Append(CPPDEFINES
= [
150 env
.Append(CFLAGS
= '-m32')
151 env
.Append(CXXFLAGS
= '-m32')
155 if platform
in ('posix', 'linux', 'freebsd', 'darwin'):
156 env
.Append(CPPDEFINES
= [
158 ('_POSIX_C_SOURCE', '199309L'),
164 'HAVE_POSIX_MEMALIGN',
166 env
.Append(CPPPATH
= ['/usr/X11R6/include'])
167 env
.Append(LIBPATH
= ['/usr/X11R6/lib'])
178 env
.ParseConfig('pkg-config --cflags --libs libdrm')
179 env
.Append(CPPDEFINES
= [
180 ('USE_EXTERNAL_DXTN_LIB', '1'),
182 'GLX_DIRECT_RENDERING',
183 'GLX_INDIRECT_RENDERING',
188 # See also http://www.scons.org/wiki/UsingPkgConfig
189 env
.ParseConfig('llvm-config --cflags --ldflags --libs')
190 env
.Append(CPPDEFINES
= ['MESA_LLVM'])
191 env
.Append(CXXFLAGS
= ['-Wno-long-long'])
193 env
['LINK'] = env
['CXX']
196 if platform
not in ('winddk',):
211 #######################################################################
214 # TODO: Build several variants at the same time?
215 # http://www.scons.org/wiki/SimultaneousVariantBuilds
219 build_dir
= common
.make_build_dir(env
),
220 duplicate
= 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html