summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <[email protected]>2017-05-03 14:35:24 -0500
committerEmil Velikov <[email protected]>2017-05-11 13:52:21 +0100
commit26aee6f4d5a28350e1f6becfc485ce929c4126f9 (patch)
tree2c1cc45feae6fc8dec6e3da62de74f4891db8293
parente2ff12e919b5f887083225d96f4060a122c12eab (diff)
Android: rework LLVM build support
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 <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
-rw-r--r--Android.common.mk9
-rw-r--r--Android.mk13
-rw-r--r--src/amd/Android.common.mk3
-rw-r--r--src/gallium/Android.common.mk6
-rw-r--r--src/gallium/auxiliary/Android.mk8
-rw-r--r--src/gallium/drivers/radeon/Android.mk7
-rw-r--r--src/gallium/drivers/radeonsi/Android.mk2
-rw-r--r--src/gallium/winsys/amdgpu/drm/Android.mk2
8 files changed, 27 insertions, 23 deletions
diff --git a/Android.common.mk b/Android.common.mk
index eb9a3f0e870..5e7fd9445ad 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -86,15 +86,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)
LOCAL_CFLAGS += -DHAVE_LIBDRM
LOCAL_SHARED_LIBRARIES += libdrm
diff --git a/Android.mk b/Android.mk
index e2d792d8e4c..600b37a52e6 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 18ace02b90c..62d4df15118 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 b2eb95bcd64..782510ff0f4 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 4f6f71bbf6a..e2a1fc214eb 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 64815f6f084..eb1a32182bb 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 cd768751518..5676c55983f 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 75a4a15809f..a05304ae5de 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)