Signed-off-by: Pierre Moreau <pierre.mor...@free.fr>
---

Notes:
    Changes in v4:
    * make SPIRV-Tools and llvm-spirv optional (Francisco Jerez);
    * bump requirement for llvm-spirv to version 0.2

    v3:
    * Bump the required version of SPIRV-Tools to the latest release;
    * Add a dependency on llvm-spirv.

 configure.ac | 17 +++++++++++++++++
 meson.build  |  7 +++++++
 2 files changed, 24 insertions(+)

diff --git a/configure.ac b/configure.ac
index 172da6b443..058f7ccbbd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2413,6 +2413,23 @@ AM_CONDITIONAL(HAVE_CLOVER_ICD, test 
"x$enable_opencl_icd" = xyes)
 AC_SUBST([OPENCL_LIBNAME])
 AC_SUBST([CLANG_RESOURCE_DIR])
 
+AS_IF([test "x$enable_opencl" = xyes], [
+    PKG_CHECK_MODULES([SPIRV_TOOLS], [SPIRV-Tools >= 2018.0],
+                      [have_spirv_tools=yes], [have_spirv_tools=no])])
+AC_SUBST([SPIRV_TOOLS_CFLAGS])
+AC_SUBST([SPIRV_TOOLS_LIBS])
+
+AS_IF([test "x$enable_opencl" = xyes], [
+    PKG_CHECK_MODULES([LLVM_SPIRV], [llvm-spirv >= 0.2],
+                      [have_llvm_spirv=yes], [have_llvm_spirv=no])])
+AC_SUBST([LLVM_SPIRV_CFLAGS])
+AC_SUBST([LLVM_SPIRV_LIBS])
+
+if test "x$have_spirv_tools" = xyes -o \
+        "x$have_llvm_spirv" = xyes; then
+    DEFINES="$DEFINES -DCLOVER_ALLOW_SPIRV"
+fi
+
 dnl
 dnl Gallium configuration
 dnl
diff --git a/meson.build b/meson.build
index 8a17d7f240..90021dd597 100644
--- a/meson.build
+++ b/meson.build
@@ -623,10 +623,17 @@ if _opencl != 'disabled'
 
   # TODO: alitvec?
   dep_clc = dependency('libclc')
+  dep_spirv_tools = dependency('SPIRV-Tools', required : false, version : '>= 
2018.0')
+  dep_llvm_spirv = dependency('llvm-spirv', required : false, version : '>= 
0.2')
+  if dep_spirv_tools.found() and dep_llvm_spirv.found()
+    pre_args += '-DCLOVER_ALLOW_SPIRV'
+  endif
   with_gallium_opencl = true
   with_opencl_icd = _opencl == 'icd'
 else
   dep_clc = []
+  dep_spirv_tools = []
+  dep_llvm_spirv = []
   with_gallium_opencl = false
   with_gallium_icd = false
 endif
-- 
2.16.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to