spirv: Fix building with SCons
authorNeil Roberts <nroberts@igalia.com>
Fri, 30 Mar 2018 15:12:00 +0000 (09:12 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 30 Mar 2018 20:33:03 +0000 (14:33 -0600)
The SCons build broke with commit ba975140d3c9 because a SPIR-V
function is called from Mesa main. This adds a convenience library for
SPIR-V and adds it to everything that was including nir. It also adds
both nir and spirv to drivers/x11/SConscript.

Also add nir/spirv modules to osmesa and libgl-gdi targets. (Brian Paul)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105817
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
src/compiler/Makefile.nir.am
src/compiler/SConscript
src/compiler/SConscript.spirv [new file with mode: 0644]
src/gallium/targets/dri/SConscript
src/gallium/targets/haiku-softpipe/SConscript
src/gallium/targets/libgl-gdi/SConscript
src/gallium/targets/libgl-xlib/SConscript
src/gallium/targets/osmesa/SConscript
src/mesa/drivers/osmesa/SConscript
src/mesa/drivers/x11/SConscript

index 32e4145b70f2ad197ee566777f5c9b04c5138e83..27dc129e57bf00cdafa7c5f2153bd43b50c4d957 100644 (file)
@@ -100,4 +100,5 @@ EXTRA_DIST += \
        nir/nir_opt_algebraic.py                        \
        nir/tests \
        nir/README \
-       SConscript.nir
+       SConscript.nir \
+       SConstript.spirv
index 44509a9a95b261a07dd9aeb98319d1b158619212..0a0c0737422da3aeda537a48e4383911cc02d5b8 100644 (file)
@@ -27,3 +27,4 @@ Export('compiler')
 
 SConscript('SConscript.glsl')
 SConscript('SConscript.nir')
+SConscript('SConscript.spirv')
diff --git a/src/compiler/SConscript.spirv b/src/compiler/SConscript.spirv
new file mode 100644 (file)
index 0000000..4941088
--- /dev/null
@@ -0,0 +1,54 @@
+import common
+
+Import('*')
+
+from sys import executable as python_cmd
+
+env = env.Clone()
+
+env.MSVC2013Compat()
+
+env.Prepend(CPPPATH = [
+    '#include',
+    '#src',
+    '#src/mapi',
+    '#src/mesa',
+    '#src/gallium/include',
+    '#src/gallium/auxiliary',
+    '#src/compiler/nir',
+    '#src/compiler/spirv',
+])
+
+# Make generated headers reachable from the include path.
+env.Prepend(CPPPATH = [Dir('.').abspath, Dir('nir').abspath])
+env.Prepend(CPPPATH = [Dir('.').abspath, Dir('spirv').abspath])
+
+# spirv generated sources
+
+env.CodeGenerate(
+    target = 'spirv/spirv_info.c',
+    script = 'spirv/spirv_info_c.py',
+    source = ['spirv/spirv.core.grammar.json'],
+    command = python_cmd + ' $SCRIPT $SOURCE $TARGET'
+)
+
+env.CodeGenerate(
+    target = 'spirv/vtn_gather_types.c',
+    script = 'spirv/vtn_gather_types_c.py',
+    source = ['spirv/spirv.core.grammar.json'],
+    command = python_cmd + ' $SCRIPT $SOURCE $TARGET'
+)
+
+# parse Makefile.sources
+source_lists = env.ParseSourceList('Makefile.sources')
+
+spirv_sources = source_lists['SPIRV_FILES']
+spirv_sources += source_lists['SPIRV_GENERATED_FILES']
+
+spirv = env.ConvenienceLibrary(
+    target = 'spirv',
+    source = spirv_sources,
+)
+
+env.Alias('spirv', spirv)
+Export('spirv')
index f5c2818d04f3c6773dd63677da7d0508b6c28149..ff6ce3bf4e0ae0f90494b3ea2094859987920d5a 100644 (file)
@@ -45,6 +45,7 @@ env.Prepend(LIBS = [
     mesa,
     glsl,
     nir,
+    spirv,
     gallium,
     megadrivers_stub,
     dri_common,
index f80c167d83bb2ac70b61f06e2c2bc9dd57d08dde..89792fba1327fb4e00b9943f854206cf7ee7a896 100644 (file)
@@ -10,6 +10,7 @@ env.Prepend(LIBS = [
     mesa,
     glsl,
     nir,
+    spirv,
     gallium
 ])
 
index d3251caec57182ce7b3b3aba27fc7e2d30d73893..b5ba0fabcd06f536e9514ee7f6fc8893865b7279 100644 (file)
@@ -18,7 +18,11 @@ env.Append(LIBS = [
     'ws2_32',
 ])
 
-env.Prepend(LIBS = [mesautil])
+env.Prepend(LIBS = [
+    mesautil,
+    nir,
+    spirv
+])
 
 sources = ['libgl_gdi.c']
 drivers = []
index a81ac79325156f5011b43c1547a103d042eb551d..b94ef350b162284769e192328ea50f4c192c2c7a 100644 (file)
@@ -33,6 +33,7 @@ env.Prepend(LIBS = [
     mesa,
     glsl,
     nir,
+    spirv,
     gallium,
 ])
 
index 7be1b48c0b2b278a283a706a1e7ee07ec8678cdb..ccf7d5170c454d588a759561f0894248f4c257da 100644 (file)
@@ -18,6 +18,7 @@ env.Prepend(LIBS = [
     trace,
     glsl,
     nir,
+    spirv,
     mesautil,
     softpipe
 ])
index 9391dc32827b106607874b528088456c4fe610dd..064f3da5da9492fc6dd9ac3584d026942a6b67e0 100644 (file)
@@ -15,6 +15,8 @@ env.Prepend(LIBS = [
     glapi,
     compiler,
     mesa,
+    spirv,
+    nir,
     glsl,
 ])
 
index 59c8df4b3c235579c0aa559940e9ccd42180afa6..b097dcc59007ccb00f6ace082d1be1eaa6f26af5 100644 (file)
@@ -21,6 +21,8 @@ env.Prepend(LIBS = [
     compiler,
     glsl,
     mesa,
+    spirv,
+    nir,
 ])
 
 sources = [