1 #######################################################################
6 from sys import executable as python_cmd
12 env.Append(CPPPATH = [
13 '../compiler/nir', # for generated nir_opcodes.h, etc
15 Dir('../mapi'), # src/mapi build path
17 Dir('.'), # src/mesa build path
19 Dir('main'), # src/mesa/main/ build path
21 '#/src/gallium/include',
22 '#/src/gallium/auxiliary',
25 if env['platform'] == 'windows':
26 env.Append(CPPDEFINES = [
27 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
28 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
31 # prevent _glapi_* from being declared __declspec(dllimport)
32 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
34 env.Append(CPPDEFINES = [
38 # parse Makefile.sources
39 source_lists = env.ParseSourceList('Makefile.sources')
41 env.Append(YACCFLAGS = ['-d', '-p', '_mesa_program_'])
42 env.CFile('program/lex.yy.c', 'program/program_lexer.l')
43 env.CFile('program/program_parse.tab.c', 'program/program_parse.y')
46 source_lists['MESA_FILES'] +
47 source_lists['PROGRAM_FILES'] +
48 source_lists['STATETRACKER_FILES']
51 GLAPI = '#src/mapi/glapi/'
53 get_hash_header = env.CodeGenerate(
54 target = 'main/get_hash.h',
55 script = 'main/get_hash_generator.py',
56 source = GLAPI + 'gen/gl_and_es_API.xml',
57 command = python_cmd + ' $SCRIPT ' + ' -f $SOURCE > $TARGET'
60 format_info = env.CodeGenerate(
61 target = 'main/format_info.h',
62 script = 'main/format_info.py',
63 source = 'main/formats.csv',
64 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET'
67 format_pack = env.CodeGenerate(
68 target = 'main/format_pack.c',
69 script = 'main/format_pack.py',
70 source = 'main/formats.csv',
71 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET'
74 format_unpack = env.CodeGenerate(
75 target = 'main/format_unpack.c',
76 script = 'main/format_unpack.py',
77 source = 'main/formats.csv',
78 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET'
84 if env['platform'] not in ('cygwin', 'darwin', 'windows', 'haiku'):
85 if env['machine'] == 'x86':
86 env.Append(CPPDEFINES = [
92 mesa_sources += source_lists['X86_FILES']
93 elif env['machine'] == 'x86_64':
94 env.Append(CPPDEFINES = [
97 mesa_sources += source_lists['X86_64_FILES']
98 elif env['machine'] == 'sparc':
99 mesa_sources += source_lists['SPARC_FILES']
104 if env['machine'] in ('x86', 'x86_64'):
105 # See http://www.scons.org/wiki/UsingCodeGenerators
106 gen_matypes = env.Program(
107 target = 'gen_matypes',
108 source = 'x86/gen_matypes.c',
110 matypes = env.Command(
113 gen_matypes[0].abspath + ' > $TARGET',
115 # Add the dir containing the generated header (somewhere inside the
116 # build dir) to the include path
117 env.Prepend(CPPPATH = [matypes[0].dir])
124 mesa = env.ConvenienceLibrary(
126 source = mesa_sources,
129 env.Alias('mesa', mesa)
133 SConscript('drivers/SConscript')