OSDN Git Service

graw: Remove graw-null.
[android-x86/external-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 import SCons.Util
27
28 import common
29
30 #######################################################################
31 # Configuration options
32
33 default_statetrackers = 'mesa'
34 default_targets = 'none'
35
36 if common.default_platform in ('linux', 'freebsd', 'darwin'):
37         default_drivers = 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe'
38         default_winsys = 'xlib'
39 elif common.default_platform in ('winddk',):
40         default_drivers = 'softpipe,svga,i915,i965,trace,identity'
41         default_winsys = 'all'
42 elif common.default_platform in ('embedded',):
43         default_drivers = 'softpipe,llvmpipe'
44         default_winsys = 'xlib'
45 else:
46         default_drivers = 'all'
47         default_winsys = 'all'
48
49 opts = Variables('config.py')
50 common.AddOptions(opts)
51 opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
52                      ['mesa', 'python', 'xorg', 'egl']))
53 opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
54                      ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'r600', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
55 opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
56                      ['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'r600', 'graw-xlib']))
57
58 opts.Add(ListVariable('targets', 'driver targets to build', default_targets,
59                       ['dri-i915',
60                        'dri-i965',
61                        'dri-nouveau',
62                        'dri-radeong',
63                        'dri-swrast',
64                        'dri-vmwgfx',
65                        'egl-i915',
66                        'egl-i965',
67                        'egl-nouveau',
68                        'egl-radeon',
69                        'egl-swrast',
70                        'egl-vmwgfx',
71                        'graw-xlib',
72                        'libgl-gdi',
73                        'libgl-xlib',
74                        'xorg-i915',
75                        'xorg-i965',
76                        'xorg-nouveau',
77                        'xorg-radeon',
78                        'xorg-vmwgfx']))
79
80 opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
81
82 env = Environment(
83         options = opts,
84         tools = ['gallium'],
85         toolpath = ['#scons'],  
86         ENV = os.environ,
87 )
88
89 if os.environ.has_key('CC'):
90         env['CC'] = os.environ['CC']
91 if os.environ.has_key('CFLAGS'):
92         env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
93 if os.environ.has_key('CXX'):
94         env['CXX'] = os.environ['CXX']
95 if os.environ.has_key('CXXFLAGS'):
96         env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
97 if os.environ.has_key('LDFLAGS'):
98         env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
99
100 Help(opts.GenerateHelpText(env))
101
102 # replicate options values in local variables
103 debug = env['debug']
104 dri = env['dri']
105 machine = env['machine']
106 platform = env['platform']
107
108 # derived options
109 x86 = machine == 'x86'
110 ppc = machine == 'ppc'
111 gcc = platform in ('linux', 'freebsd', 'darwin', 'embedded')
112 msvc = platform in ('windows', 'winddk')
113
114 Export([
115         'debug', 
116         'x86', 
117         'ppc', 
118         'dri', 
119         'platform',
120         'gcc',
121         'msvc',
122 ])
123
124
125 #######################################################################
126 # Environment setup
127
128 # Always build trace, rbug, identity, softpipe, and llvmpipe (where possible)
129 if 'trace' not in env['drivers']:
130     env['drivers'].append('trace')
131 if 'rbug' not in env['drivers']:
132     env['drivers'].append('rbug')
133 if 'galahad' not in env['drivers']:
134     env['drivers'].append('galahad')
135 if 'identity' not in env['drivers']:
136     env['drivers'].append('identity')
137 if 'softpipe' not in env['drivers']:
138     env['drivers'].append('softpipe')
139 if env['llvm'] and 'llvmpipe' not in env['drivers']:
140     env['drivers'].append('llvmpipe')
141 if 'sw' not in env['drivers']:
142     env['drivers'].append('sw')
143
144 # Includes
145 env.Prepend(CPPPATH = [
146         '#/include',
147 ])
148 env.Append(CPPPATH = [
149         '#/src/gallium/include',
150         '#/src/gallium/auxiliary',
151         '#/src/gallium/drivers',
152         '#/src/gallium/winsys',
153 ])
154
155 if env['msvc']:
156     env.Append(CPPPATH = ['#include/c99'])
157
158 # Embedded
159 if platform == 'embedded':
160         env.Append(CPPDEFINES = [
161                 '_POSIX_SOURCE',
162                 ('_POSIX_C_SOURCE', '199309L'), 
163                 '_SVID_SOURCE',
164                 '_BSD_SOURCE', 
165                 '_GNU_SOURCE',
166                 
167                 'PTHREADS',
168         ])
169         env.Append(LIBS = [
170                 'm',
171                 'pthread',
172                 'dl',
173         ])
174
175 # Posix
176 if platform in ('posix', 'linux', 'freebsd', 'darwin'):
177         env.Append(CPPDEFINES = [
178                 '_POSIX_SOURCE',
179                 ('_POSIX_C_SOURCE', '199309L'), 
180                 '_SVID_SOURCE',
181                 '_BSD_SOURCE', 
182                 '_GNU_SOURCE',
183                 'PTHREADS',
184                 'HAVE_POSIX_MEMALIGN',
185         ])
186         if gcc:
187                 env.Append(CFLAGS = ['-fvisibility=hidden'])
188         if platform == 'darwin':
189                 env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
190         env.Append(LIBS = [
191                 'm',
192                 'pthread',
193                 'dl',
194         ])
195
196 # for debugging
197 #print env.Dump()
198
199 Export('env')
200
201
202 #######################################################################
203 # Invoke SConscripts
204
205 # TODO: Build several variants at the same time?
206 # http://www.scons.org/wiki/SimultaneousVariantBuilds
207
208 SConscript(
209         'src/SConscript',
210         variant_dir = env['build'],
211         duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
212 )
213
214 env.Default('src')
215