On 9 May 2016 at 20:33, Rob Clark <robdcl...@gmail.com> wrote:
> From: Jose Fonseca <jfons...@vmware.com>
>
> Signed-off-by: Rob Clark <robcl...@freedesktop.org>
> ---
>  src/compiler/SConscript | 57 
> +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 55 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/SConscript b/src/compiler/SConscript
> index 10c79c4..dde4dfd 100644
> --- a/src/compiler/SConscript
> +++ b/src/compiler/SConscript
> @@ -1,5 +1,7 @@
>  Import('*')
>
> +from sys import executable as python_cmd
> +
>  env = env.Clone()
>
>  env.MSVC2013Compat()
> @@ -11,13 +13,64 @@ env.Prepend(CPPPATH = [
>      '#src/mesa',
>      '#src/gallium/include',
>      '#src/gallium/auxiliary',
> +    '#src/compiler',
> +    '#src/compiler/nir',
> +])
> +
> +
> +# Make generated headers reachable from the include path.
> +env.Append(CPPPATH = [
> +   Dir('nir').abspath
>  ])
>
> -sources = env.ParseSourceList('Makefile.sources', 'LIBCOMPILER_FILES')
> +# nir generated sources
> +
> +nir_builder_opcodes_h = env.CodeGenerate(
> +    target = 'nir/nir_builder_opcodes.h',
> +    script = 'nir/nir_builder_opcodes_h.py',
> +    source = [],
> +    command = python_cmd + ' $SCRIPT > $TARGET'
> +)
> +
> +env.CodeGenerate(
> +    target = 'nir/nir_constant_expressions.c',
> +    script = 'nir/nir_constant_expressions.py',
> +    source = [],
> +    command = python_cmd + ' $SCRIPT > $TARGET'
> +)
> +
> +env.CodeGenerate(
> +    target = 'nir/nir_opcodes.h',
> +    script = 'nir/nir_opcodes_h.py',
> +    source = [],
> +    command = python_cmd + ' $SCRIPT > $TARGET'
> +)
> +
> +env.CodeGenerate(
> +    target = 'nir/nir_opcodes.c',
> +    script = 'nir/nir_opcodes_c.py',
> +    source = [],
> +    command = python_cmd + ' $SCRIPT > $TARGET'
> +)
> +
> +env.CodeGenerate(
> +    target = 'nir/nir_opt_algebraic.c',
> +    script = 'nir/nir_algebraic.py',
> +    source = [],
> +    command = python_cmd + ' $SCRIPT > $TARGET'
> +)
> +
> +# parse Makefile.sources
> +source_lists = env.ParseSourceList('Makefile.sources')
> +
> +nir_sources = []
> +nir_sources += source_lists['LIBCOMPILER_FILES']
> +nir_sources += source_lists['NIR_FILES']
> +nir_sources += source_lists['NIR_GENERATED_FILES']
>
>  compiler = env.ConvenienceLibrary(
>      target = 'compiler',
> -    source = sources
> +    source = nir_sources
>  )
>  Export('compiler')
>
NIR already has scons build support. One just needs to add the static
(convenience in scons speak) library 'nir' into the respective
place(s). Something like the following untested hunk should do it. And
yes, it is a bit nasty looking.

-Emil

diff --git a/src/compiler/SConscript.glsl b/src/compiler/SConscript.glsl
index 43a11d1..4e5133b 100644
--- a/src/compiler/SConscript.glsl
+++ b/src/compiler/SConscript.glsl
@@ -64,6 +64,8 @@ if env['msvc']:
     env.Prepend(CPPPATH = ['#/src/getopt'])
     env.PrependUnique(LIBS = [getopt])

+env.Prepend(LIBS = [nir])
+
 # Copy these files to avoid generation object files into src/mesa/program
 env.Prepend(CPPPATH = ['#src/mesa/main'])
 env.Command('glsl/imports.c', '#src/mesa/main/imports.c',
Copy('$TARGET', '$SOURCE'))
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to