1 ####################################################################### 2 # SConscript for glapi 3 4 5 from sys import executable as python_cmd 6 7 Import('*') 8 9 env = env.Clone() 10 11 env.MSVC2013Compat() 12 13 env.Append(CPPDEFINES = [ 14 'MAPI_MODE_UTIL', 15 ]) 16 17 if env['platform'] == 'windows': 18 env.Append(CPPDEFINES = [ 19 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers 20 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 21 'KHRONOS_DLL_EXPORTS', # declare gl* as __declspec(dllexport) in Khronos headers 22 ]) 23 if env['gles']: 24 env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS']) 25 else: 26 # prevent _glapi_* from being declared __declspec(dllimport) 27 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS']) 28 29 env.Append(CPPPATH = [ 30 '#/src', 31 '#/src/mapi', 32 '#/src/mesa', 33 Dir('..'), # src/mapi build path 34 ]) 35 36 glapi_sources = [ 37 'glapi_dispatch.c', 38 'glapi_entrypoint.c', 39 'glapi_getproc.c', 40 'glapi_nop.c', 41 'glapi.c', 42 ] 43 44 mapi_sources = [ 45 'u_current.c', 46 'u_execmem.c', 47 ] 48 for s in mapi_sources: 49 o = env.SharedObject(s[:-2], '../' + s) 50 glapi_sources.append(o) 51 52 # 53 # Assembly sources 54 # 55 if env['platform'] not in ('cygwin', 'darwin', 'windows'): 56 GLAPI = '#src/mapi/glapi/' 57 sources = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml') 58 59 if env['machine'] == 'x86': 60 env.Append(CPPDEFINES = [ 61 'USE_X86_ASM', 62 ]) 63 glapi_sources += [ 64 'glapi_x86.S', 65 ] 66 env.CodeGenerate( 67 target = 'glapi_x86.S', 68 script = GLAPI + 'gen/gl_x86_asm.py', 69 source = sources, 70 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' 71 ) 72 elif env['machine'] == 'x86_64': 73 env.Append(CPPDEFINES = [ 74 'USE_X86_64_ASM', 75 ]) 76 glapi_sources += [ 77 'glapi_x86-64.S' 78 ] 79 env.CodeGenerate( 80 target = 'glapi_x86-64.S', 81 script = GLAPI + 'gen/gl_x86-64_asm.py', 82 source = sources, 83 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' 84 ) 85 elif env['machine'] == 'sparc': 86 env.Append(CPPDEFINES = [ 87 'USE_SPARC_ASM', 88 ]) 89 glapi_sources += [ 90 'glapi_sparc.S' 91 ] 92 env.CodeGenerate( 93 target = 'glapi_sparc.S', 94 script = GLAPI + 'gen/gl_SPARC_asm.py', 95 source = sources, 96 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' 97 ) 98 else: 99 pass 100 101 glapi = env.ConvenienceLibrary( 102 target = 'glapi', 103 source = glapi_sources, 104 ) 105 Export('glapi') 106