+if with_opencl_spirv
+ chosen_llvm_version_array = dep_llvm.version().split('.')
+ chosen_llvm_version_major = chosen_llvm_version_array[0].to_int()
+ chosen_llvm_version_minor = chosen_llvm_version_array[1].to_int()
+
+ # Require an SPIRV-LLVM-Translator version compatible with the chosen LLVM
+ # one.
+ _llvmspirvlib_version = [
+ # This first version check is still needed as maybe LLVM 8.0 was picked but
+ # we do not want to accept SPIRV-LLVM-Translator 8.0.0.1 as that version does
+ # not have the required API and those are only available starting from
+ # 8.0.1.3.
+ '>= 8.0.1.3',
+ '>= @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor),
+ '< @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor + 1) ]
+
+ dep_spirv_tools = dependency('SPIRV-Tools', required : true, version : '>= 2018.0')
+ # LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator
+ dep_llvmspirvlib = dependency('LLVMSPIRVLib', required : true, version : _llvmspirvlib_version)
+else
+ dep_spirv_tools = null_dep
+ dep_llvmspirvlib = null_dep
+endif
+