Currently, building with "mmma external/mesa3d" which builds all targets
and dependencies is broken for targets that require LLVM. This is due to
the build settings depending on MESA_ENABLE_LLVM. Instead of using a
conditional in the global Android.common.mk, make all the components that
need LLVM explicitly include the necessary build settings.

GALLIVM_CPP_SOURCES doesn't exist anymore, so remove that as well.

Signed-off-by: Rob Herring <r...@kernel.org>
---
 Android.common.mk                        |  9 ---------
 Android.mk                               | 13 +++++++++++++
 src/amd/Android.common.mk                |  3 ++-
 src/gallium/Android.common.mk            |  6 ------
 src/gallium/auxiliary/Android.mk         |  8 ++++----
 src/gallium/drivers/radeon/Android.mk    |  7 ++++---
 src/gallium/drivers/radeonsi/Android.mk  |  2 ++
 src/gallium/winsys/amdgpu/drm/Android.mk |  2 ++
 8 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index a7b78bb910fc..5d70ea6f2c07 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -83,15 +83,6 @@ LOCAL_CFLAGS += \
 endif
 endif
 
-ifeq ($(MESA_ENABLE_LLVM),true)
-  ifeq ($(MESA_ANDROID_MAJOR_VERSION),6)
-    LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_PATCH=0
-  endif
-  ifeq ($(MESA_ANDROID_MAJOR_VERSION),7)
-    LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0
-  endif
-endif
-
 ifneq ($(LOCAL_IS_HOST_MODULE),true)
 # add libdrm if there are hardware drivers
 LOCAL_CFLAGS += -DHAVE_LIBDRM
diff --git a/Android.mk b/Android.mk
index e2d792d8e4c4..600b37a52e62 100644
--- a/Android.mk
+++ b/Android.mk
@@ -82,6 +82,19 @@ ifneq ($(filter true, $(HAVE_GALLIUM_RADEONSI)),)
 MESA_ENABLE_LLVM := true
 endif
 
+define mesa-build-with-llvm
+  $(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5), \
+    $(warning Unsupported LLVM version in Android 
$(MESA_ANDROID_MAJOR_VERSION)),) \
+  $(if $(filter 6,$(MESA_ANDROID_MAJOR_VERSION)), \
+    $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_PATCH=0) \
+    $(eval LOCAL_STATIC_LIBRARIES += libLLVMCore) \
+    $(eval LOCAL_C_INCLUDES += external/llvm/include 
external/llvm/device/include),) \
+  $(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
+    $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0) \
+    $(eval LOCAL_STATIC_LIBRARIES += libLLVMCore) \
+    $(eval LOCAL_C_INCLUDES += external/llvm/include 
external/llvm/device/include),)
+endef
+
 # add subdirectories
 SUBDIRS := \
        src/gbm \
diff --git a/src/amd/Android.common.mk b/src/amd/Android.common.mk
index 18ace02b90c1..62d4df15118a 100644
--- a/src/amd/Android.common.mk
+++ b/src/amd/Android.common.mk
@@ -61,11 +61,12 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
        $(LOCAL_PATH)/common
 
 LOCAL_STATIC_LIBRARIES := \
-       libLLVMCore \
        libmesa_nir
 
 LOCAL_WHOLE_STATIC_LIBRARIES := \
        libelf
 
+$(call mesa-build-with-llvm)
+
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/Android.common.mk b/src/gallium/Android.common.mk
index b2eb95bcd646..782510ff0f47 100644
--- a/src/gallium/Android.common.mk
+++ b/src/gallium/Android.common.mk
@@ -29,10 +29,4 @@ LOCAL_C_INCLUDES += \
        $(GALLIUM_TOP)/winsys \
        $(GALLIUM_TOP)/drivers
 
-ifeq ($(MESA_ENABLE_LLVM),true)
-LOCAL_C_INCLUDES += \
-       external/llvm/include \
-       external/llvm/device/include
-endif
-
 include $(MESA_COMMON_MK)
diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index e8628e43744a..10a5f474b3bf 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -38,12 +38,12 @@ LOCAL_C_INCLUDES := \
 
 ifeq ($(MESA_ENABLE_LLVM),true)
 LOCAL_SRC_FILES += \
-       $(GALLIVM_SOURCES) \
-       $(GALLIVM_CPP_SOURCES)
-LOCAL_STATIC_LIBRARIES += libLLVMCore
-LOCAL_CPPFLAGS := -std=c++11
+       $(GALLIVM_SOURCES)
+$(call mesa-build-with-llvm)
 endif
 
+LOCAL_CPPFLAGS += -std=c++11
+
 # We need libmesa_nir to get NIR's generated include directories.
 LOCAL_MODULE := libmesa_gallium
 LOCAL_STATIC_LIBRARIES += libmesa_nir
diff --git a/src/gallium/drivers/radeon/Android.mk 
b/src/gallium/drivers/radeon/Android.mk
index 64815f6f0847..eb1a32182bb0 100644
--- a/src/gallium/drivers/radeon/Android.mk
+++ b/src/gallium/drivers/radeon/Android.mk
@@ -30,13 +30,14 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
+LOCAL_SHARED_LIBRARIES := libdrm_radeon libLLVM
+LOCAL_MODULE := libmesa_pipe_radeon
+
 ifeq ($(MESA_ENABLE_LLVM),true)
 LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU   # instructs LLVM to declare 
LLVMInitializeAMDGPU* functions
+$(call mesa-build-with-llvm)
 endif
 
-LOCAL_SHARED_LIBRARIES := libdrm_radeon libLLVM
-LOCAL_MODULE := libmesa_pipe_radeon
-
 include $(GALLIUM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
 
diff --git a/src/gallium/drivers/radeonsi/Android.mk 
b/src/gallium/drivers/radeonsi/Android.mk
index cd768751518c..5676c55983fc 100644
--- a/src/gallium/drivers/radeonsi/Android.mk
+++ b/src/gallium/drivers/radeonsi/Android.mk
@@ -43,6 +43,8 @@ LOCAL_STATIC_LIBRARIES := libmesa_amd_common
 LOCAL_SHARED_LIBRARIES := libdrm_radeon libLLVM
 LOCAL_MODULE := libmesa_pipe_radeonsi
 
+$(call mesa-build-with-llvm)
+
 include $(GALLIUM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
 
diff --git a/src/gallium/winsys/amdgpu/drm/Android.mk 
b/src/gallium/winsys/amdgpu/drm/Android.mk
index 75a4a15809fe..a05304ae5dea 100644
--- a/src/gallium/winsys/amdgpu/drm/Android.mk
+++ b/src/gallium/winsys/amdgpu/drm/Android.mk
@@ -39,6 +39,8 @@ LOCAL_STATIC_LIBRARIES := libmesa_amdgpu_addrlib
 LOCAL_SHARED_LIBRARIES := libdrm_amdgpu
 LOCAL_MODULE := libmesa_winsys_amdgpu
 
+$(call mesa-build-with-llvm)
+
 include $(GALLIUM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
 
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to