[Mesa-dev] [PATCH v5 13/21] configure.ac, meson: Check for SPIRV-Tools and llvm-spirv
Pierre Moreau
pierre.morrow at free.fr
Sun Mar 25 18:02:22 UTC 2018
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Signed-off-by: Pierre Moreau <pierre.morrow at free.fr>
---
Changes in v5:
* Add a comment saying where to find llvm-spirv (Karol Herbst).
configure.ac | 18 ++++++++++++++++++
meson.build | 8 ++++++++
2 files changed, 26 insertions(+)
diff --git a/configure.ac b/configure.ac
index 99805e0f2b..f6b99cab9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2425,6 +2425,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])
+
+# llvm-spirv is available at https://github.com/pierremoreau/llvm-spirv
+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 041d2bfc70..cc2dbe1fb4 100644
--- a/meson.build
+++ b/meson.build
@@ -640,10 +640,18 @@ if _opencl != 'disabled'
# TODO: alitvec?
dep_clc = dependency('libclc')
+ dep_spirv_tools = dependency('SPIRV-Tools', required : false, version : '>= 2018.0')
+# llvm-spirv is available at https://github.com/pierremoreau/llvm-spirv
+ 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.3
More information about the mesa-dev
mailing list