mesa: reduce calls to _mesa_test_framebuffer_completeness()
[mesa.git] / src / mesa / SConscript
1 #######################################################################
2 # SConscript for Mesa
3
4
5 Import('*')
6
7 env = env.Clone()
8
9 env.Append(CPPPATH = [
10 '#/src/mapi',
11 '#/src/glsl',
12 '#/src/mesa',
13 ])
14
15 env.Append(CPPDEFINES = [
16 'FEATURE_GL=1',
17 ])
18
19 if env['platform'] == 'windows':
20 env.Append(CPPDEFINES = [
21 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
22 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
23 ])
24 if not env['gles']:
25 # prevent _glapi_* from being declared __declspec(dllimport)
26 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
27 else:
28 env.Append(CPPDEFINES = [
29 'IN_DRI_DRIVER', # enable the remap table (for DRI drivers)
30 ])
31
32 #
33 # Source files
34 #
35
36 main_sources = [
37 'main/api_arrayelt.c',
38 'main/api_exec.c',
39 'main/api_loopback.c',
40 'main/api_noop.c',
41 'main/api_validate.c',
42 'main/accum.c',
43 'main/arbprogram.c',
44 'main/atifragshader.c',
45 'main/attrib.c',
46 'main/arrayobj.c',
47 'main/blend.c',
48 'main/bufferobj.c',
49 'main/buffers.c',
50 'main/clear.c',
51 'main/clip.c',
52 'main/colortab.c',
53 'main/condrender.c',
54 'main/context.c',
55 'main/convolve.c',
56 'main/cpuinfo.c',
57 'main/debug.c',
58 'main/depth.c',
59 'main/depthstencil.c',
60 'main/dlist.c',
61 'main/dlopen.c',
62 'main/drawpix.c',
63 'main/drawtex.c',
64 'main/enable.c',
65 'main/enums.c',
66 'main/eval.c',
67 'main/execmem.c',
68 'main/extensions.c',
69 'main/fbobject.c',
70 'main/feedback.c',
71 'main/ffvertex_prog.c',
72 'main/fog.c',
73 'main/formats.c',
74 'main/framebuffer.c',
75 'main/get.c',
76 'main/getstring.c',
77 'main/hash.c',
78 'main/hint.c',
79 'main/histogram.c',
80 'main/image.c',
81 'main/imports.c',
82 'main/light.c',
83 'main/lines.c',
84 'main/matrix.c',
85 'main/mipmap.c',
86 'main/mm.c',
87 'main/multisample.c',
88 'main/nvprogram.c',
89 'main/pack.c',
90 'main/pixel.c',
91 'main/pixelstore.c',
92 'main/pixeltransfer.c',
93 'main/points.c',
94 'main/polygon.c',
95 'main/querymatrix.c',
96 'main/queryobj.c',
97 'main/rastpos.c',
98 'main/readpix.c',
99 'main/remap.c',
100 'main/renderbuffer.c',
101 'main/scissor.c',
102 'main/shaderapi.c',
103 'main/shaderobj.c',
104 'main/shared.c',
105 'main/state.c',
106 'main/stencil.c',
107 'main/syncobj.c',
108 'main/texcompress.c',
109 'main/texcompress_rgtc.c',
110 'main/texcompress_s3tc.c',
111 'main/texcompress_fxt1.c',
112 'main/texenv.c',
113 'main/texenvprogram.c',
114 'main/texfetch.c',
115 'main/texformat.c',
116 'main/texgen.c',
117 'main/texgetimage.c',
118 'main/teximage.c',
119 'main/texobj.c',
120 'main/texpal.c',
121 'main/texparam.c',
122 'main/texrender.c',
123 'main/texstate.c',
124 'main/texstore.c',
125 'main/transformfeedback.c',
126 'main/uniforms.c',
127 'main/varray.c',
128 'main/version.c',
129 'main/viewport.c',
130 'main/vtxfmt.c',
131 ]
132
133 math_sources = [
134 'math/m_debug_clip.c',
135 'math/m_debug_norm.c',
136 'math/m_debug_xform.c',
137 'math/m_eval.c',
138 'math/m_matrix.c',
139 'math/m_translate.c',
140 'math/m_vector.c',
141 'math/m_xform.c',
142 ]
143
144 vbo_sources = [
145 'vbo/vbo_context.c',
146 'vbo/vbo_exec.c',
147 'vbo/vbo_exec_api.c',
148 'vbo/vbo_exec_array.c',
149 'vbo/vbo_exec_draw.c',
150 'vbo/vbo_exec_eval.c',
151 'vbo/vbo_rebase.c',
152 'vbo/vbo_split.c',
153 'vbo/vbo_split_copy.c',
154 'vbo/vbo_split_inplace.c',
155 'vbo/vbo_save.c',
156 'vbo/vbo_save_api.c',
157 'vbo/vbo_save_draw.c',
158 'vbo/vbo_save_loopback.c',
159 ]
160
161 vf_sources = [
162 'vf/vf.c',
163 'vf/vf_generic.c',
164 'vf/vf_sse.c',
165 ]
166
167 statetracker_sources = [
168 'state_tracker/st_atom.c',
169 'state_tracker/st_atom_blend.c',
170 'state_tracker/st_atom_clip.c',
171 'state_tracker/st_atom_constbuf.c',
172 'state_tracker/st_atom_depth.c',
173 'state_tracker/st_atom_framebuffer.c',
174 'state_tracker/st_atom_msaa.c',
175 'state_tracker/st_atom_pixeltransfer.c',
176 'state_tracker/st_atom_sampler.c',
177 'state_tracker/st_atom_scissor.c',
178 'state_tracker/st_atom_shader.c',
179 'state_tracker/st_atom_rasterizer.c',
180 'state_tracker/st_atom_stipple.c',
181 'state_tracker/st_atom_texture.c',
182 'state_tracker/st_atom_viewport.c',
183 'state_tracker/st_cb_accum.c',
184 'state_tracker/st_cb_bitmap.c',
185 'state_tracker/st_cb_blit.c',
186 'state_tracker/st_cb_bufferobjects.c',
187 'state_tracker/st_cb_clear.c',
188 'state_tracker/st_cb_condrender.c',
189 'state_tracker/st_cb_flush.c',
190 'state_tracker/st_cb_drawpixels.c',
191 'state_tracker/st_cb_drawtex.c',
192 'state_tracker/st_cb_eglimage.c',
193 'state_tracker/st_cb_fbo.c',
194 'state_tracker/st_cb_feedback.c',
195 'state_tracker/st_cb_program.c',
196 'state_tracker/st_cb_queryobj.c',
197 'state_tracker/st_cb_rasterpos.c',
198 'state_tracker/st_cb_readpixels.c',
199 'state_tracker/st_cb_strings.c',
200 'state_tracker/st_cb_texture.c',
201 'state_tracker/st_cb_viewport.c',
202 'state_tracker/st_cb_xformfb.c',
203 'state_tracker/st_context.c',
204 'state_tracker/st_debug.c',
205 'state_tracker/st_draw.c',
206 'state_tracker/st_draw_feedback.c',
207 'state_tracker/st_extensions.c',
208 'state_tracker/st_format.c',
209 'state_tracker/st_gen_mipmap.c',
210 'state_tracker/st_manager.c',
211 'state_tracker/st_mesa_to_tgsi.c',
212 'state_tracker/st_program.c',
213 'state_tracker/st_texture.c',
214 ]
215
216 program_sources = [
217 'program/arbprogparse.c',
218 'program/hash_table.c',
219 'program/ir_to_mesa.cpp',
220 'program/lex.yy.c',
221 'program/nvfragparse.c',
222 'program/nvvertparse.c',
223 'program/program.c',
224 'program/program_parse.tab.c',
225 'program/program_parse_extra.c',
226 'program/prog_cache.c',
227 'program/prog_execute.c',
228 'program/prog_instruction.c',
229 'program/prog_noise.c',
230 'program/prog_optimize.c',
231 'program/prog_parameter.c',
232 'program/prog_parameter_layout.c',
233 'program/prog_print.c',
234 'program/prog_statevars.c',
235 'program/prog_uniform.c',
236 'program/programopt.c',
237 'program/sampler.cpp',
238 'program/symbol_table.c',
239 ]
240
241 mesa_sources = (
242 main_sources +
243 math_sources +
244 program_sources +
245 vbo_sources +
246 vf_sources +
247 statetracker_sources
248 )
249
250 if env['gles']:
251 from sys import executable as python_cmd
252
253 env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1'])
254
255 # generate GLES sources
256 gles_sources = []
257 gles_sources += env.CodeGenerate(
258 target = 'main/api_exec_es1.c',
259 script = 'main/es_generator.py',
260 source = 'main/APIspec.xml',
261 command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES1.1 > $TARGET'
262 )
263 gles_sources += env.CodeGenerate(
264 target = 'main/api_exec_es2.c',
265 script = 'main/es_generator.py',
266 source = 'main/APIspec.xml',
267 command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES2.0 > $TARGET'
268 )
269
270 # generate GLES headers
271 GLAPI = '#src/mapi/glapi/'
272 gles_headers = []
273 gles_headers += env.CodeGenerate(
274 target = 'es1api/main/glapidispatch.h',
275 script = GLAPI + 'gen/gl_table.py',
276 source = GLAPI + 'gen-es/es1_API.xml',
277 command = python_cmd + ' $SCRIPT -c -m remap_table -f $SOURCE > $TARGET',
278 )
279 gles_headers += env.CodeGenerate(
280 target = 'es1api/main/remap_helper.h',
281 script = GLAPI + 'gen/remap_helper.py',
282 source = GLAPI + 'gen-es/es1_API.xml',
283 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET',
284 )
285 gles_headers += env.CodeGenerate(
286 target = 'es2api/main/glapidispatch.h',
287 script = GLAPI + 'gen/gl_table.py',
288 source = GLAPI + 'gen-es/es2_API.xml',
289 command = python_cmd + ' $SCRIPT -c -m remap_table -f $SOURCE > $TARGET',
290 )
291 gles_headers += env.CodeGenerate(
292 target = 'es2api/main/remap_helper.h',
293 script = GLAPI + 'gen/remap_helper.py',
294 source = GLAPI + 'gen-es/es2_API.xml',
295 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET',
296 )
297
298 env.Depends(gles_sources, gles_headers)
299
300 # gles_sources #include gles_headers with full path
301 env.Append(CPPPATH = [gles_headers[0].dir.up().up()])
302
303 mesa_sources += gles_sources
304
305 #
306 # Assembly sources
307 #
308 if env['gcc'] and env['platform'] != 'windows':
309 if env['machine'] == 'x86':
310 env.Append(CPPDEFINES = [
311 'USE_X86_ASM',
312 'USE_MMX_ASM',
313 'USE_3DNOW_ASM',
314 'USE_SSE_ASM',
315 ])
316 mesa_sources += [
317 'x86/common_x86.c',
318 'x86/x86_xform.c',
319 'x86/3dnow.c',
320 'x86/sse.c',
321 'x86/common_x86_asm.S',
322 'x86/x86_xform2.S',
323 'x86/x86_xform3.S',
324 'x86/x86_xform4.S',
325 'x86/x86_cliptest.S',
326 'x86/mmx_blend.S',
327 'x86/3dnow_xform1.S',
328 'x86/3dnow_xform2.S',
329 'x86/3dnow_xform3.S',
330 'x86/3dnow_xform4.S',
331 'x86/3dnow_normal.S',
332 'x86/sse_xform1.S',
333 'x86/sse_xform2.S',
334 'x86/sse_xform3.S',
335 'x86/sse_xform4.S',
336 'x86/sse_normal.S',
337 'x86/read_rgba_span_x86.S',
338 ]
339 elif env['machine'] == 'x86_64':
340 env.Append(CPPDEFINES = [
341 'USE_X86_64_ASM',
342 ])
343 mesa_sources += [
344 'x86-64/x86-64.c',
345 'x86-64/xform4.S',
346 ]
347 elif env['machine'] == 'ppc':
348 env.Append(CPPDEFINES = [
349 'USE_PPC_ASM',
350 'USE_VMX_ASM',
351 ])
352 mesa_sources += [
353 'ppc/common_ppc.c',
354 ]
355 elif env['machine'] == 'sparc':
356 mesa_sources += [
357 'sparc/sparc.c',
358 'sparc/clip.S',
359 'sparc/norm.S',
360 'sparc/xform.S',
361 ]
362 else:
363 pass
364
365 # Generate matypes.h
366 if env['machine'] in ('x86', 'x86_64'):
367 # See http://www.scons.org/wiki/UsingCodeGenerators
368 gen_matypes = env.Program(
369 target = 'gen_matypes',
370 source = 'x86/gen_matypes.c',
371 )
372 matypes = env.Command(
373 'matypes.h',
374 gen_matypes,
375 gen_matypes[0].abspath + ' > $TARGET',
376 )
377 # Add the dir containing the generated header (somewhere inside the
378 # build dir) to the include path
379 env.Append(CPPPATH = [matypes[0].dir])
380
381 #
382 # Libraries
383 #
384
385 mesa = env.ConvenienceLibrary(
386 target = 'mesa',
387 source = mesa_sources,
388 )
389
390 env.Alias('mesa', mesa)
391
392 Export('mesa')