1####################################################################### 2# SConscript for Mesa 3 4 5Import('*') 6from sys import executable as python_cmd 7 8env = env.Clone() 9 10env.MSVC2013Compat() 11 12env.Append(CPPPATH = [ 13 '../compiler/nir', # for generated nir_opcodes.h, etc 14 '../compiler/glsl', # for generated headers 15 '#/src', 16 Dir('../mapi'), # src/mapi build path 17 '#/src/mapi', 18 Dir('.'), # src/mesa build path 19 '#/src/mesa', 20 Dir('main'), # src/mesa/main/ build path 21 '#/src/mesa/main', 22 '#/src/gallium/include', 23 '#/src/gallium/auxiliary', 24]) 25 26if 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 ]) 31 if not env['gles']: 32 # prevent _glapi_* from being declared __declspec(dllimport) 33 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS']) 34else: 35 env.Append(CPPDEFINES = [ 36 ('HAVE_DLOPEN', '1'), 37 ]) 38 39# parse Makefile.sources 40source_lists = env.ParseSourceList('Makefile.sources') 41 42env.Append(YACCFLAGS = ['-d', '-p', '_mesa_program_']) 43env.CFile('program/lex.yy.c', 'program/program_lexer.l') 44env.CFile('program/program_parse.tab.c', 'program/program_parse.y') 45 46mesa_sources = ( 47 source_lists['MESA_FILES'] + 48 source_lists['PROGRAM_FILES'] + 49 source_lists['STATETRACKER_FILES'] 50) 51 52GLAPI = '#src/mapi/glapi/' 53 54get_hash_header = env.CodeGenerate( 55 target = 'main/get_hash.h', 56 script = 'main/get_hash_generator.py', 57 source = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml'), 58 command = python_cmd + ' $SCRIPT ' + ' -f $SOURCE > $TARGET' 59) 60 61format_info = env.CodeGenerate( 62 target = 'main/format_info.h', 63 script = 'main/format_info.py', 64 source = 'main/formats.csv', 65 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET' 66) 67 68format_pack = env.CodeGenerate( 69 target = 'main/format_pack.c', 70 script = 'main/format_pack.py', 71 source = 'main/formats.csv', 72 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET' 73) 74 75format_unpack = env.CodeGenerate( 76 target = 'main/format_unpack.c', 77 script = 'main/format_unpack.py', 78 source = 'main/formats.csv', 79 command = python_cmd + ' $SCRIPT ' + ' $SOURCE > $TARGET' 80) 81 82# 83# Assembly sources 84# 85if env['platform'] not in ('cygwin', 'darwin', 'windows', 'haiku'): 86 if env['machine'] == 'x86': 87 env.Append(CPPDEFINES = [ 88 'USE_X86_ASM', 89 'USE_MMX_ASM', 90 'USE_3DNOW_ASM', 91 'USE_SSE_ASM', 92 ]) 93 mesa_sources += source_lists['X86_FILES'] 94 elif env['machine'] == 'x86_64': 95 env.Append(CPPDEFINES = [ 96 'USE_X86_64_ASM', 97 ]) 98 mesa_sources += source_lists['X86_64_FILES'] 99 elif env['machine'] == 'sparc': 100 mesa_sources += source_lists['SPARC_FILES'] 101 else: 102 pass 103 104 # Generate matypes.h 105 if env['machine'] in ('x86', 'x86_64'): 106 # See http://www.scons.org/wiki/UsingCodeGenerators 107 gen_matypes = env.Program( 108 target = 'gen_matypes', 109 source = 'x86/gen_matypes.c', 110 ) 111 matypes = env.Command( 112 'matypes.h', 113 gen_matypes, 114 gen_matypes[0].abspath + ' > $TARGET', 115 ) 116 # Add the dir containing the generated header (somewhere inside the 117 # build dir) to the include path 118 env.Prepend(CPPPATH = [matypes[0].dir]) 119 120 121# 122# Libraries 123# 124 125mesa = env.ConvenienceLibrary( 126 target = 'mesa', 127 source = mesa_sources, 128) 129 130env.Alias('mesa', mesa) 131 132Export('mesa') 133 134SConscript('drivers/SConscript') 135