X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmapi%2Fglapi%2FSConscript;h=8ded46f32e039600bba7ef0eabd0e3c3798e9a51;hb=3f34afa0aad2a9bcfc0e5469a9675eca11ea7649;hp=27ef5adc27f852f4ad0e5f7aa550f0835ca83b91;hpb=fa97399f422c36938a66c2f9098e28a1326eecbb;p=mesa.git diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript index 27ef5adc27f..8ded46f32e0 100644 --- a/src/mapi/glapi/SConscript +++ b/src/mapi/glapi/SConscript @@ -2,81 +2,105 @@ # SConscript for glapi +from sys import executable as python_cmd + Import('*') -if env['platform'] != 'winddk': +env = env.Clone() + +env.MSVC2013Compat() + +env.Append(CPPDEFINES = [ + 'MAPI_MODE_UTIL', +]) + +if env['platform'] == 'windows': + env.Append(CPPDEFINES = [ + '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers + 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers + 'KHRONOS_DLL_EXPORTS', # declare gl* as __declspec(dllexport) in Khronos headers + ]) + if env['gles']: + env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS']) + else: + # prevent _glapi_* from being declared __declspec(dllimport) + env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS']) + +env.Append(CPPPATH = [ + '#/src', + '#/src/mapi', + '#/src/mesa', + Dir('..'), # src/mapi build path +]) + +glapi_sources = [ + 'glapi_dispatch.c', + 'glapi_entrypoint.c', + 'glapi_getproc.c', + 'glapi_nop.c', + 'glapi.c', +] - env = env.Clone() - - env.Append(CPPDEFINES = [ - 'MAPI_GLAPI_CURRENT', - ]) +mapi_sources = [ + 'u_current.c', + 'u_execmem.c', +] +for s in mapi_sources: + o = env.SharedObject(s[:-2], '../' + s) + glapi_sources.append(o) - if env['platform'] == 'windows': - env.Append(CPPDEFINES = [ - '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers - 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers - 'WIN32_THREADS', # use Win32 thread API - ]) +# +# Assembly sources +# +if (env['gcc'] or env['clang']) and \ + env['platform'] not in ('cygwin', 'darwin', 'windows'): + GLAPI = '#src/mapi/glapi/' + sources = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml') - env.Append(CPPPATH = [ - '#/src/mapi', - '#/src/mesa', - ]) - - glapi_sources = [ - 'glapi_dispatch.c', - 'glapi_entrypoint.c', - 'glapi_getproc.c', - 'glapi_nop.c', - 'glthread.c', - ] - - mapi_sources = [ - 'u_current.c', - 'u_execmem.c', - 'u_thread.c', - ] - for s in mapi_sources: - o = env.Object(s[:-2], '../mapi/' + s) - glapi_sources.append(o) + if env['machine'] == 'x86': + env.Append(CPPDEFINES = [ + 'USE_X86_ASM', + ]) + glapi_sources += [ + 'glapi_x86.S', + ] + env.CodeGenerate( + target = 'glapi_x86.S', + script = GLAPI + 'gen/gl_x86_asm.py', + source = sources, + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) + elif env['machine'] == 'x86_64': + env.Append(CPPDEFINES = [ + 'USE_X86_64_ASM', + ]) + glapi_sources += [ + 'glapi_x86-64.S' + ] + env.CodeGenerate( + target = 'glapi_x86-64.S', + script = GLAPI + 'gen/gl_x86-64_asm.py', + source = sources, + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) + elif env['machine'] == 'sparc': + env.Append(CPPDEFINES = [ + 'USE_SPARC_ASM', + ]) + glapi_sources += [ + 'glapi_sparc.S' + ] + env.CodeGenerate( + target = 'glapi_sparc.S', + script = GLAPI + 'gen/gl_SPARC_asm.py', + source = sources, + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) + else: + pass - # - # Assembly sources - # - if gcc and env['machine'] == 'x86': - env.Append(CPPDEFINES = [ - 'USE_X86_ASM', - 'USE_MMX_ASM', - 'USE_3DNOW_ASM', - 'USE_SSE_ASM', - ]) - glapi_sources += [ - 'glapi_x86.S', - ] - elif gcc and env['machine'] == 'x86_64': - env.Append(CPPDEFINES = [ - 'USE_X86_64_ASM', - ]) - glapi_sources += [ - 'glapi_x86-64.S' - ] - elif gcc and env['machine'] == 'ppc': - env.Append(CPPDEFINES = [ - 'USE_PPC_ASM', - 'USE_VMX_ASM', - ]) - glapi_sources += [ - ] - elif gcc and env['machine'] == 'sparc': - glapi_sources += [ - 'glapi_sparc.S' - ] - else: - pass - - glapi = env.ConvenienceLibrary( - target = 'glapi', - source = glapi_sources, - ) - Export('glapi') +glapi = env.ConvenienceLibrary( + target = 'glapi', + source = glapi_sources, +) +Export('glapi')