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
))
61 # replicate options values in local variables
65 machine
= env
['machine']
66 platform
= env
['platform']
69 x86
= machine
== 'x86'
70 gcc
= platform
in ('linux', 'freebsd', 'darwin')
71 msvc
= platform
in ('win32', 'winddk')
84 #######################################################################
87 # TODO: put the compiler specific settings in separate files
88 # TODO: auto-detect as much as possible
91 if platform
== 'winddk':
92 env
.Tool('winddk', ['.'])
94 env
.Append(CPPPATH
= [
104 env
.Append(CFLAGS
= '-O0 -g3')
105 env
.Append(CXXFLAGS
= '-O0 -g3')
107 env
.Append(CFLAGS
= '-O3 -g3')
108 env
.Append(CXXFLAGS
= '-O3 -g3')
110 env
.Append(CFLAGS
= '-Wall -Wmissing-prototypes -Wno-long-long -ffast-math -pedantic')
111 env
.Append(CXXFLAGS
= '-Wall -pedantic')
114 env
.Append(CFLAGS
= '-fmessage-length=0')
115 env
.Append(CXXFLAGS
= '-fmessage-length=0')
118 env
.Append(CFLAGS
= '/W3')
121 '/Od', # disable optimizations
122 '/Oy-', # disable frame pointer omission
126 '/Ox', # maximum optimizations
127 '/Os', # favor code space
129 env
.Append(CFLAGS
= cflags
)
130 env
.Append(CXXFLAGS
= cflags
)
131 # Put debugging information in a separate .pdb file for each object file as
132 # descrived in the scons manpage
133 env
['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
138 env
.Append(CPPDEFINES
= ['DEBUG'])
140 env
.Append(CPPDEFINES
= [
146 env
.Append(CPPDEFINES
= ['NDEBUG'])
150 env
.Append(CPPPATH
= [
152 '#/src/gallium/include',
153 '#/src/gallium/auxiliary',
154 '#/src/gallium/drivers',
160 env
.Append(CPPDEFINES
= [
167 env
.Append(CFLAGS
= '-m32')
168 env
.Append(CXXFLAGS
= '-m32')
172 if platform
in ('posix', 'linux', 'freebsd', 'darwin'):
173 env
.Append(CPPDEFINES
= [
175 ('_POSIX_C_SOURCE', '199309L'),
181 'HAVE_POSIX_MEMALIGN',
183 env
.Append(CPPPATH
= ['/usr/X11R6/include'])
184 env
.Append(LIBPATH
= ['/usr/X11R6/lib'])
195 env
.ParseConfig('pkg-config --cflags --libs libdrm')
196 env
.Append(CPPDEFINES
= [
197 ('USE_EXTERNAL_DXTN_LIB', '1'),
199 'GLX_DIRECT_RENDERING',
200 'GLX_INDIRECT_RENDERING',
205 # See also http://www.scons.org/wiki/UsingPkgConfig
206 env
.ParseConfig('llvm-config --cflags --ldflags --libs')
207 env
.Append(CPPDEFINES
= ['MESA_LLVM'])
208 env
.Append(CXXFLAGS
= ['-Wno-long-long'])
210 env
['LINK'] = env
['CXX']
213 if platform
not in ('winddk',):
222 # Convenience library support
223 common
.createConvenienceLibBuilder(env
)
228 #######################################################################
231 # TODO: Build several variants at the same time?
232 # http://www.scons.org/wiki/SimultaneousVariantBuilds
236 build_dir
= common
.make_build_dir(env
),
237 duplicate
= 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html