1 #######################################################################
6 from sys import executable as python_cmd
12 env.Append(CPPPATH = [
13 '../compiler/nir', # for generated nir_opcodes.h, etc
14 '../compiler/glsl', # for generated headers
16 Dir('../mapi'), # src/mapi build path
18 Dir('.'), # src/mesa build path
20 Dir('main'), # src/mesa/main/ build path
22 '#/src/gallium/include',
23 '#/src/gallium/auxiliary',
26 if env['platform'] == 'windows':
27 env.Append(CPPDEFINES = [
28 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
29 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
30 '_GLAPI_NO_EXPORTS', # prevent _glapi_* from being declared __declspec(dllimport)
33 # parse Makefile.sources
34 source_lists = env.ParseSourceList('Makefile.sources')
36 env.Append(YACCFLAGS = ['-d', '-p', '_mesa_program_'])
37 env.CFile('program/lex.yy.c', 'program/program_lexer.l')
38 env.CFile('program/program_parse.tab.c', 'program/program_parse.y')
41 source_lists['MESA_FILES'] +
42 source_lists['PROGRAM_FILES'] +
43 source_lists['PROGRAM_NIR_FILES'] +
44 source_lists['STATETRACKER_FILES']
47 GLAPI = '#src/mapi/glapi/'
49 get_hash_header = env.CodeGenerate(
50 target = 'main/get_hash.h',
51 script = 'main/get_hash_generator.py',
52 source = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml'),
53 command = python_cmd + ' $SCRIPT ' + ' -f $SOURCE > $TARGET'
56 format_info = env.CodeGenerate(
57 target = 'main/format_info.h',
58 script = 'main/format_info.py',
59 source = 'main/formats.csv',
60 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET'
63 format_pack = env.CodeGenerate(
64 target = 'main/format_pack.c',
65 script = 'main/format_pack.py',
66 source = 'main/formats.csv',
67 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET'
70 format_unpack = env.CodeGenerate(
71 target = 'main/format_unpack.c',
72 script = 'main/format_unpack.py',
73 source = 'main/formats.csv',
74 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET'
77 format_fallback = env.CodeGenerate(
78 target = 'main/format_fallback.c',
79 script = 'main/format_fallback.py',
80 source = 'main/formats.csv',
81 command = python_cmd + ' $SCRIPT ' + ' $SOURCE ' + ' $TARGET'
87 if env['platform'] not in ('cygwin', 'darwin', 'windows', 'haiku'):
88 if env['machine'] == 'x86':
89 env.Append(CPPDEFINES = [
95 mesa_sources += source_lists['X86_FILES']
96 elif env['machine'] == 'x86_64':
97 env.Append(CPPDEFINES = [
100 mesa_sources += source_lists['X86_64_FILES']
101 elif env['machine'] == 'sparc':
102 mesa_sources += source_lists['SPARC_FILES']
107 if env['machine'] in ('x86', 'x86_64'):
108 # See http://www.scons.org/wiki/UsingCodeGenerators
109 gen_matypes = env.Program(
110 target = 'gen_matypes',
111 source = 'x86/gen_matypes.c',
113 matypes = env.Command(
116 gen_matypes[0].abspath + ' > $TARGET',
118 # Add the dir containing the generated header (somewhere inside the
119 # build dir) to the include path
120 env.Prepend(CPPPATH = [matypes[0].dir])
123 # The marshal_generated.c file is generated from the GL/ES API.xml file
125 target = 'main/marshal_generated.c',
126 script = GLAPI + 'gen/gl_marshal.py',
127 source = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml'),
128 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
131 # The marshal_generated.h file is generated from the GL/ES API.xml file
133 target = 'main/marshal_generated.h',
134 script = GLAPI + 'gen/gl_marshal_h.py',
135 source = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml'),
136 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
143 mesa = env.ConvenienceLibrary(
145 source = mesa_sources,
148 env.Alias('mesa', mesa)
152 SConscript('drivers/SConscript')