[Mesa-dev] [PATCH v7 13/21] configure.ac, meson: Check for SPIRV-Tools and llvm-spirv

Pierre Moreau pierre.morrow at free.fr
Wed May 23 21:43:10 UTC 2018


Signed-off-by: Pierre Moreau <pierre.morrow at free.fr>
---
Changes in:
- v7: Replace the llvm-spirv repository by the new official
      SPIRV-LLVM-Translator

 configure.ac | 18 ++++++++++++++++++
 meson.build  |  8 ++++++++
 2 files changed, 26 insertions(+)

diff --git a/configure.ac b/configure.ac
index 62063c1c8a7..2cb28c283ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2439,6 +2439,24 @@ 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])
+
+# LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator
+AS_IF([test "x$enable_opencl" = xyes], [
+    PKG_CHECK_MODULES([LLVMSPIRVLIB], [LLVMSPIRVLib >= 0.2.1],
+                      [have_llvmspirvlib=yes], [have_llvmspirvlib=no])])
+AC_SUBST([LLVMSPIRVLIB_CFLAGS])
+AC_SUBST([LLVMSPIRVLIB_LIBS])
+
+if test "x$have_spirv_tools" = xyes -o \
+        "x$have_llvmspirvlib" = xyes; then
+    DEFINES="$DEFINES -DCLOVER_ALLOW_SPIRV"
+fi
+
 dnl
 dnl Gallium configuration
 dnl
diff --git a/meson.build b/meson.build
index d0cb8961638..3fa24a64676 100644
--- a/meson.build
+++ b/meson.build
@@ -639,10 +639,18 @@ if _opencl != 'disabled'
 
   # TODO: alitvec?
   dep_clc = dependency('libclc')
+  dep_spirv_tools = dependency('SPIRV-Tools', required : false, version : '>= 2018.0')
+# LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator
+  dep_llvmspirvlib = dependency('LLVMSPIRVLib', required : false, version : '>= 0.2.1')
+  if dep_spirv_tools.found() and dep_llvmspirvlib.found()
+    pre_args += '-DCLOVER_ALLOW_SPIRV'
+  endif
   with_gallium_opencl = true
   with_opencl_icd = _opencl == 'icd'
 else
   dep_clc = null_dep
+  dep_spirv_tools = null_dep
+  dep_llvmspirvlib = null_dep
   with_gallium_opencl = false
   with_gallium_icd = false
 endif
-- 
2.17.0



More information about the mesa-dev mailing list