[Mesa-dev] [PATCH] scons: Build NIR.

Rob Clark robdclark at gmail.com
Sat Apr 9 23:16:45 UTC 2016


From: Jose Fonseca <jfonseca at vmware.com>

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
 src/compiler/SConscript | 57 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 2 deletions(-)

diff --git a/src/compiler/SConscript b/src/compiler/SConscript
index 8d71b82..8a0823e 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')
 
-- 
2.5.5



More information about the mesa-dev mailing list