From 71a45e4e0fe48fc0777fe9b41a7311d4b4314f96 Mon Sep 17 00:00:00 2001 From: Valentine Burley Date: Sat, 10 Aug 2024 10:06:31 +0000 Subject: [PATCH] android: Extract version from llvm-project instead of hardcoding it Stop hardcoding LLVM version as 12, instead read it from external/llvm-project. In https://github.com/llvm/llvm-project/commit/81e20472a0c5a4a8edc5ec38dc345d580681af81 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 Tested-by: Alessandro Astone Reviewed-by: Mauro Rossi Signed-off-by: Valentine Burley Part-of: --- android/Android.mk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android/Android.mk b/android/Android.mk index 9999ab9b7d7..be4186e204f 100644 --- a/android/Android.mk +++ b/android/Android.mk @@ -27,6 +27,12 @@ LOCAL_PATH := $(call my-dir) MESA3D_TOP := $(dir $(LOCAL_PATH)) LIBDRM_VERSION = $(shell cat external/libdrm/meson.build | grep -o "\\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)