[Mesa-dev] [PATCH 11/37] scons: build mesa/program as a convinience library

Emil Velikov emil.l.velikov at gmail.com
Wed Nov 6 12:42:38 PST 2013


On 02/11/13 19:00, Emil Velikov wrote:
> * Demangle the large and complex mesa/SConscript.
> * Make use of source file lists in Makefile.sources.
> * Makes the build systems symmetric.
> 
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Planning to drop this patch and revisit the idea of sharing the sources
list at a later stage.

~Emil

> ---
> 
> I've tried squashing mesa & mesa_program into one library,
> but my attempts have been futile. Any ideas ?
> 
> Cheers
> Emil
> ---
>  src/gallium/targets/dri-i915/SConscript   |  1 +
>  src/gallium/targets/dri-swrast/SConscript |  1 +
>  src/gallium/targets/dri-vmwgfx/SConscript |  1 +
>  src/gallium/targets/egl-static/SConscript |  7 ++++++-
>  src/gallium/targets/libgl-gdi/SConscript  | 11 ++++++++++-
>  src/gallium/targets/libgl-xlib/SConscript |  1 +
>  src/mesa/SConscript                       | 31 +------------------------------
>  src/mesa/drivers/osmesa/SConscript        |  1 +
>  src/mesa/drivers/windows/gdi/SConscript   |  1 +
>  src/mesa/drivers/x11/SConscript           |  3 ++-
>  src/mesa/program/SConscript               | 29 +++++++++++++++++++++++++++++
>  11 files changed, 54 insertions(+), 33 deletions(-)
>  create mode 100644 src/mesa/program/SConscript
> 
> diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript
> index 77dca6c..045829e 100644
> --- a/src/gallium/targets/dri-i915/SConscript
> +++ b/src/gallium/targets/dri-i915/SConscript
> @@ -17,6 +17,7 @@ env.Prepend(LIBS = [
>      trace,
>      rbug,
>      mesa,
> +    mesa_program,
>      glsl,
>      gallium,
>      COMMON_DRI_DRM_OBJECTS
> diff --git a/src/gallium/targets/dri-swrast/SConscript b/src/gallium/targets/dri-swrast/SConscript
> index 3a70e5a..37720de 100644
> --- a/src/gallium/targets/dri-swrast/SConscript
> +++ b/src/gallium/targets/dri-swrast/SConscript
> @@ -14,6 +14,7 @@ env.Prepend(LIBS = [
>      trace,
>      rbug,
>      mesa,
> +    mesa_program,
>      glsl,
>      gallium,
>      COMMON_DRI_SW_OBJECTS
> diff --git a/src/gallium/targets/dri-vmwgfx/SConscript b/src/gallium/targets/dri-vmwgfx/SConscript
> index 455ef70..0691d8c 100644
> --- a/src/gallium/targets/dri-vmwgfx/SConscript
> +++ b/src/gallium/targets/dri-vmwgfx/SConscript
> @@ -21,6 +21,7 @@ env.Prepend(LIBS = [
>      svgadrm,
>      svga,
>      mesa,
> +    mesa_program,
>      glsl,
>      gallium,
>      COMMON_DRI_DRM_OBJECTS
> diff --git a/src/gallium/targets/egl-static/SConscript b/src/gallium/targets/egl-static/SConscript
> index b4ccc5b..a8b1e0b 100644
> --- a/src/gallium/targets/egl-static/SConscript
> +++ b/src/gallium/targets/egl-static/SConscript
> @@ -69,7 +69,12 @@ if env['gles']:
>      env.Prepend(LIBPATH = [shared_glapi.dir])
>      # manually add LIBPREFIX on windows
>      glapi_name = 'glapi' if env['platform'] != 'windows' else 'libglapi'
> -    env.Prepend(LIBS = [glapi_name, glsl, mesa])
> +    env.Prepend(LIBS = [
> +        glapi_name,
> +        mesa,
> +        mesa_program,
> +        glsl
> +    ])
>  
>  # OpenVG
>  if True:
> diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript
> index f8393da..5a795db 100644
> --- a/src/gallium/targets/libgl-gdi/SConscript
> +++ b/src/gallium/targets/libgl-gdi/SConscript
> @@ -47,7 +47,16 @@ if env['gles']:
>  opengl32 = env.SharedLibrary(
>      target ='opengl32',
>      source = sources,
> -    LIBS = wgl + ws_gdi + glapi + mesa + drivers + gallium + glsl + env['LIBS'],
> +    env.Prepend(LIBS = [
> +        wgl,
> +        ws_gdi,
> +        glapi,
> +        mesa,
> +        mesa_program,
> +        glsl,
> +        drivers,
> +        gallium,
> +    ])
>  )
>  
>  env.Alias('opengl32', opengl32)
> diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript
> index fc0264c..78472c5 100644
> --- a/src/gallium/targets/libgl-xlib/SConscript
> +++ b/src/gallium/targets/libgl-xlib/SConscript
> @@ -29,6 +29,7 @@ env.Prepend(LIBS = [
>      ws_xlib,
>      glapi,
>      mesa,
> +    mesa_program,
>      glsl,
>      gallium,
>  ])
> diff --git a/src/mesa/SConscript b/src/mesa/SConscript
> index a2bb9f1..2c5a838 100644
> --- a/src/mesa/SConscript
> +++ b/src/mesa/SConscript
> @@ -288,35 +288,6 @@ statetracker_sources = [
>      'state_tracker/st_vdpau.c',
>  ]
>  
> -env.Append(YACCFLAGS = '-d -p "_mesa_program_"')
> -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')
> -
> -program_sources = [
> -    'program/arbprogparse.c',
> -    'program/prog_hash_table.c',
> -    'program/ir_to_mesa.cpp',
> -    'program/program.c',
> -    'program/program_parse_extra.c',
> -    'program/prog_cache.c',
> -    'program/prog_execute.c',
> -    'program/prog_instruction.c',
> -    'program/prog_noise.c',
> -    'program/prog_optimize.c',
> -    'program/prog_opt_constant_fold.c',
> -    'program/prog_parameter.c',
> -    'program/prog_parameter_layout.c',
> -    'program/prog_print.c',
> -    'program/prog_statevars.c',
> -    'program/programopt.c',
> -    'program/sampler.cpp',
> -    'program/symbol_table.c',
> -    'program/string_to_uint_map.cpp',
> -    program_lex,
> -    program_parse[0],
> -]
> -
>  common_driver_sources =	[
>      'drivers/common/driverfuncs.c',
>      'drivers/common/meta.c',
> @@ -326,7 +297,6 @@ mesa_sources = (
>      main_sources +
>      glget_sources +
>      math_sources +
> -    program_sources +
>      vbo_sources +
>      tnl_sources +
>      swrast_sources +
> @@ -464,4 +434,5 @@ env.Alias('mesa', mesa)
>  
>  Export('mesa')
>  
> +SConscript('program/SConscript')
>  SConscript('drivers/SConscript')
> diff --git a/src/mesa/drivers/osmesa/SConscript b/src/mesa/drivers/osmesa/SConscript
> index fb2d98c..477a918 100644
> --- a/src/mesa/drivers/osmesa/SConscript
> +++ b/src/mesa/drivers/osmesa/SConscript
> @@ -11,6 +11,7 @@ env.Prepend(CPPPATH = [
>  env.Prepend(LIBS = [
>      glapi,
>      mesa,
> +    mesa_program,
>      glsl,
>  ])
>  
> diff --git a/src/mesa/drivers/windows/gdi/SConscript b/src/mesa/drivers/windows/gdi/SConscript
> index 10a7eea..0a04422 100644
> --- a/src/mesa/drivers/windows/gdi/SConscript
> +++ b/src/mesa/drivers/windows/gdi/SConscript
> @@ -18,6 +18,7 @@ if not env['gles']:
>  env.Prepend(LIBS = [
>      glapi,
>      mesa,
> +    mesa_program,
>      glsl,
>      'gdi32',
>      'user32',
> diff --git a/src/mesa/drivers/x11/SConscript b/src/mesa/drivers/x11/SConscript
> index b1b854d..630c0fa 100644
> --- a/src/mesa/drivers/x11/SConscript
> +++ b/src/mesa/drivers/x11/SConscript
> @@ -16,8 +16,9 @@ env.Prepend(LIBPATH = env['X11_LIBPATH'])
>  
>  env.Prepend(LIBS = [
>      glapi,
> -    glsl,
>      mesa,
> +    mesa_program,
> +    glsl,
>  ])
>  
>  sources = [
> diff --git a/src/mesa/program/SConscript b/src/mesa/program/SConscript
> new file mode 100644
> index 0000000..3b1dacf
> --- /dev/null
> +++ b/src/mesa/program/SConscript
> @@ -0,0 +1,29 @@
> +Import('*')
> +
> +env = env.Clone()
> +
> +env.Append(CPPPATH = [
> +    '#/src/mapi',
> +    '#/src/glsl',
> +    '#/src/mesa',
> +    Dir('..'), # src/mesa build path
> +])
> +
> +env.Append(YACCFLAGS = '-d -p "_mesa_program_"')
> +program_lex = env.CFile('lex.yy.c', 'program_lexer.l')
> +program_parse = env.CFile('program_parse.tab.c', 'program_parse.y')
> +
> +program_sources = [
> +    program_lex,
> +    program_parse[0],
> +]
> +program_sources.append(env.ParseSourceList('Makefile.sources', 'PROGRAM_FILES'))
> +
> +mesa_program = env.ConvenienceLibrary(
> +    target = 'mesa_program',
> +    source = program_sources,
> +)
> +
> +env.Alias('mesa_program', mesa_program)
> +
> +Export('mesa_program')
> 



More information about the mesa-dev mailing list