1# Copyright © 2018 Advanced Micro Devices, Inc. 2# Copyright © 2018 Mauro Rossi issor.oruam@gmail.com 3 4# Permission is hereby granted, free of charge, to any person obtaining a 5# copy of this software and associated documentation files (the "Software"), 6# to deal in the Software without restriction, including without limitation 7# the rights to use, copy, modify, merge, publish, distribute, sublicense, 8# and/or sell copies of the Software, and to permit persons to whom the 9# Software is furnished to do so, subject to the following conditions: 10# 11# The above copyright notice and this permission notice (including the next 12# paragraph) shall be included in all copies or substantial portions of the 13# Software. 14# 15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21# IN THE SOFTWARE. 22 23LOCAL_PATH := $(call my-dir) 24 25# get VULKAN_FILES and VULKAN_GENERATED_FILES 26include $(LOCAL_PATH)/Makefile.sources 27 28# The gallium includes are for the util/u_math.h include from main/macros.h 29 30RADV_COMMON_INCLUDES := \ 31 $(MESA_TOP)/include \ 32 $(MESA_TOP)/src/ \ 33 $(MESA_TOP)/src/amd/vulkan \ 34 $(MESA_TOP)/src/vulkan/wsi \ 35 $(MESA_TOP)/src/vulkan/util \ 36 $(MESA_TOP)/src/amd \ 37 $(MESA_TOP)/src/mapi \ 38 $(MESA_TOP)/src/mesa \ 39 $(MESA_TOP)/src/mesa/drivers/dri/common \ 40 $(MESA_TOP)/src/gallium/auxiliary \ 41 $(MESA_TOP)/src/gallium/include \ 42 frameworks/native/vulkan/include 43 44RADV_SHARED_LIBRARIES := libdrm_amdgpu 45 46ifeq ($(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5 6 7),) 47RADV_SHARED_LIBRARIES += libnativewindow 48endif 49 50# 51# libmesa_radv_common 52# 53 54include $(CLEAR_VARS) 55LOCAL_MODULE := libmesa_radv_common 56LOCAL_LICENSE_KINDS := SPDX-license-identifier-ISC SPDX-license-identifier-MIT 57LOCAL_LICENSE_CONDITIONS := notice 58LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../LICENSE 59LOCAL_MODULE_CLASS := STATIC_LIBRARIES 60 61intermediates := $(call local-generated-sources-dir) 62 63LOCAL_SRC_FILES := \ 64 $(VULKAN_FILES) 65 66LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU # instructs LLVM to declare LLVMInitializeAMDGPU* functions 67LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR 68 69$(call mesa-build-with-llvm) 70 71LOCAL_C_INCLUDES := $(RADV_COMMON_INCLUDES) 72 73LOCAL_STATIC_LIBRARIES := \ 74 libmesa_aco \ 75 libmesa_amd_common \ 76 libmesa_nir \ 77 libmesa_util \ 78 libmesa_vulkan_util \ 79 libmesa_git_sha1 80 81LOCAL_GENERATED_SOURCES += $(intermediates)/radv_entrypoints.c 82LOCAL_GENERATED_SOURCES += $(intermediates)/radv_entrypoints.h 83LOCAL_GENERATED_SOURCES += $(intermediates)/radv_extensions.c 84LOCAL_GENERATED_SOURCES += $(intermediates)/radv_extensions.h 85LOCAL_GENERATED_SOURCES += $(intermediates)/vk_format_table.c 86 87RADV_ENTRYPOINTS_SCRIPT := $(MESA_TOP)/src/amd/vulkan/radv_entrypoints_gen.py 88RADV_EXTENSIONS_SCRIPT := $(MESA_TOP)/src/amd/vulkan/radv_extensions.py 89VK_FORMAT_TABLE_SCRIPT := $(MESA_TOP)/src/amd/vulkan/vk_format_table.py 90VK_FORMAT_PARSE_SCRIPT := $(MESA_TOP)/src/amd/vulkan/vk_format_parse.py 91 92vulkan_api_xml = $(MESA_TOP)/src/vulkan/registry/vk.xml 93vk_format_layout_csv = $(MESA_TOP)/src/amd/vulkan/vk_format_layout.csv 94 95$(intermediates)/radv_entrypoints.c: $(RADV_ENTRYPOINTS_SCRIPT) \ 96 $(RADV_EXTENSIONS_SCRIPT) \ 97 $(vulkan_api_xml) 98 @mkdir -p $(dir $@) 99 $(MESA_PYTHON3) $(RADV_ENTRYPOINTS_SCRIPT) \ 100 --xml $(vulkan_api_xml) \ 101 --outdir $(dir $@) 102 103$(intermediates)/radv_entrypoints.h: $(intermediates)/radv_entrypoints.c 104 105$(intermediates)/radv_extensions.c: $(RADV_EXTENSIONS_SCRIPT) $(vulkan_api_xml) 106 @mkdir -p $(dir $@) 107 $(MESA_PYTHON3) $(RADV_EXTENSIONS_SCRIPT) \ 108 --xml $(vulkan_api_xml) \ 109 --out-c $@ \ 110 --out-h $(addsuffix .h,$(basename $@)) 111 112$(intermediates)/radv_extensions.h: $(intermediates)/radv_extensions.c 113 114$(intermediates)/vk_format_table.c: $(VK_FORMAT_TABLE_SCRIPT) \ 115 $(VK_FORMAT_PARSE_SCRIPT) \ 116 $(vk_format_layout_csv) 117 @mkdir -p $(dir $@) 118 $(MESA_PYTHON3) $(VK_FORMAT_TABLE_SCRIPT) $(vk_format_layout_csv) > $@ 119 120LOCAL_SHARED_LIBRARIES += $(RADV_SHARED_LIBRARIES) 121 122LOCAL_EXPORT_C_INCLUDE_DIRS := \ 123 $(MESA_TOP)/src/amd/vulkan \ 124 $(intermediates) 125 126include $(MESA_COMMON_MK) 127include $(BUILD_STATIC_LIBRARY) 128 129# 130# libvulkan_radeon 131# 132 133include $(CLEAR_VARS) 134 135LOCAL_MODULE := vulkan.radv 136LOCAL_LICENSE_KINDS := SPDX-license-identifier-ISC SPDX-license-identifier-MIT 137LOCAL_LICENSE_CONDITIONS := notice 138LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../LICENSE 139LOCAL_MODULE_CLASS := SHARED_LIBRARIES 140LOCAL_PROPRIETARY_MODULE := true 141LOCAL_MODULE_RELATIVE_PATH := hw 142 143LOCAL_LDFLAGS += -Wl,--build-id=sha1 144 145LOCAL_SRC_FILES := \ 146 $(VULKAN_ANDROID_FILES) 147 148LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU # instructs LLVM to declare LLVMInitializeAMDGPU* functions 149LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR 150 151$(call mesa-build-with-llvm) 152 153LOCAL_C_INCLUDES := $(RADV_COMMON_INCLUDES) 154 155LOCAL_WHOLE_STATIC_LIBRARIES := \ 156 libmesa_util \ 157 libmesa_nir \ 158 libmesa_glsl \ 159 libmesa_compiler \ 160 libmesa_amdgpu_addrlib \ 161 libmesa_amd_common \ 162 libmesa_radv_common \ 163 libmesa_vulkan_util \ 164 libmesa_aco 165 166LOCAL_SHARED_LIBRARIES += $(RADV_SHARED_LIBRARIES) libz libsync liblog 167 168# If Android version >=8 MESA should static link libexpat else should dynamic link 169ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27; echo $$?), 0) 170LOCAL_STATIC_LIBRARIES := \ 171 libexpat 172else 173LOCAL_SHARED_LIBRARIES += \ 174 libexpat 175endif 176 177include $(MESA_COMMON_MK) 178include $(BUILD_SHARED_LIBRARY) 179