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'
37 elif common.default_platform in ('winddk',):
38 default_statetrackers = 'none'
39 default_drivers = 'softpipe,i915simple'
40 default_winsys = 'none'
43 default_drivers = 'all'
44 default_winsys = 'all'
47 opts = common.Options()
48 opts.Add(ListOption('statetrackers', 'state_trackers to build', default_statetrackers,
50 opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
51 ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell']))
52 opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
58 Help(opts.GenerateHelpText(env))
63 # replicate options values in local variables
67 machine = env['machine']
68 platform = env['platform']
71 x86 = machine == 'x86'
72 gcc = platform in ('linux', 'freebsd', 'darwin')
73 msvc = platform in ('win32', 'winddk')
86 #######################################################################
89 # TODO: put the compiler specific settings in separate files
90 # TODO: auto-detect as much as possible
93 if platform == 'winddk':
94 env.Tool('winddk', ['.'])
96 env.Append(CPPPATH = [
106 env.Append(CFLAGS = '-O0 -g3')
107 env.Append(CXXFLAGS = '-O0 -g3')
109 env.Append(CFLAGS = '-O3 -g3')
110 env.Append(CXXFLAGS = '-O3 -g3')
112 env.Append(CFLAGS = '-Wall -Wmissing-prototypes -Wno-long-long -ffast-math -pedantic')
113 env.Append(CXXFLAGS = '-Wall -pedantic')
116 env.Append(CFLAGS = '-fmessage-length=0')
117 env.Append(CXXFLAGS = '-fmessage-length=0')
120 env.Append(CFLAGS = '/W3')
123 '/Od', # disable optimizations
124 '/Oy-', # disable frame pointer omission
128 '/Ox', # maximum optimizations
129 '/Os', # favor code space
131 env.Append(CFLAGS = cflags)
132 env.Append(CXXFLAGS = cflags)
133 # Put debugging information in a separate .pdb file for each object file as
134 # descrived in the scons manpage
135 env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
140 env.Append(CPPDEFINES = ['DEBUG'])
142 env.Append(CPPDEFINES = [
148 env.Append(CPPDEFINES = ['NDEBUG'])
152 env.Append(CPPPATH = [
154 '#/src/gallium/include',
155 '#/src/gallium/auxiliary',
156 '#/src/gallium/drivers',
162 env.Append(CPPDEFINES = [
169 env.Append(CFLAGS = '-m32')
170 env.Append(CXXFLAGS = '-m32')
174 if platform in ('posix', 'linux', 'freebsd', 'darwin'):
175 env.Append(CPPDEFINES = [
177 ('_POSIX_C_SOURCE', '199309L'),
183 'HAVE_POSIX_MEMALIGN',
185 env.Append(CPPPATH = ['/usr/X11R6/include'])
186 env.Append(LIBPATH = ['/usr/X11R6/lib'])
197 env.ParseConfig('pkg-config --cflags --libs libdrm')
198 env.Append(CPPDEFINES = [
199 ('USE_EXTERNAL_DXTN_LIB', '1'),
201 'GLX_DIRECT_RENDERING',
202 'GLX_INDIRECT_RENDERING',
207 # See also http://www.scons.org/wiki/UsingPkgConfig
208 env.ParseConfig('llvm-config --cflags --ldflags --libs')
209 env.Append(CPPDEFINES = ['MESA_LLVM'])
210 env.Append(CXXFLAGS = ['-Wno-long-long'])
214 if platform not in ('winddk',):
223 # Convenience library support
224 common.createConvenienceLibBuilder(env)
229 #######################################################################
232 # TODO: Build several variants at the same time?
233 # http://www.scons.org/wiki/SimultaneousVariantBuilds
237 build_dir = common.make_build_dir(env),
238 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html