Module: Mesa Branch: master Commit: dff36e900c645401b26c9a44106459e96ee7a24d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dff36e900c645401b26c9a44106459e96ee7a24d
Author: Brian Paul <[email protected]> Date: Wed May 30 10:08:11 2012 -0600 scons: add code to generate the various GL API files This fixes recent build breakage when we began building the generated API files from xml as part of the normal build process. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=50475 --- src/SConscript | 1 + src/gallium/targets/libgl-xlib/SConscript | 3 ++ src/glx/SConscript | 51 +++++++++++++++++++++++++++++ src/mapi/glapi/SConscript | 25 ++++++++++++++ src/mapi/glapi/gen/SConscript | 42 +++++++++++++++++++++++ src/mesa/SConscript | 15 +++++++- src/mesa/drivers/osmesa/SConscript | 2 + 7 files changed, 137 insertions(+), 2 deletions(-) diff --git a/src/SConscript b/src/SConscript index 3d00878..75c4446 100644 --- a/src/SConscript +++ b/src/SConscript @@ -16,6 +16,7 @@ if env['hostonly']: # used. libgl-xlib and libgl-gdi adapt themselves to use the targets defined # in mapi/glapi-shared/SConscript. mesa/SConscript also adapts itself to # enable OpenGL ES support. +SConscript('mapi/glapi/gen/SConscript') SConscript('mapi/glapi/SConscript') SConscript('mesa/SConscript') diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript index 25a4582..1b92c30 100644 --- a/src/gallium/targets/libgl-xlib/SConscript +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -35,6 +35,9 @@ sources = [ 'xlib.c', ] +# The sources depend on the python-generated GL API files/headers. +env.Depends(sources, glapi_headers) + if True: env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD', 'GALLIUM_SOFTPIPE']) env.Prepend(LIBS = [trace, rbug, galahad, softpipe]) diff --git a/src/glx/SConscript b/src/glx/SConscript index 17a5690..664cb86 100644 --- a/src/glx/SConscript +++ b/src/glx/SConscript @@ -1,8 +1,11 @@ Import('*') +from sys import executable as python_cmd + env = env.Clone() env.Prepend(CPPPATH = [ + '.', # the build/<platform>/glx/ directory '#include', '#include/GL/internal', '#src/mesa', @@ -80,6 +83,54 @@ libgl = env.SharedLibrary( source = sources, ) + +# Generate GLX-specific .c and .h files here. Other GL API-related +# files are used, but they're generated in mapi/glapi/gen/ since they're +# used by other targets as well. + +GLAPI = '#src/mapi/glapi/' + +env.CodeGenerate( + target = 'indirect.c', + script = GLAPI + 'gen/glX_proto_send.py', + source = GLAPI + 'gen/gl_and_es_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE -m proto > $TARGET' + ) + +env.CodeGenerate( + target = 'indirect_size.c', + script = GLAPI + 'gen/glX_proto_size.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE -m size_c --only-set > $TARGET' +) + +env.CodeGenerate( + target = 'indirect_init.c', + script = GLAPI + 'gen/glX_proto_send.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE -m init_c > $TARGET' +) + +headers = [] + +headers += env.CodeGenerate( + target = 'indirect_size.h', + script = GLAPI + 'gen/glX_proto_size.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE -m size_h --only-set -h _INDIRECT_SIZE_H > $TARGET' +) + +headers += env.CodeGenerate( + target = 'indirect.h', + script = GLAPI + 'gen/glX_proto_send.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -m init_h -f $SOURCE > $TARGET', + ) + + +env.Depends(sources, headers) + + libgl = env.InstallSharedLibrary(libgl, version=(1, 2)) env.Alias('glx', libgl) diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript index 4097a7f..ad007a6 100644 --- a/src/mapi/glapi/SConscript +++ b/src/mapi/glapi/SConscript @@ -2,6 +2,8 @@ # SConscript for glapi +from sys import executable as python_cmd + Import('*') env = env.Clone() @@ -47,6 +49,8 @@ for s in mapi_sources: # Assembly sources # if env['gcc'] and env['platform'] not in ('darwin', 'windows'): + GLAPI = '#src/mapi/glapi/' + if env['machine'] == 'x86': env.Append(CPPDEFINES = [ 'USE_X86_ASM', @@ -54,6 +58,12 @@ if env['gcc'] and env['platform'] not in ('darwin', 'windows'): glapi_sources += [ 'glapi_x86.S', ] + env.CodeGenerate( + target = 'glapi_x86.S', + script = GLAPI + 'gen/gl_x86_asm.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) elif env['machine'] == 'x86_64': env.Append(CPPDEFINES = [ 'USE_X86_64_ASM', @@ -61,6 +71,12 @@ if env['gcc'] and env['platform'] not in ('darwin', 'windows'): glapi_sources += [ 'glapi_x86-64.S' ] + env.CodeGenerate( + target = 'glapi_x86-64.S', + script = GLAPI + 'gen/gl_x86-64_asm.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) elif env['machine'] == 'sparc': env.Append(CPPDEFINES = [ 'USE_SPARC_ASM', @@ -68,6 +84,12 @@ if env['gcc'] and env['platform'] not in ('darwin', 'windows'): glapi_sources += [ 'glapi_sparc.S' ] + env.CodeGenerate( + target = 'glapi_sparc.S', + script = GLAPI + 'gen/gl_SPARC_asm.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) else: pass @@ -81,3 +103,6 @@ glapi = env.ConvenienceLibrary( source = glapi_sources, ) Export('glapi') + + +env.Depends(glapi_sources, glapi_headers) diff --git a/src/mapi/glapi/gen/SConscript b/src/mapi/glapi/gen/SConscript new file mode 100644 index 0000000..81f69df --- /dev/null +++ b/src/mapi/glapi/gen/SConscript @@ -0,0 +1,42 @@ +Import('*') + +from sys import executable as python_cmd + + +# Generate the GL API headers that are used by various parts of the +# Mesa and GLX tree. Other .c and .h files are generated elsewhere +# if they're only used in one place. + +GLAPI = '#src/mapi/glapi/' + +glapi_headers = [] + +glapi_headers += env.CodeGenerate( + target = '#src/mesa/main/dispatch.h', + script = GLAPI + 'gen/gl_table.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -m remap_table -f $SOURCE > $TARGET', + ) + +glapi_headers += env.CodeGenerate( + target = '#src/mapi/glapi/glapitemp.h', + script = GLAPI + 'gen/gl_apitemp.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) + +glapi_headers += env.CodeGenerate( + target = '#src/mapi/glapi/glprocs.h', + script = GLAPI + 'gen/gl_procs.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) + +glapi_headers += env.CodeGenerate( + target = '#src/mesa/main/remap_helper.h', + script = GLAPI + 'gen/remap_helper.py', + source = GLAPI + 'gen/gl_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) + +env.Export('glapi_headers') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index d7932c7..99bdfad 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -6,6 +6,7 @@ Import('*') import filecmp import os import subprocess +from sys import executable as python_cmd env = env.Clone() @@ -328,8 +329,9 @@ mesa_sources = ( statetracker_sources ) +GLAPI = '#src/mapi/glapi/' + if env['gles']: - from sys import executable as python_cmd env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1']) @@ -349,7 +351,6 @@ if env['gles']: ) # generate GLES headers - GLAPI = '#src/mapi/glapi/' gles_headers = [] gles_headers += env.CodeGenerate( target = 'main/api_exec_es1_dispatch.h', @@ -452,6 +453,16 @@ if env['gcc'] and env['platform'] not in ('darwin', 'windows'): env.Append(CPPPATH = [matypes[0].dir]) +# The enums.c file is generated from the GL/ES API.xml file +env.CodeGenerate( + target = 'main/enums.c', + script = GLAPI + 'gen/gl_enums.py', + source = GLAPI + 'gen/gl_and_es_API.xml', + command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' + ) + +# We also depend on the auto-generated GL API headers +env.Depends(mesa_sources, glapi_headers) def write_git_sha1_h_file(filename): diff --git a/src/mesa/drivers/osmesa/SConscript b/src/mesa/drivers/osmesa/SConscript index 5ccef5f..e4f23c2 100644 --- a/src/mesa/drivers/osmesa/SConscript +++ b/src/mesa/drivers/osmesa/SConscript @@ -34,3 +34,5 @@ osmesa = env.SharedLibrary( ) env.Alias('osmesa', osmesa) + +env.Depends(sources, glapi_headers) _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
