OSDN Git Service

i965/vec4: Add constructor of src_reg from a fixed hardware reg.
[android-x86/external-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 # XXX: This creates a many problems as it saves...
44 #opts.Save('config.py', env)
45
46 # Backwards compatability with old target configuration variable
47 try:
48     targets = ARGUMENTS['targets']
49 except KeyError:
50     pass
51 else:
52     targets = targets.split(',')
53     print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
54     print
55     print '  scons %s' % ' '.join(targets)
56     print 
57     COMMAND_LINE_TARGETS.append(targets)
58
59
60 Help(opts.GenerateHelpText(env))
61
62 # fail early for a common error on windows
63 if env['gles']:
64     try:
65         import libxml2
66     except ImportError:
67         raise SCons.Errors.UserError, "GLES requires libxml2-python to build"
68
69 #######################################################################
70 # Environment setup
71
72 with open("VERSION") as f:
73   mesa_version = f.read().strip()
74 env.Append(CPPDEFINES = [
75     ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version),
76     ('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'),
77 ])
78
79 # Includes
80 env.Prepend(CPPPATH = [
81         '#/include',
82 ])
83 env.Append(CPPPATH = [
84         '#/src/gallium/include',
85         '#/src/gallium/auxiliary',
86         '#/src/gallium/drivers',
87         '#/src/gallium/winsys',
88 ])
89
90 if env['msvc']:
91     env.Append(CPPPATH = ['#include/c99'])
92
93 # for debugging
94 #print env.Dump()
95
96
97 #######################################################################
98 # Invoke host SConscripts 
99
100 # For things that are meant to be run on the native host build machine, instead
101 # of the target machine.
102 #
103
104 # Create host environent
105 if env['crosscompile'] and not env['embedded']:
106     host_env = Environment(
107         options = opts,
108         # no tool used
109         tools = [],
110         toolpath = ['#scons'],
111         ENV = os.environ,
112     )
113
114     # Override options
115     host_env['platform'] = common.host_platform
116     host_env['machine'] = common.host_machine
117     host_env['toolchain'] = 'default'
118     host_env['llvm'] = False
119
120     host_env.Tool('gallium')
121
122     host_env['hostonly'] = True
123     assert host_env['crosscompile'] == False
124
125     if host_env['msvc']:
126         host_env.Append(CPPPATH = ['#include/c99'])
127
128     target_env = env
129     env = host_env
130     Export('env')
131
132     SConscript(
133         'src/SConscript',
134         variant_dir = host_env['build_dir'],
135         duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
136     )
137
138     env = target_env
139
140 Export('env')
141
142 #######################################################################
143 # Invoke SConscripts
144
145 # TODO: Build several variants at the same time?
146 # http://www.scons.org/wiki/SimultaneousVariantBuilds
147
148 SConscript(
149         'src/SConscript',
150         variant_dir = env['build_dir'],
151         duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
152 )
153
154
155 ########################################################################
156 # List all aliases
157
158 try:
159     from SCons.Node.Alias import default_ans
160 except ImportError:
161     pass
162 else:
163     aliases = default_ans.keys()
164     aliases.sort()
165     env.Help('\n')
166     env.Help('Recognized targets:\n')
167     for alias in aliases:
168         env.Help('    %s\n' % alias)