[Mesa-dev] [PATCH] scons: Build nir/glsl_types.cpp once.

Brian Paul brianp at vmware.com
Mon Oct 19 07:12:23 PDT 2015


On 10/19/2015 08:01 AM, Jose Fonseca wrote:
> Undoes early hacks, and ensures nir/glsl_types.cpp is built once, and
> only once.
>
> The root problem is that SCons doesn't know about NIR nor any source
> file in the NIR_FILES source list.
>
> Tested with libgl-gdi and libgl-xlib scons targets.
> ---
>   src/gallium/targets/libgl-gdi/SConscript           | 10 +---------
>   src/gallium/targets/libgl-gdi/glsl_types_hack.cpp  |  3 ---
>   src/gallium/targets/libgl-xlib/SConscript          |  3 ---
>   src/gallium/targets/libgl-xlib/glsl_types_hack.cpp |  3 ---
>   src/gallium/targets/osmesa/SConscript              |  7 +------
>   src/gallium/targets/osmesa/glsl_types_hack.cpp     |  3 ---
>   src/glsl/SConscript                                |  7 ++++++-
>   src/mesa/drivers/x11/SConscript                    |  1 -
>   8 files changed, 8 insertions(+), 29 deletions(-)
>   delete mode 100644 src/gallium/targets/libgl-gdi/glsl_types_hack.cpp
>   delete mode 100644 src/gallium/targets/libgl-xlib/glsl_types_hack.cpp
>   delete mode 100644 src/gallium/targets/osmesa/glsl_types_hack.cpp
>
> diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript
> index eb777a8..594f34d 100644
> --- a/src/gallium/targets/libgl-gdi/SConscript
> +++ b/src/gallium/targets/libgl-gdi/SConscript
> @@ -7,10 +7,6 @@ env = env.Clone()
>
>   env.Append(CPPPATH = [
>       '#src',
> -    '#src/mesa',
> -    '#src/mapi',
> -    '#src/glsl',
> -    '#src/glsl/nir',
>       '#src/gallium/state_trackers/wgl',
>       '#src/gallium/winsys/sw',
>   ])
> @@ -24,11 +20,7 @@ env.Append(LIBS = [
>
>   env.Prepend(LIBS = [mesautil])
>
> -sources = [
> -    'libgl_gdi.c',
> -    'glsl_types_hack.cpp'
> -]
> -
> +sources = ['libgl_gdi.c']
>   drivers = []
>
>   if True:
> diff --git a/src/gallium/targets/libgl-gdi/glsl_types_hack.cpp b/src/gallium/targets/libgl-gdi/glsl_types_hack.cpp
> deleted file mode 100644
> index 5c042f2..0000000
> --- a/src/gallium/targets/libgl-gdi/glsl_types_hack.cpp
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -/* errrg scons.. otherwise "scons: *** Two environments with different actions were specified for the same target: $mesa/build/linux-x86_64-debug/glsl/nir/glsl_types.os" */
> -#include "glsl_types.cpp"
> -
> diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript
> index fedc522..df5a220 100644
> --- a/src/gallium/targets/libgl-xlib/SConscript
> +++ b/src/gallium/targets/libgl-xlib/SConscript
> @@ -6,8 +6,6 @@ Import('*')
>   env = env.Clone()
>
>   env.Append(CPPPATH = [
> -    '#/src/glsl',
> -    '#/src/glsl/nir',
>       '#/src/mapi',
>       '#/src/mesa',
>       '#/src/mesa/main',
> @@ -38,7 +36,6 @@ env.Prepend(LIBS = [
>
>   sources = [
>       'xlib.c',
> -    'glsl_types_hack.cpp',
>   ]
>
>   if True:
> diff --git a/src/gallium/targets/libgl-xlib/glsl_types_hack.cpp b/src/gallium/targets/libgl-xlib/glsl_types_hack.cpp
> deleted file mode 100644
> index 5c042f2..0000000
> --- a/src/gallium/targets/libgl-xlib/glsl_types_hack.cpp
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -/* errrg scons.. otherwise "scons: *** Two environments with different actions were specified for the same target: $mesa/build/linux-x86_64-debug/glsl/nir/glsl_types.os" */
> -#include "glsl_types.cpp"
> -
> diff --git a/src/gallium/targets/osmesa/SConscript b/src/gallium/targets/osmesa/SConscript
> index 78930a9..4a9115b 100644
> --- a/src/gallium/targets/osmesa/SConscript
> +++ b/src/gallium/targets/osmesa/SConscript
> @@ -5,8 +5,6 @@ env = env.Clone()
>   env.Prepend(CPPPATH = [
>       '#src/mapi',
>       '#src/mesa',
> -    '#src/glsl',
> -    '#src/glsl/nir',
>       #Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
>   ])
>
> @@ -24,10 +22,7 @@ env.Prepend(LIBS = [
>
>   env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_SOFTPIPE'])
>
> -sources = [
> -    'target.c',
> -    'glsl_types_hack.cpp'
> -]
> +sources = ['target.c']
>
>   if env['llvm']:
>       env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
> diff --git a/src/gallium/targets/osmesa/glsl_types_hack.cpp b/src/gallium/targets/osmesa/glsl_types_hack.cpp
> deleted file mode 100644
> index 5c042f2..0000000
> --- a/src/gallium/targets/osmesa/glsl_types_hack.cpp
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -/* errrg scons.. otherwise "scons: *** Two environments with different actions were specified for the same target: $mesa/build/linux-x86_64-debug/glsl/nir/glsl_types.os" */
> -#include "glsl_types.cpp"
> -
> diff --git a/src/glsl/SConscript b/src/glsl/SConscript
> index 927cbdc..70bf5b0 100644
> --- a/src/glsl/SConscript
> +++ b/src/glsl/SConscript
> @@ -61,6 +61,12 @@ source_lists = env.ParseSourceList('Makefile.sources')
>   for l in ('LIBGLCPP_FILES', 'LIBGLSL_FILES'):
>       glsl_sources += source_lists[l]
>
> +# add nir/glsl_types.cpp manually, because SCons still doesn't know about NIR.
> +# XXX: Remove this once we build NIR and NIR_FILES.
> +glsl_sources += [
> +    'nir/glsl_types.cpp',
> +]
> +
>   if env['msvc']:
>       env.Prepend(CPPPATH = ['#/src/getopt'])
>       env.PrependUnique(LIBS = [getopt])
> @@ -81,7 +87,6 @@ mesa_objs = env.StaticObject([
>       'prog_hash_table.c',
>       'symbol_table.c',
>       'dummy_errors.c',
> -    'nir/glsl_types.cpp',
>   ])
>
>   compiler_objs += mesa_objs
> diff --git a/src/mesa/drivers/x11/SConscript b/src/mesa/drivers/x11/SConscript
> index aa1e73a..cd5cccd 100644
> --- a/src/mesa/drivers/x11/SConscript
> +++ b/src/mesa/drivers/x11/SConscript
> @@ -33,7 +33,6 @@ sources = [
>   	'xm_dd.c',
>   	'xm_line.c',
>   	'xm_tri.c',
> -	'../../../glsl/nir/glsl_types.cpp',
>   ]
>
>   # Disallow undefined symbols
>

Looks good to me.  Thanks for cleaning this up, Jose!

Reviewed-by: Brian Paul <brianp at vmware.com>




More information about the mesa-dev mailing list