OSDN Git Service

ilo: add ilo_view_surface for SURFACE_STATE
[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 env.Append(CPPDEFINES = [
73     ('PACKAGE_VERSION', '\\"9.2.0-devel\\"'),
74     ('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'),
75 ])
76
77 # Includes
78 env.Prepend(CPPPATH = [
79         '#/include',
80 ])
81 env.Append(CPPPATH = [
82         '#/src/gallium/include',
83         '#/src/gallium/auxiliary',
84         '#/src/gallium/drivers',
85         '#/src/gallium/winsys',
86 ])
87
88 if env['msvc']:
89     env.Append(CPPPATH = ['#include/c99'])
90
91 # for debugging
92 #print env.Dump()
93
94
95 #######################################################################
96 # Invoke host SConscripts 
97
98 # For things that are meant to be run on the native host build machine, instead
99 # of the target machine.
100 #
101
102 # Create host environent
103 if env['crosscompile'] and not env['embedded']:
104     host_env = Environment(
105         options = opts,
106         # no tool used
107         tools = [],
108         toolpath = ['#scons'],
109         ENV = os.environ,
110     )
111
112     # Override options
113     host_env['platform'] = common.host_platform
114     host_env['machine'] = common.host_machine
115     host_env['toolchain'] = 'default'
116     host_env['llvm'] = False
117
118     host_env.Tool('gallium')
119
120     host_env['hostonly'] = True
121     assert host_env['crosscompile'] == False
122
123     if host_env['msvc']:
124         host_env.Append(CPPPATH = ['#include/c99'])
125
126     target_env = env
127     env = host_env
128     Export('env')
129
130     SConscript(
131         'src/SConscript',
132         variant_dir = host_env['build_dir'],
133         duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
134     )
135
136     env = target_env
137
138 Export('env')
139
140 #######################################################################
141 # Invoke SConscripts
142
143 # TODO: Build several variants at the same time?
144 # http://www.scons.org/wiki/SimultaneousVariantBuilds
145
146 SConscript(
147         'src/SConscript',
148         variant_dir = env['build_dir'],
149         duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
150 )
151
152
153 ########################################################################
154 # List all aliases
155
156 try:
157     from SCons.Node.Alias import default_ans
158 except ImportError:
159     pass
160 else:
161     aliases = default_ans.keys()
162     aliases.sort()
163     env.Help('\n')
164     env.Help('Recognized targets:\n')
165     for alias in aliases:
166         env.Help('    %s\n' % alias)