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/ff_fragment_shader.cpp',
72 'main/ffvertex_prog.c',
94 'main/pixeltransfer.c',
102 'main/renderbuffer.c',
111 'main/texcompress.c',
112 'main/texcompress_rgtc.c',
113 'main/texcompress_s3tc.c',
114 'main/texcompress_fxt1.c',
119 'main/texgetimage.c',
127 'main/texturebarrier.c',
128 'main/transformfeedback.c',
137 'math/m_debug_clip.c',
138 'math/m_debug_norm.c',
139 'math/m_debug_xform.c',
142 'math/m_translate.c',
150 'vbo/vbo_exec_api.c',
151 'vbo/vbo_exec_array.c',
152 'vbo/vbo_exec_draw.c',
153 'vbo/vbo_exec_eval.c',
156 'vbo/vbo_split_copy.c',
157 'vbo/vbo_split_inplace.c',
159 'vbo/vbo_save_api.c',
160 'vbo/vbo_save_draw.c',
161 'vbo/vbo_save_loopback.c',
170 statetracker_sources = [
171 'state_tracker/st_atom.c',
172 'state_tracker/st_atom_blend.c',
173 'state_tracker/st_atom_clip.c',
174 'state_tracker/st_atom_constbuf.c',
175 'state_tracker/st_atom_depth.c',
176 'state_tracker/st_atom_framebuffer.c',
177 'state_tracker/st_atom_msaa.c',
178 'state_tracker/st_atom_pixeltransfer.c',
179 'state_tracker/st_atom_sampler.c',
180 'state_tracker/st_atom_scissor.c',
181 'state_tracker/st_atom_shader.c',
182 'state_tracker/st_atom_rasterizer.c',
183 'state_tracker/st_atom_stipple.c',
184 'state_tracker/st_atom_texture.c',
185 'state_tracker/st_atom_viewport.c',
186 'state_tracker/st_cb_accum.c',
187 'state_tracker/st_cb_bitmap.c',
188 'state_tracker/st_cb_blit.c',
189 'state_tracker/st_cb_bufferobjects.c',
190 'state_tracker/st_cb_clear.c',
191 'state_tracker/st_cb_condrender.c',
192 'state_tracker/st_cb_flush.c',
193 'state_tracker/st_cb_drawpixels.c',
194 'state_tracker/st_cb_drawtex.c',
195 'state_tracker/st_cb_eglimage.c',
196 'state_tracker/st_cb_fbo.c',
197 'state_tracker/st_cb_feedback.c',
198 'state_tracker/st_cb_program.c',
199 'state_tracker/st_cb_queryobj.c',
200 'state_tracker/st_cb_rasterpos.c',
201 'state_tracker/st_cb_readpixels.c',
202 'state_tracker/st_cb_syncobj.c',
203 'state_tracker/st_cb_strings.c',
204 'state_tracker/st_cb_texture.c',
205 'state_tracker/st_cb_texturebarrier.c',
206 'state_tracker/st_cb_viewport.c',
207 'state_tracker/st_cb_xformfb.c',
208 'state_tracker/st_context.c',
209 'state_tracker/st_debug.c',
210 'state_tracker/st_draw.c',
211 'state_tracker/st_draw_feedback.c',
212 'state_tracker/st_extensions.c',
213 'state_tracker/st_format.c',
214 'state_tracker/st_gen_mipmap.c',
215 'state_tracker/st_manager.c',
216 'state_tracker/st_mesa_to_tgsi.c',
217 'state_tracker/st_program.c',
218 'state_tracker/st_texture.c',
221 env.Append(YACCFLAGS = '-d')
222 program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l')
223 program_parse = env.CFile('program/program_parse.tab.c',
224 'program/program_parse.y')
226 # Make program/program_parse.tab.h reacheable from the include path
227 env.Append(CPPPATH = [Dir('.').abspath])
230 'program/arbprogparse.c',
231 'program/hash_table.c',
232 'program/ir_to_mesa.cpp',
233 'program/nvfragparse.c',
234 'program/nvvertparse.c',
236 'program/program_parse_extra.c',
237 'program/prog_cache.c',
238 'program/prog_execute.c',
239 'program/prog_instruction.c',
240 'program/prog_noise.c',
241 'program/prog_optimize.c',
242 'program/prog_parameter.c',
243 'program/prog_parameter_layout.c',
244 'program/prog_print.c',
245 'program/prog_statevars.c',
246 'program/prog_uniform.c',
247 'program/programopt.c',
248 'program/sampler.cpp',
249 'program/symbol_table.c',
264 from sys import executable as python_cmd
266 env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1'])
268 # generate GLES sources
270 gles_sources += env.CodeGenerate(
271 target = 'main/api_exec_es1.c',
272 script = 'main/es_generator.py',
273 source = 'main/APIspec.xml',
274 command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES1.1 > $TARGET'
276 gles_sources += env.CodeGenerate(
277 target = 'main/api_exec_es2.c',
278 script = 'main/es_generator.py',
279 source = 'main/APIspec.xml',
280 command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES2.0 > $TARGET'
283 # generate GLES headers
284 GLAPI = '#src/mapi/glapi/'
286 gles_headers += env.CodeGenerate(
287 target = 'es1api/main/glapidispatch.h',
288 script = GLAPI + 'gen/gl_table.py',
289 source = GLAPI + 'gen-es/es1_API.xml',
290 command = python_cmd + ' $SCRIPT -c -m remap_table -f $SOURCE > $TARGET',
292 gles_headers += env.CodeGenerate(
293 target = 'es1api/main/remap_helper.h',
294 script = GLAPI + 'gen/remap_helper.py',
295 source = GLAPI + 'gen-es/es1_API.xml',
296 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET',
298 gles_headers += env.CodeGenerate(
299 target = 'es2api/main/glapidispatch.h',
300 script = GLAPI + 'gen/gl_table.py',
301 source = GLAPI + 'gen-es/es2_API.xml',
302 command = python_cmd + ' $SCRIPT -c -m remap_table -f $SOURCE > $TARGET',
304 gles_headers += env.CodeGenerate(
305 target = 'es2api/main/remap_helper.h',
306 script = GLAPI + 'gen/remap_helper.py',
307 source = GLAPI + 'gen-es/es2_API.xml',
308 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET',
311 env.Depends(gles_sources, gles_headers)
313 # gles_sources #include gles_headers with full path
314 env.Append(CPPPATH = [gles_headers[0].dir.up().up()])
316 mesa_sources += gles_sources
321 if env['gcc'] and env['platform'] != 'windows':
322 if env['machine'] == 'x86':
323 env.Append(CPPDEFINES = [
334 'x86/common_x86_asm.S',
338 'x86/x86_cliptest.S',
340 'x86/3dnow_xform1.S',
341 'x86/3dnow_xform2.S',
342 'x86/3dnow_xform3.S',
343 'x86/3dnow_xform4.S',
344 'x86/3dnow_normal.S',
350 'x86/read_rgba_span_x86.S',
352 elif env['machine'] == 'x86_64':
353 env.Append(CPPDEFINES = [
360 elif env['machine'] == 'ppc':
361 env.Append(CPPDEFINES = [
368 elif env['machine'] == 'sparc':
379 if env['machine'] in ('x86', 'x86_64'):
380 # See http://www.scons.org/wiki/UsingCodeGenerators
381 gen_matypes = env.Program(
382 target = 'gen_matypes',
383 source = 'x86/gen_matypes.c',
385 matypes = env.Command(
388 gen_matypes[0].abspath + ' > $TARGET',
390 # Add the dir containing the generated header (somewhere inside the
391 # build dir) to the include path
392 env.Append(CPPPATH = [matypes[0].dir])
395 # Create the git_sha1.h file if it doesn't exist already
397 f = open('main/git_sha1.h', 'r')
400 f = open('main/git_sha1.h', 'w')
402 # and update CPPPATH so the git_sha1.h header can be found
403 env.Append(CPPPATH = ["#" + env['build_dir'] + "/mesa/main"])
410 mesa = env.ConvenienceLibrary(
412 source = mesa_sources,
415 env.Alias('mesa', mesa)