scons: Fix dependencies of generated headers.

It appears that scons implicit dependency scanners fail to chain
dependencies of generated headers when these are outside the build tree.

This patch ensures generated source files are _always_ put in the build
tree. I'm not 100% this will fix all depency issues, but from my
experiments it does seem to fix this.

NOTE: For this to be effective it is necessary to clean the source tree
from generated header/source files.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
José Fonseca 2013-01-21 17:47:51 +00:00
parent 75b7e1df13
commit 71c87e42e1
9 changed files with 34 additions and 70 deletions

View file

@ -9,6 +9,7 @@ env = env.Clone()
env.Append(CPPPATH = [
'#/src/mapi',
Dir('.'),
])
env.Append(CPPDEFINES = [
'VEGA_VERSION_STRING=',
@ -47,13 +48,12 @@ vega_sources = [
'vgu.c'
]
api_tmp = env.CodeGenerate(
target = '#/src/gallium/state_trackers/vega/api_tmp.h',
api_tmp, = env.CodeGenerate(
target = 'api_tmp.h',
script = '#src/mapi/mapi/mapi_abi.py',
source = '#src/mapi/vgapi/vgapi.csv',
command = python_cmd + ' $SCRIPT --printer vgapi --mode app $SOURCE > $TARGET'
)
env.Depends(vega_sources, api_tmp)
st_vega = env.ConvenienceLibrary(
target = 'st_vega',

View file

@ -10,6 +10,7 @@ env.Append(CPPPATH = [
'#/src/mesa',
'#/src/mesa/main',
'#src/gallium/state_trackers/glx/xlib',
Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
])
env.Append(CPPDEFINES = ['USE_XSHM'])
@ -36,9 +37,6 @@ 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])

View file

@ -114,16 +114,14 @@ env.CodeGenerate(
command = python_cmd + ' $SCRIPT -f $SOURCE -m init_c > $TARGET'
)
headers = []
headers += env.CodeGenerate(
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(
env.CodeGenerate(
target = 'indirect.h',
script = GLAPI + 'gen/glX_proto_send.py',
source = GLAPI + 'gen/gl_API.xml',
@ -131,9 +129,6 @@ headers += env.CodeGenerate(
)
env.Depends(sources, headers)
libgl = env.InstallSharedLibrary(libgl, version=(1, 2))
env.Alias('glx', libgl)

View file

@ -26,6 +26,7 @@ if env['platform'] == 'windows':
env.Append(CPPPATH = [
'#/src/mapi',
'#/src/mesa',
Dir('..'), # src/mapi build path
])
glapi_sources = [
@ -103,6 +104,3 @@ glapi = env.ConvenienceLibrary(
source = glapi_sources,
)
Export('glapi')
env.Depends(glapi_sources, glapi_headers)

View file

@ -7,43 +7,37 @@ from sys import executable as python_cmd
# 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_and_es_API.xml',
env.CodeGenerate(
target = '../../../mesa/main/dispatch.h',
script = 'gl_table.py',
source = 'gl_and_es_API.xml',
command = python_cmd + ' $SCRIPT -m remap_table -f $SOURCE > $TARGET',
)
glapi_headers += env.CodeGenerate(
target = '#src/mapi/glapi/glapitable.h',
script = GLAPI + 'gen/gl_table.py',
source = GLAPI + 'gen/gl_and_es_API.xml',
env.CodeGenerate(
target = '../../../mapi/glapi/glapitable.h',
script = 'gl_table.py',
source = 'gl_and_es_API.xml',
command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
)
glapi_headers += env.CodeGenerate(
target = '#src/mapi/glapi/glapitemp.h',
script = GLAPI + 'gen/gl_apitemp.py',
source = GLAPI + 'gen/gl_and_es_API.xml',
env.CodeGenerate(
target = '../../../mapi/glapi/glapitemp.h',
script = 'gl_apitemp.py',
source = 'gl_and_es_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_and_es_API.xml',
env.CodeGenerate(
target = '../../../mapi/glapi/glprocs.h',
script = 'gl_procs.py',
source = 'gl_and_es_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_and_es_API.xml',
env.CodeGenerate(
target = '../../../mesa/main/remap_helper.h',
script = 'remap_helper.py',
source = 'gl_and_es_API.xml',
command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
)
env.Export('glapi_headers')

View file

@ -7,8 +7,8 @@ Import('*')
env = env.Clone()
vgapi_header = env.CodeGenerate(
target = '#src/mapi/vgapi/vgapi_tmp.h',
vgapi_header, = env.CodeGenerate(
target = 'vgapi_tmp.h',
script = '../mapi/mapi_abi.py',
source = 'vgapi.csv',
command = python_cmd + ' $SCRIPT --printer vgapi --mode lib $SOURCE > $TARGET'
@ -23,6 +23,7 @@ env.Append(CPPDEFINES = [
env.Append(CPPPATH = [
'#/include',
'#/src/mapi',
Dir('..'), # vgapi/vgapi_tmp.h build path
])
mapi_sources = [

View file

@ -14,6 +14,8 @@ env.Append(CPPPATH = [
'#/src/mapi',
'#/src/glsl',
'#/src/mesa',
Dir('../mapi'), # src/mapi build path
Dir('.'), # src/mesa build path
])
enabled_apis = []
@ -290,9 +292,6 @@ program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l')
program_parse = env.CFile('program/program_parse.tab.c',
'program/program_parse.y')
# Make program/program_parse.tab.h reacheable from the include path
env.Append(CPPPATH = [Dir('.').abspath])
program_sources = [
'program/arbprogparse.c',
'program/prog_hash_table.c',
@ -341,19 +340,6 @@ if env['gles']:
enabled_apis += ['ES1', 'ES2']
# generate GLES sources
gles_sources = []
# generate GLES headers
gles_headers = []
env.Depends(gles_sources, gles_headers)
# gles_sources #include gles_headers with full path
env.Append(CPPPATH = [gles_headers[0].dir.up().up()])
mesa_sources += gles_sources
env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis])
@ -366,8 +352,6 @@ get_hash_header = env.CodeGenerate(
' -f $SOURCE > $TARGET'
)
env.Depends(glget_sources, get_hash_header)
#
# Assembly sources
#
@ -453,9 +437,6 @@ env.CodeGenerate(
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):
"""Mesa looks for a git_sha1.h file at compile time in order to display

View file

@ -5,6 +5,7 @@ env = env.Clone()
env.Prepend(CPPPATH = [
'#src/mapi',
'#src/mesa',
Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
])
env.Prepend(LIBS = [
@ -34,5 +35,3 @@ osmesa = env.SharedLibrary(
)
env.Alias('osmesa', osmesa)
env.Depends(sources, glapi_headers)

View file

@ -6,6 +6,7 @@ env.Append(CPPPATH = [
'#/src/mapi',
'#/src/mesa',
'#/src/mesa/main',
Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
])
env.Append(CPPDEFINES = ['USE_XSHM'])
@ -30,9 +31,6 @@ sources = [
'xm_tri.c',
]
# The sources depend on the python-generated GL API files/headers.
env.Depends(sources, glapi_headers)
# libGL.so.1.6
libgl_1_6 = env.SharedLibrary(
target ='GL',