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
This commit is contained in:
@@ -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')
|
||||
|
||||
|
@@ -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])
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
|
42
src/mapi/glapi/gen/SConscript
Normal file
42
src/mapi/glapi/gen/SConscript
Normal file
@@ -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')
|
@@ -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):
|
||||
|
@@ -34,3 +34,5 @@ osmesa = env.SharedLibrary(
|
||||
)
|
||||
|
||||
env.Alias('osmesa', osmesa)
|
||||
|
||||
env.Depends(sources, glapi_headers)
|
||||
|
Reference in New Issue
Block a user