rtasm: add prefetch instructions
[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 default_statetrackers = 'mesa'
33
34 if common.default_platform in ('linux', 'freebsd', 'darwin'):
35 default_drivers = 'softpipe,failover,i915simple,i965simple,trace'
36 default_winsys = 'xlib'
37 elif common.default_platform in ('winddk',):
38 default_drivers = 'softpipe,i915simple,trace'
39 default_winsys = 'all'
40 else:
41 default_drivers = 'all'
42 default_winsys = 'all'
43
44 opts = Options('config.py')
45 common.AddOptions(opts)
46 opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetrackers,
47 ['mesa', 'python']))
48 opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
49 ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace']))
50 opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
51 ['xlib', 'intel', 'gdi']))
52
53 opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
54
55 env = Environment(
56 options = opts,
57 tools = ['gallium'],
58 toolpath = ['#scons'],
59 ENV = os.environ,
60 )
61
62 Help(opts.GenerateHelpText(env))
63
64 # replicate options values in local variables
65 debug = env['debug']
66 dri = env['dri']
67 llvm = env['llvm']
68 machine = env['machine']
69 platform = env['platform']
70
71 # derived options
72 x86 = machine == 'x86'
73 gcc = platform in ('linux', 'freebsd', 'darwin')
74 msvc = platform in ('windows', 'winddk')
75
76 Export([
77 'debug',
78 'x86',
79 'dri',
80 'llvm',
81 'platform',
82 'gcc',
83 'msvc',
84 ])
85
86
87 #######################################################################
88 # Environment setup
89
90 # Includes
91 env.Append(CPPPATH = [
92 '#/include',
93 '#/src/gallium/include',
94 '#/src/gallium/auxiliary',
95 '#/src/gallium/drivers',
96 ])
97
98
99 # Posix
100 if platform in ('posix', 'linux', 'freebsd', 'darwin'):
101 env.Append(CPPDEFINES = [
102 '_POSIX_SOURCE',
103 ('_POSIX_C_SOURCE', '199309L'),
104 '_SVID_SOURCE',
105 '_BSD_SOURCE',
106 '_GNU_SOURCE',
107
108 'PTHREADS',
109 'HAVE_POSIX_MEMALIGN',
110 ])
111 env.Append(CPPPATH = ['/usr/X11R6/include'])
112 env.Append(LIBPATH = ['/usr/X11R6/lib'])
113 env.Append(LIBS = [
114 'm',
115 'pthread',
116 'expat',
117 'dl',
118 ])
119
120
121 # DRI
122 if dri:
123 env.ParseConfig('pkg-config --cflags --libs libdrm')
124 env.Append(CPPDEFINES = [
125 ('USE_EXTERNAL_DXTN_LIB', '1'),
126 'IN_DRI_DRIVER',
127 'GLX_DIRECT_RENDERING',
128 'GLX_INDIRECT_RENDERING',
129 ])
130
131 # LLVM
132 if llvm:
133 # See also http://www.scons.org/wiki/UsingPkgConfig
134 env.ParseConfig('llvm-config --cflags --ldflags --libs')
135 env.Append(CPPDEFINES = ['MESA_LLVM'])
136 # Force C++ linkage
137 env['LINK'] = env['CXX']
138
139 # libGL
140 if platform in ('linux', 'freebsd', 'darwin'):
141 env.Append(LIBS = [
142 'X11',
143 'Xext',
144 'Xxf86vm',
145 'Xdamage',
146 'Xfixes',
147 ])
148
149 # for debugging
150 #print env.Dump()
151
152 Export('env')
153
154
155 #######################################################################
156 # Invoke SConscripts
157
158 # TODO: Build several variants at the same time?
159 # http://www.scons.org/wiki/SimultaneousVariantBuilds
160
161 SConscript(
162 'src/SConscript',
163 build_dir = env['build'],
164 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
165 )