gallium: fix SSE codegen for instructions that use both a CONSTANT and IMMEDIATE
[mesa.git] / SConstruct
1 #######################################################################
2 # Top-level SConstruct
3 #
4 # For example, invoke scons as
5 #
6 # scons debug=1 dri=0 machine=x86
7 #
8 # to set configuration variables. Or you can write those options to a file
9 # named config.py:
10 #
11 # # config.py
12 # debug=1
13 # dri=0
14 # machine='x86'
15 #
16 # Invoke
17 #
18 # scons -h
19 #
20 # to get the full list of options. See scons manpage for more info.
21 #
22
23 import os
24 import os.path
25 import sys
26
27 import common
28
29 #######################################################################
30 # Configuration options
31
32 if common.default_platform in ('linux', 'freebsd', 'darwin'):
33 default_statetrackers = 'all'
34 default_drivers = 'softpipe,failover,i915simple,i965simple'
35 default_winsys = 'xlib'
36 elif common.default_platform in ('winddk',):
37 default_statetrackers = 'all'
38 default_drivers = 'softpipe,i915simple'
39 default_winsys = 'all'
40 else:
41 default_statetrackers = 'all'
42 default_drivers = 'all'
43 default_winsys = 'all'
44
45 opts = Options('config.py')
46 common.AddOptions(opts)
47 opts.Add(ListOption('statetrackers', 'state_trackers to build', default_statetrackers,
48 ['mesa']))
49 opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
50 ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell']))
51 opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
52 ['xlib', 'intel', 'gdi']))
53
54 env = Environment(
55 options = opts,
56 tools = ['gallium'],
57 toolpath = ['scons'],
58 ENV = os.environ,
59 )
60
61 Help(opts.GenerateHelpText(env))
62
63 # replicate options values in local variables
64 debug = env['debug']
65 dri = env['dri']
66 llvm = env['llvm']
67 machine = env['machine']
68 platform = env['platform']
69
70 # derived options
71 x86 = machine == 'x86'
72 gcc = platform in ('linux', 'freebsd', 'darwin')
73 msvc = platform in ('windows', 'winddk')
74
75 Export([
76 'debug',
77 'x86',
78 'dri',
79 'llvm',
80 'platform',
81 'gcc',
82 'msvc',
83 ])
84
85
86 #######################################################################
87 # Environment setup
88
89 # Includes
90 env.Append(CPPPATH = [
91 '#/include',
92 '#/src/gallium/include',
93 '#/src/gallium/auxiliary',
94 '#/src/gallium/drivers',
95 ])
96
97
98 # Posix
99 if platform in ('posix', 'linux', 'freebsd', 'darwin'):
100 env.Append(CPPDEFINES = [
101 '_POSIX_SOURCE',
102 ('_POSIX_C_SOURCE', '199309L'),
103 '_SVID_SOURCE',
104 '_BSD_SOURCE',
105 '_GNU_SOURCE',
106
107 'PTHREADS',
108 'HAVE_POSIX_MEMALIGN',
109 ])
110 env.Append(CPPPATH = ['/usr/X11R6/include'])
111 env.Append(LIBPATH = ['/usr/X11R6/lib'])
112 env.Append(LIBS = [
113 'm',
114 'pthread',
115 'expat',
116 'dl',
117 ])
118
119
120 # DRI
121 if dri:
122 env.ParseConfig('pkg-config --cflags --libs libdrm')
123 env.Append(CPPDEFINES = [
124 ('USE_EXTERNAL_DXTN_LIB', '1'),
125 'IN_DRI_DRIVER',
126 'GLX_DIRECT_RENDERING',
127 'GLX_INDIRECT_RENDERING',
128 ])
129
130 # LLVM
131 if llvm:
132 # See also http://www.scons.org/wiki/UsingPkgConfig
133 env.ParseConfig('llvm-config --cflags --ldflags --libs')
134 env.Append(CPPDEFINES = ['MESA_LLVM'])
135 # Force C++ linkage
136 env['LINK'] = env['CXX']
137
138 # libGL
139 if platform in ('linux', 'freebsd', 'darwin'):
140 env.Append(LIBS = [
141 'X11',
142 'Xext',
143 'Xxf86vm',
144 'Xdamage',
145 'Xfixes',
146 ])
147
148 # for debugging
149 #print env.Dump()
150
151 Export('env')
152
153
154 #######################################################################
155 # Invoke SConscripts
156
157 # TODO: Build several variants at the same time?
158 # http://www.scons.org/wiki/SimultaneousVariantBuilds
159
160 SConscript(
161 'src/SConscript',
162 build_dir = env['build'],
163 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
164 )