android: Extract version from llvm-project instead of hardcoding it

Stop hardcoding LLVM version as 12, instead read it from external/llvm-project.

In 81e20472a0
the location of the LLVM_VERSION_MAJOR definition was moved. This patch accounts for that
by extracting the version from the new location if it exists. If the new file is not present,
it falls back to the old location.

Backport-to: 24.2
Tested-by: Antonio Ospite <antonio.ospite@collabora.com>
Tested-by: Alessandro Astone <alessandro.astone@canonical.com>
Reviewed-by: Mauro Rossi <issor.oruam@gmail.com>
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30598>
This commit is contained in:
Valentine Burley 2024-08-10 10:06:31 +00:00
parent 6a84d5439d
commit 71a45e4e0f

View File

@ -27,6 +27,12 @@ LOCAL_PATH := $(call my-dir)
MESA3D_TOP := $(dir $(LOCAL_PATH))
LIBDRM_VERSION = $(shell cat external/libdrm/meson.build | grep -o "\<version\>\s*:\s*'\w*\.\w*\.\w*'" | grep -o "\w*\.\w*\.\w*" | head -1)
LLVM_VERSION_MAJOR = $(shell \
if [ -f external/llvm-project/cmake/Modules/LLVMVersion.cmake ]; then \
grep 'set.LLVM_VERSION_MAJOR ' external/llvm-project/cmake/Modules/LLVMVersion.cmake | grep -o '[0-9]\+'; \
else \
grep 'set.LLVM_VERSION_MAJOR ' external/llvm-project/llvm/CMakeLists.txt | grep -o '[0-9]\+'; \
fi)
MESA_VK_LIB_SUFFIX_amd := radeon
MESA_VK_LIB_SUFFIX_intel := intel
@ -86,8 +92,8 @@ MESON_GEN_PKGCONFIGS += DirectX-Headers
endif
ifneq ($(MESON_GEN_LLVM_STUB),)
MESON_LLVM_VERSION := 12.0.0
LOCAL_SHARED_LIBRARIES += libLLVM12
MESON_LLVM_VERSION := $(LLVM_VERSION_MAJOR).0.0
LOCAL_SHARED_LIBRARIES += libLLVM$(LLVM_VERSION_MAJOR)
endif
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 30; echo $$?), 0)