mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-23 07:19:50 +00:00
meson: Raise minimum version for SPIR-V OpenCL deps (v4)
SPIRV-LLVM-Translator had API-breaking changes during version 0.2.1. Since the new API was being used, a higher version has to be requested. While at it and since SPIRV-LLVM-Translator added a new API to request a specific SPIR-V version as well as allowed SPIR-V extensions, increase the version number to the first including those new features. v2: Require an LLVM version which is compatible with the SPIRV-LLVM-Translator that was found; that requirement was previously implicit and would be ensured when that library was built. Making it explicit will help in cases where multiple versions of LLVM might be installed. v3: fix use of undefined _minimum_llvmspirvlib_version_array v4 (Karol): fix creating the minimum requested version Simplifing the code Signed-off-by: Pierre Moreau <dev@pmoreau.org> Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Serge Martin <edb@sigluy.net> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>
This commit is contained in:
parent
ec6bad140b
commit
6ed87594b1
40
meson.build
40
meson.build
@ -794,23 +794,10 @@ if _opencl != 'disabled'
|
||||
dep_clc = dependency('libclc')
|
||||
with_gallium_opencl = true
|
||||
with_opencl_icd = _opencl == 'icd'
|
||||
|
||||
with_opencl_spirv = get_option('opencl-spirv')
|
||||
if with_opencl_spirv
|
||||
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 : '>= 0.2.1')
|
||||
else
|
||||
dep_spirv_tools = null_dep
|
||||
dep_llvmspirvlib = null_dep
|
||||
endif
|
||||
else
|
||||
dep_clc = null_dep
|
||||
dep_spirv_tools = null_dep
|
||||
dep_llvmspirvlib = null_dep
|
||||
with_gallium_opencl = false
|
||||
with_opencl_icd = false
|
||||
with_opencl_spirv = false
|
||||
endif
|
||||
|
||||
gl_pkgconfig_c_flags = []
|
||||
@ -1456,7 +1443,8 @@ if with_gallium_opencl
|
||||
]
|
||||
endif
|
||||
|
||||
if with_amd_vk or with_gallium_radeonsi
|
||||
with_opencl_spirv = _opencl != 'disabled' and get_option('opencl-spirv')
|
||||
if with_amd_vk or with_gallium_radeonsi or with_opencl_spirv
|
||||
_llvm_version = '>= 8.0.0'
|
||||
elif with_gallium_swr
|
||||
_llvm_version = '>= 6.0.0'
|
||||
@ -1550,6 +1538,30 @@ elif with_gallium_opencl
|
||||
error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
if (with_amd_vk or with_gallium_radeonsi or with_gallium_opencl or
|
||||
(with_gallium_r600 and with_llvm))
|
||||
dep_elf = dependency('libelf', required : false)
|
||||
|
Loading…
Reference in New Issue
Block a user