i965: fix mask used to write to clip distance registers when gen>6
[mesa.git] / SConstruct
1 #######################################################################
2 # Top-level SConstruct
3 #
4 # For example, invoke scons as
5 #
6 # scons build=debug llvm=yes 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 # build='debug'
13 # llvm=True
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 import SCons.Util
27
28 import common
29
30 #######################################################################
31 # Configuration options
32
33 opts = Variables('config.py')
34 common.AddOptions(opts)
35
36 env = Environment(
37 options = opts,
38 tools = ['gallium'],
39 toolpath = ['#scons'],
40 ENV = os.environ,
41 )
42
43 opts.Save('config.py', env)
44
45 # Backwards compatability with old target configuration variable
46 try:
47 targets = ARGUMENTS['targets']
48 except KeyError:
49 pass
50 else:
51 targets = targets.split(',')
52 print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
53 print
54 print ' scons %s' % ' '.join(targets)
55 print
56 COMMAND_LINE_TARGETS.append(targets)
57
58
59 Help(opts.GenerateHelpText(env))
60
61 # fail early for a common error on windows
62 if env['gles']:
63 try:
64 import libxml2
65 except ImportError:
66 raise SCons.Errors.UserError, "GLES requires libxml2-python to build"
67
68 #######################################################################
69 # Environment setup
70
71 # Includes
72 env.Prepend(CPPPATH = [
73 '#/include',
74 ])
75 env.Append(CPPPATH = [
76 '#/src/gallium/include',
77 '#/src/gallium/auxiliary',
78 '#/src/gallium/drivers',
79 '#/src/gallium/winsys',
80 ])
81
82 if env['msvc']:
83 env.Append(CPPPATH = ['#include/c99'])
84
85 # for debugging
86 #print env.Dump()
87
88
89 #######################################################################
90 # Invoke host SConscripts
91 #
92 # For things that are meant to be run on the native host build machine, instead
93 # of the target machine.
94 #
95
96 # Create host environent
97 if env['crosscompile'] and not env['embedded']:
98 host_env = Environment(
99 options = opts,
100 # no tool used
101 tools = [],
102 toolpath = ['#scons'],
103 ENV = os.environ,
104 )
105
106 # Override options
107 host_env['platform'] = common.host_platform
108 host_env['machine'] = common.host_machine
109 host_env['toolchain'] = 'default'
110 host_env['llvm'] = False
111
112 host_env.Tool('gallium')
113
114 host_env['hostonly'] = True
115 assert host_env['crosscompile'] == False
116
117 if host_env['msvc']:
118 host_env.Append(CPPPATH = ['#include/c99'])
119
120 target_env = env
121 env = host_env
122 Export('env')
123
124 SConscript(
125 'src/SConscript',
126 variant_dir = host_env['build_dir'],
127 duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
128 )
129
130 env = target_env
131
132 Export('env')
133
134 #######################################################################
135 # Invoke SConscripts
136
137 # TODO: Build several variants at the same time?
138 # http://www.scons.org/wiki/SimultaneousVariantBuilds
139
140 SConscript(
141 'src/SConscript',
142 variant_dir = env['build_dir'],
143 duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
144 )
145
146
147 ########################################################################
148 # List all aliases
149
150 try:
151 from SCons.Node.Alias import default_ans
152 except ImportError:
153 pass
154 else:
155 aliases = default_ans.keys()
156 aliases.sort()
157 env.Help('\n')
158 env.Help('Recognized targets:\n')
159 for alias in aliases:
160 env.Help(' %s\n' % alias)