1 #######################################################################
15 env.Append(CPPDEFINES = [
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
25 # prevent _glapi_* from being declared __declspec(dllimport)
26 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
28 env.Append(CPPDEFINES = [
29 'IN_DRI_DRIVER', # enable the remap table (for DRI drivers)
37 'main/api_arrayelt.c',
39 'main/api_loopback.c',
41 'main/api_validate.c',
44 'main/atifragshader.c',
59 'main/depthstencil.c',
71 'main/ffvertex_prog.c',
92 'main/pixeltransfer.c',
100 'main/renderbuffer.c',
108 'main/texcompress.c',
109 'main/texcompress_rgtc.c',
110 'main/texcompress_s3tc.c',
111 'main/texcompress_fxt1.c',
113 'main/texenvprogram.c',
117 'main/texgetimage.c',
125 'main/transformfeedback.c',
134 'math/m_debug_clip.c',
135 'math/m_debug_norm.c',
136 'math/m_debug_xform.c',
139 'math/m_translate.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',
153 'vbo/vbo_split_copy.c',
154 'vbo/vbo_split_inplace.c',
156 'vbo/vbo_save_api.c',
157 'vbo/vbo_save_draw.c',
158 'vbo/vbo_save_loopback.c',
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',
217 'program/arbprogparse.c',
218 'program/hash_table.c',
219 'program/ir_to_mesa.cpp',
221 'program/nvfragparse.c',
222 'program/nvvertparse.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',
251 from sys import executable as python_cmd
253 env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1'])
255 # generate 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'
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'
270 # generate GLES headers
271 GLAPI = '#src/mapi/glapi/'
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',
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',
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',
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',
298 env.Depends(gles_sources, gles_headers)
300 # gles_sources #include gles_headers with full path
301 env.Append(CPPPATH = [gles_headers[0].dir.up().up()])
303 mesa_sources += gles_sources
308 if env['gcc'] and env['platform'] != 'windows':
309 if env['machine'] == 'x86':
310 env.Append(CPPDEFINES = [
321 'x86/common_x86_asm.S',
325 'x86/x86_cliptest.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',
337 'x86/read_rgba_span_x86.S',
339 elif env['machine'] == 'x86_64':
340 env.Append(CPPDEFINES = [
347 elif env['machine'] == 'ppc':
348 env.Append(CPPDEFINES = [
355 elif env['machine'] == 'sparc':
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',
372 matypes = env.Command(
375 gen_matypes[0].abspath + ' > $TARGET',
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])
385 mesa = env.ConvenienceLibrary(
387 source = mesa_sources,
390 env.Alias('mesa', mesa)