Commit 26aee6f4 authored by Rob Herring's avatar Rob Herring Committed by Emil Velikov

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's avatarRob Herring <robh@kernel.org>
Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
parent e2ff12e9
......@@ -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
......
......@@ -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 \
......
......@@ -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)
......@@ -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)
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment