From 601498ae73e654c2de997ea75075613a694d604d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 1 Nov 2010 13:30:22 +0000 Subject: scons: Revamp how to specify targets to build. Use scons target and dependency system instead of ad-hoc options. Now is simply a matter of naming what to build. For example: scons libgl-xlib scons libgl-gdi scons graw-progs scons llvmpipe and so on. And there is also the possibility of scepcified subdirs, e.g. scons src/gallium/drivers If nothing is specified then everything will be build. There might be some rough corners over the next days. Please bare with me. --- src/gallium/state_trackers/egl/SConscript | 53 +++++++------ src/gallium/state_trackers/glx/xlib/SConscript | 38 ++++----- src/gallium/state_trackers/python/SConscript | 106 +++++++++++++------------ src/gallium/state_trackers/vega/SConscript | 81 ++++++++++--------- src/gallium/state_trackers/xorg/SConscript | 63 +++++++-------- 5 files changed, 173 insertions(+), 168 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/egl/SConscript b/src/gallium/state_trackers/egl/SConscript index efcce25e31..8d34e47df0 100644 --- a/src/gallium/state_trackers/egl/SConscript +++ b/src/gallium/state_trackers/egl/SConscript @@ -3,34 +3,35 @@ Import('*') -if 'egl' in env['statetrackers']: +if env['platform'] != 'windows': + Return() - env = env.Clone() +env = env.Clone() - env.Append(CPPPATH = [ - '#/src/egl/main', - '#/src/gallium/winsys/sw', - '.', - ]) - env.Append(CPPDEFINES = [ - 'HAVE_GDI_BACKEND', - ]) +env.Append(CPPPATH = [ + '#/src/egl/main', + '#/src/gallium/winsys/sw', + '.', +]) +env.Append(CPPDEFINES = [ + 'HAVE_GDI_BACKEND', +]) - common_sources = [ - 'common/egl_g3d.c', - 'common/egl_g3d_api.c', - 'common/egl_g3d_image.c', - 'common/egl_g3d_st.c', - 'common/egl_g3d_sync.c', - 'common/native_helper.c', - ] +common_sources = [ + 'common/egl_g3d.c', + 'common/egl_g3d_api.c', + 'common/egl_g3d_image.c', + 'common/egl_g3d_st.c', + 'common/egl_g3d_sync.c', + 'common/native_helper.c', +] - gdi_sources = common_sources + [ - 'gdi/native_gdi.c', - ] +gdi_sources = common_sources + [ + 'gdi/native_gdi.c', +] - st_egl_gdi = env.ConvenienceLibrary( - target = 'st_egl_gdi', - source = gdi_sources, - ) - Export('st_egl_gdi') +st_egl_gdi = env.ConvenienceLibrary( + target = 'st_egl_gdi', + source = gdi_sources, +) +Export('st_egl_gdi') diff --git a/src/gallium/state_trackers/glx/xlib/SConscript b/src/gallium/state_trackers/glx/xlib/SConscript index 9df351a276..775000eacc 100644 --- a/src/gallium/state_trackers/glx/xlib/SConscript +++ b/src/gallium/state_trackers/glx/xlib/SConscript @@ -3,25 +3,25 @@ Import('*') -if env['platform'] == 'linux' \ - and 'mesa' in env['statetrackers']: +if not env['x11']: + Return() - env = env.Clone() +env = env.Clone() - env.Append(CPPPATH = [ - '#/src/mapi', - '#/src/mesa', - '#/src/mesa/main', - ]) +env.Append(CPPPATH = [ + '#/src/mapi', + '#/src/mesa', + '#/src/mesa/main', +]) - st_xlib = env.ConvenienceLibrary( - target = 'st_xlib', - source = [ - 'glx_api.c', - 'glx_getproc.c', - 'glx_usefont.c', - 'xm_api.c', - 'xm_st.c', - ] - ) - Export('st_xlib') +st_xlib = env.ConvenienceLibrary( +target = 'st_xlib', +source = [ + 'glx_api.c', + 'glx_getproc.c', + 'glx_usefont.c', + 'xm_api.c', + 'xm_st.c', + ] +) +Export('st_xlib') diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript index aadeaa0a35..5cb7960f9b 100644 --- a/src/gallium/state_trackers/python/SConscript +++ b/src/gallium/state_trackers/python/SConscript @@ -3,57 +3,61 @@ import os.path Import('*') -if 'python' in env['statetrackers']: - - env = env.Clone() - - env.Tool('python') - - env.Tool('swig') - env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe']) - env.Append(SWIGFLAGS = ['-python', '-keyword']) - - env.Append(CPPPATH = '.') - - if env['platform'] == 'windows': - env.Append(LIBS = [ - 'opengl32', - 'gdi32', - 'user32', - 'kernel32', - 'ws2_32', - ]) - else: - env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY']) - env.Append(LIBS = [ - 'GL', - 'X11', - ]) - - sources = [ - 'gallium.i', - 'st_device.c', - 'st_sample.c', - 'st_hardpipe_winsys.c', - 'st_softpipe_winsys.c', - ] - - env.Prepend(LIBS = [ - ws_null, - trace, - gallium, - ]) +if env['toolchain'] == 'crossmingw': + # Cross-compilation not supported + Return() + +env = env.Clone() + +env.Tool('python') - if env['llvm']: - env.Append(CPPDEFINES = ['HAVE_LLVMPIPE']) - env.Prepend(LIBS = [llvmpipe]) - if True: - env.Append(CPPDEFINES = ['HAVE_SOFTPIPE']) - env.Prepend(LIBS = [softpipe]) +env.Tool('swig') +env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe']) +env.Append(SWIGFLAGS = ['-python', '-keyword']) - env['no_import_lib'] = 1 +env.Append(CPPPATH = '.') + +if env['platform'] == 'windows': + env.Append(LIBS = [ + 'opengl32', + 'gdi32', + 'user32', + 'kernel32', + 'ws2_32', + ]) +else: + env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY']) + env.Append(LIBS = [ + 'GL', + 'X11', + ]) - env.SharedLibrary( - target = '_gallium', - source = sources, - ) +sources = [ + 'gallium.i', + 'st_device.c', + 'st_sample.c', + 'st_hardpipe_winsys.c', + 'st_softpipe_winsys.c', +] + +env.Prepend(LIBS = [ + ws_null, + trace, + gallium, +]) + +if env['llvm']: + env.Append(CPPDEFINES = ['HAVE_LLVMPIPE']) + env.Prepend(LIBS = [llvmpipe]) +if True: + env.Append(CPPDEFINES = ['HAVE_SOFTPIPE']) + env.Prepend(LIBS = [softpipe]) + +env['no_import_lib'] = 1 + +pyst = env.SharedLibrary( + target = '_gallium', + source = sources, +) + +env.Alias('python', pyst) diff --git a/src/gallium/state_trackers/vega/SConscript b/src/gallium/state_trackers/vega/SConscript index 548053eb64..4c6e18f42b 100644 --- a/src/gallium/state_trackers/vega/SConscript +++ b/src/gallium/state_trackers/vega/SConscript @@ -3,49 +3,48 @@ Import('*') -if 'egl' in env['statetrackers']: +env = env.Clone() - env = env.Clone() +env.Append(CPPPATH = [ + '#/src/mapi', +]) - env.Append(CPPPATH = [ - '#/src/mapi', - ]) +vega_sources = [ + 'api.c', + 'api_context.c', + 'api_filters.c', + 'api_images.c', + 'api_masks.c', + 'api_misc.c', + 'api_paint.c', + 'api_params.c', + 'api_path.c', + 'api_text.c', + 'api_transform.c', + 'vgu.c', + 'vg_context.c', + 'vg_manager.c', + 'vg_state.c', + 'vg_translate.c', + 'polygon.c', + 'bezier.c', + 'path.c', + 'paint.c', + 'arc.c', + 'image.c', + 'renderer.c', + 'stroker.c', + 'mask.c', + 'shader.c', + 'shaders_cache.c', +] - vega_sources = [ - 'api.c', - 'api_context.c', - 'api_filters.c', - 'api_images.c', - 'api_masks.c', - 'api_misc.c', - 'api_paint.c', - 'api_params.c', - 'api_path.c', - 'api_text.c', - 'api_transform.c', - 'vgu.c', - 'vg_context.c', - 'vg_manager.c', - 'vg_state.c', - 'vg_translate.c', - 'polygon.c', - 'bezier.c', - 'path.c', - 'paint.c', - 'arc.c', - 'image.c', - 'renderer.c', - 'stroker.c', - 'mask.c', - 'shader.c', - 'shaders_cache.c', - ] +# vgapi_header must be generated first +env.Depends(vega_sources, vgapi_header) - # vgapi_header must be generated first - env.Depends(vega_sources, vgapi_header) +st_vega = env.ConvenienceLibrary( + target = 'st_vega', + source = vega_sources, +) - st_vega = env.ConvenienceLibrary( - target = 'st_vega', - source = vega_sources, - ) - Export('st_vega') +Export('st_vega') diff --git a/src/gallium/state_trackers/xorg/SConscript b/src/gallium/state_trackers/xorg/SConscript index 0b598dab6e..ffaa1c2684 100644 --- a/src/gallium/state_trackers/xorg/SConscript +++ b/src/gallium/state_trackers/xorg/SConscript @@ -3,34 +3,35 @@ Import('*') -if 'xorg' in env['statetrackers']: - - env = env.Clone() - - env.Append(CPPPATH = [ - '#/src/mesa', - ]) - - env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server') - - conf = env.Configure() - - if conf.CheckHeader('X11/extensions/dpmsconst.h'): - env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')]) - - conf.Finish() - - st_xorg = env.ConvenienceLibrary( - target = 'st_xorg', - source = [ 'xorg_composite.c', - 'xorg_crtc.c', - 'xorg_dri2.c', - 'xorg_driver.c', - 'xorg_exa.c', - 'xorg_exa_tgsi.c', - 'xorg_output.c', - 'xorg_renderer.c', - 'xorg_xv.c', - ] - ) - Export('st_xorg') +if not env['x11'] or not env['dri'] or not env['xorg']: + Return() + +env = env.Clone() + +env.Append(CPPPATH = [ + '#/src/mesa', +]) + +env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server') + +conf = env.Configure() + +if conf.CheckHeader('X11/extensions/dpmsconst.h'): + env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')]) + +conf.Finish() + +st_xorg = env.ConvenienceLibrary( +target = 'st_xorg', +source = [ 'xorg_composite.c', + 'xorg_crtc.c', + 'xorg_dri2.c', + 'xorg_driver.c', + 'xorg_exa.c', + 'xorg_exa_tgsi.c', + 'xorg_output.c', + 'xorg_renderer.c', + 'xorg_xv.c', + ] +) +Export('st_xorg') -- cgit v1.2.3