1 # 2 # Copyright (C) 2016 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 LOCAL_PATH := $(call my-dir) 18 LLVM_ROOT_PATH := external/llvm 19 LIBBCC_ROOT_PATH := frameworks/compile/libbcc 20 LIBSPIRV_ROOT_PATH := external/spirv-llvm/lib/SPIRV 21 22 FORCE_RS2SPIRV_DEBUG_BUILD ?= false 23 RS2SPRIV_DEVICE_BUILD ?= true 24 25 RS2SPIRV_SOURCES := \ 26 rs2spirv.cpp \ 27 Builtin.cpp \ 28 Context.cpp \ 29 GlobalAllocPass.cpp \ 30 GlobalAllocSPIRITPass.cpp \ 31 GlobalMergePass.cpp \ 32 InlinePreparationPass.cpp \ 33 RemoveNonkernelsPass.cpp \ 34 RSAllocationUtils.cpp \ 35 RSSPIRVWriter.cpp \ 36 Wrapper.cpp \ 37 38 RS2SPIRV_INCLUDES := \ 39 $(LIBSPIRV_ROOT_PATH) \ 40 $(LIBSPIRV_ROOT_PATH)/Mangler \ 41 $(LIBSPIRV_ROOT_PATH)/libSPIRV \ 42 $(LIBBCC_ROOT_PATH)/include \ 43 $(LLVM_ROOT_PATH)/include \ 44 $(LLVM_ROOT_PATH)/host/include 45 46 #===================================================================== 47 # Unit tests for Wrapper module 48 #===================================================================== 49 50 include $(CLEAR_VARS) 51 include $(CLEAR_TBLGEN_VARS) 52 53 LOCAL_SRC_FILES := \ 54 Builtin.cpp \ 55 Context.cpp \ 56 GlobalAllocSPIRITPass.cpp \ 57 RSAllocationUtils.cpp \ 58 Wrapper.cpp \ 59 Wrapper_test.cpp \ 60 61 LOCAL_STATIC_LIBRARIES := libgtest_host 62 63 LOCAL_SHARED_LIBRARIES := libLLVM libbcinfo libspirit 64 65 LOCAL_C_INCLUDES := \ 66 $(LLVM_ROOT_PATH)/include \ 67 $(LLVM_ROOT_PATH)/host/include 68 69 # End protobuf section 70 71 LOCAL_MODULE := Wrapper_test 72 LOCAL_MULTILIB := first 73 LOCAL_MODULE_TAGS := tests 74 75 LOCAL_MODULE_CLASS := NATIVE_TESTS 76 77 include $(LLVM_ROOT_PATH)/llvm.mk 78 include $(LLVM_HOST_BUILD_MK) 79 include $(LLVM_GEN_INTRINSICS_MK) 80 include $(LLVM_GEN_ATTRIBUTES_MK) 81 include $(BUILD_HOST_NATIVE_TEST) 82 83 #===================================================================== 84 # Unit tests for Builtin module 85 #===================================================================== 86 87 include $(CLEAR_VARS) 88 include $(CLEAR_TBLGEN_VARS) 89 90 LOCAL_SRC_FILES := \ 91 Builtin.cpp \ 92 Builtin_test.cpp \ 93 94 LOCAL_STATIC_LIBRARIES := libgtest_host 95 96 LOCAL_SHARED_LIBRARIES := libspirit 97 98 # End protobuf section 99 100 LOCAL_MODULE := Builtin_test 101 LOCAL_MULTILIB := first 102 LOCAL_MODULE_TAGS := tests 103 104 LOCAL_MODULE_CLASS := NATIVE_TESTS 105 106 include $(BUILD_HOST_NATIVE_TEST) 107 108 #===================================================================== 109 # Host Executable rs2spirv 110 #===================================================================== 111 112 # Don't build for unbundled branches 113 ifeq (,$(TARGET_BUILD_APPS)) 114 115 include $(CLEAR_VARS) 116 include $(CLEAR_TBLGEN_VARS) 117 118 LOCAL_SRC_FILES := \ 119 $(RS2SPIRV_SOURCES) 120 121 LOCAL_C_INCLUDES := \ 122 $(RS2SPIRV_INCLUDES) 123 124 LOCAL_MODULE := rs2spirv 125 LOCAL_MODULE_CLASS := EXECUTABLES 126 127 # TODO: fix the remaining warnings 128 129 LOCAL_CFLAGS += $(TOOL_CFLAGS) \ 130 -D_SPIRV_LLVM_API \ 131 -Wno-error=pessimizing-move \ 132 -Wno-error=unused-variable \ 133 -Wno-error=unused-private-field \ 134 -Wno-error=unused-function \ 135 -Wno-error=dangling-else \ 136 -Wno-error=ignored-qualifiers \ 137 -Wno-error=non-virtual-dtor 138 139 ifeq (true, $(FORCE_RS2SPIRV_DEBUG_BUILD)) 140 LOCAL_CFLAGS += -O0 -DRS2SPIRV_DEBUG=1 141 endif 142 143 LOCAL_SHARED_LIBRARIES := libLLVM libbcinfo libSPIRV libspirit 144 145 include $(LLVM_ROOT_PATH)/llvm.mk 146 include $(LLVM_HOST_BUILD_MK) 147 include $(LLVM_GEN_INTRINSICS_MK) 148 include $(LLVM_GEN_ATTRIBUTES_MK) 149 include $(BUILD_HOST_EXECUTABLE) 150 151 endif # Don't build in unbundled branches 152 153 #===================================================================== 154 # Device Executable rs2spirv 155 #===================================================================== 156 157 ifneq (true,$(RS2SPRIV_DEVICE_BUILD))) 158 159 include $(CLEAR_VARS) 160 include $(CLEAR_TBLGEN_VARS) 161 162 LOCAL_SRC_FILES := \ 163 $(RS2SPIRV_SOURCES) 164 165 LOCAL_C_INCLUDES := \ 166 $(RS2SPIRV_INCLUDES) 167 168 LOCAL_MODULE := rs2spirv 169 LOCAL_MODULE_CLASS := EXECUTABLES 170 171 LOCAL_SHARED_LIBRARIES += libLLVM libbcinfo libSPIRV libspirit 172 173 LOCAL_CFLAGS += $(TOOL_CFLAGS) \ 174 -D_SPIRV_LLVM_API \ 175 -Wno-error=pessimizing-move \ 176 -Wno-error=unused-variable \ 177 -Wno-error=unused-private-field \ 178 -Wno-error=unused-function \ 179 -Wno-error=dangling-else \ 180 -Wno-error=ignored-qualifiers \ 181 -Wno-error=non-virtual-dtor \ 182 183 ifeq (true, $(FORCE_RS2SPIRV_DEBUG_BUILD)) 184 LOCAL_CFLAGS += -O0 -DRS2SPIRV_DEBUG=1 185 endif 186 187 include $(LLVM_GEN_INTRINSICS_MK) 188 include $(LLVM_GEN_ATTRIBUTES_MK) 189 include $(LLVM_DEVICE_BUILD_MK) 190 include $(BUILD_EXECUTABLE) 191 192 endif # Don't build in unbundled branches 193 194 #===================================================================== 195 # Device executable bcc_rsov 196 #===================================================================== 197 198 include $(CLEAR_VARS) 199 include $(CLEAR_TBLGEN_VARS) 200 201 LOCAL_MODULE:= bcc_rsov 202 LOCAL_MULTILIB := first 203 LOCAL_MODULE_CLASS := EXECUTABLES 204 LOCAL_SRC_FILES := bcc_rsov.sh 205 206 include $(BUILD_PREBUILT) 207 208 #===================================================================== 209 # Include Subdirectories 210 #===================================================================== 211 212 include $(call all-makefiles-under,$(LOCAL_PATH)) 213