1 # 2 # Copyright (C) 2017 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 19 SPIRIT_SRCS := \ 20 builder.cpp\ 21 entity.cpp\ 22 instructions.cpp\ 23 module.cpp\ 24 pass.cpp\ 25 pass_queue.cpp\ 26 transformer.cpp\ 27 visitor.cpp\ 28 word_stream.cpp\ 29 word_stream_impl.cpp 30 31 LIBNAME = libspirit 32 33 NDK_PREBUILTS := $(TOP)/prebuilts/ndk/current 34 SPIRV_TOOLS_PATH := $(NDK_PREBUILTS)/sources/third_party/shaderc/third_party/spirv-tools 35 SPIRV_HEADERS_PATH := $(SPIRV_TOOLS_PATH)/external/spirv-headers 36 SPIRV_CORE_GRAMMAR := $(SPIRV_HEADERS_PATH)/include/spirv/1.1/spirv.core.grammar.json 37 GENERATOR := $(LOCAL_PATH)/generate.py 38 39 LOCAL_CFLAGS := -Wall -Werror 40 41 # Don't build for unbundled branches 42 ifeq (,$(TARGET_BUILD_APPS)) 43 44 #===================================================================== 45 # Host shared library libspirit.so 46 #===================================================================== 47 48 include $(CLEAR_VARS) 49 50 LOCAL_SRC_FILES := $(SPIRIT_SRCS) 51 52 LOCAL_MODULE := $(LIBNAME) 53 LOCAL_MULTILIB := first 54 LOCAL_MODULE_CLASS := SHARED_LIBRARIES 55 LOCAL_IS_HOST_MODULE := true 56 57 PATH_TO_GENERATED := $(local-generated-sources-dir) 58 GEN := \ 59 instructions_generated.h\ 60 types_generated.h\ 61 opcodes_generated.h\ 62 instruction_dispatches_generated.h\ 63 enum_dispatches_generated.h\ 64 type_inst_dispatches_generated.h\ 65 const_inst_dispatches_generated.h\ 66 factory_methods_generated.h 67 68 FULL_GEN := $(addprefix $(PATH_TO_GENERATED)/,$(GEN)) 69 $(FULL_GEN): $(SPIRV_CORE_GRAMMAR) $(GENERATOR) 70 $(GENERATOR) $< --$(notdir $(@:%_generated.h=%)) $@ 71 72 LOCAL_GENERATED_SOURCES := $(FULL_GEN) 73 74 LOCAL_CFLAGS := -Wall -Werror 75 76 LOCAL_C_INCLUDES += $(PATH_TO_GENERATED) 77 78 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) $(PATH_TO_GENERATED) 79 80 include $(BUILD_HOST_SHARED_LIBRARY) 81 82 #===================================================================== 83 # Tests for host module word_stream 84 #===================================================================== 85 86 include $(CLEAR_VARS) 87 88 LOCAL_SRC_FILES := \ 89 word_stream.cpp \ 90 word_stream_impl.cpp \ 91 word_stream_test.cpp 92 93 LOCAL_STATIC_LIBRARIES := libgtest_host 94 95 LOCAL_MODULE := word_stream_test 96 LOCAL_MULTILIB := first 97 LOCAL_MODULE_TAGS := tests 98 LOCAL_MODULE_CLASS := NATIVE_TESTS 99 LOCAL_IS_HOST_MODULE := true 100 101 PATH_TO_GENERATED := $(local-generated-sources-dir) 102 GEN := \ 103 enum_dispatches_generated.h\ 104 types_generated.h 105 106 FULL_GEN := $(addprefix $(PATH_TO_GENERATED)/,$(GEN)) 107 $(FULL_GEN): $(SPIRV_CORE_GRAMMAR) $(GENERATOR) 108 $(GENERATOR) $< --$(notdir $(@:%_generated.h=%)) $@ 109 110 LOCAL_GENERATED_SOURCES := $(FULL_GEN) 111 112 LOCAL_C_INCLUDES += $(PATH_TO_GENERATED) 113 114 LOCAL_CFLAGS := -Wall -Werror 115 116 include $(BUILD_HOST_NATIVE_TEST) 117 118 #===================================================================== 119 # Tests for host module instructions 120 #===================================================================== 121 122 include $(CLEAR_VARS) 123 124 LOCAL_SRC_FILES := \ 125 entity.cpp \ 126 instructions.cpp \ 127 instructions_test.cpp \ 128 visitor.cpp \ 129 word_stream.cpp \ 130 word_stream_impl.cpp 131 132 LOCAL_STATIC_LIBRARIES := libgtest_host 133 134 LOCAL_MODULE := instructions_test 135 LOCAL_MULTILIB := first 136 LOCAL_MODULE_TAGS := tests 137 LOCAL_MODULE_CLASS := NATIVE_TESTS 138 LOCAL_IS_HOST_MODULE := true 139 140 PATH_TO_GENERATED := $(local-generated-sources-dir) 141 GEN := \ 142 enum_dispatches_generated.h\ 143 instruction_dispatches_generated.h\ 144 instructions_generated.h\ 145 types_generated.h\ 146 opcodes_generated.h 147 148 FULL_GEN := $(addprefix $(PATH_TO_GENERATED)/,$(GEN)) 149 $(FULL_GEN): $(SPIRV_CORE_GRAMMAR) $(GENERATOR) 150 $(GENERATOR) $< --$(notdir $(@:%_generated.h=%)) $@ 151 152 LOCAL_GENERATED_SOURCES := $(FULL_GEN) 153 154 LOCAL_CFLAGS := -Wall -Werror 155 156 LOCAL_C_INCLUDES += $(PATH_TO_GENERATED) 157 158 include $(BUILD_HOST_NATIVE_TEST) 159 160 #===================================================================== 161 # Tests for host module pass queue 162 #===================================================================== 163 164 include $(CLEAR_VARS) 165 166 LOCAL_SRC_FILES := \ 167 pass.cpp \ 168 pass_queue.cpp \ 169 pass_queue_test.cpp \ 170 171 LOCAL_STATIC_LIBRARIES := libgtest_host 172 173 LOCAL_SHARED_LIBRARIES := $(LIBNAME) 174 175 LOCAL_MODULE := pass_queue_test 176 LOCAL_MULTILIB := first 177 LOCAL_MODULE_TAGS := tests 178 LOCAL_MODULE_CLASS := NATIVE_TESTS 179 LOCAL_IS_HOST_MODULE := true 180 LOCAL_CFLAGS := -Wall -Werror 181 182 include $(BUILD_HOST_NATIVE_TEST) 183 184 #===================================================================== 185 # Tests for host shared library 186 #===================================================================== 187 188 include $(CLEAR_VARS) 189 190 LOCAL_SRC_FILES := \ 191 builder_test.cpp \ 192 module_test.cpp \ 193 transformer_test.cpp \ 194 195 LOCAL_STATIC_LIBRARIES := libgtest_host 196 197 LOCAL_SHARED_LIBRARIES := $(LIBNAME) 198 199 LOCAL_MODULE := $(LIBNAME)_test 200 LOCAL_MULTILIB := first 201 LOCAL_MODULE_TAGS := tests 202 LOCAL_MODULE_CLASS := NATIVE_TESTS 203 LOCAL_IS_HOST_MODULE := true 204 LOCAL_CFLAGS := -Wall -Werror 205 206 include $(BUILD_HOST_NATIVE_TEST) 207 208 #===================================================================== 209 # Device shared library libspirit.so 210 #===================================================================== 211 212 include $(CLEAR_VARS) 213 214 LOCAL_SRC_FILES := $(SPIRIT_SRCS) 215 216 LOCAL_C_INCLUDES := $(SPIRIT_INCLUDES) 217 218 LOCAL_MODULE := $(LIBNAME) 219 LOCAL_MODULE_CLASS := SHARED_LIBRARIES 220 221 LOCAL_SHARED_LIBRARIES += 222 223 PATH_TO_GENERATED := $(local-generated-sources-dir) 224 225 GEN := \ 226 instructions_generated.h\ 227 types_generated.h\ 228 opcodes_generated.h\ 229 instruction_dispatches_generated.h\ 230 enum_dispatches_generated.h\ 231 type_inst_dispatches_generated.h\ 232 const_inst_dispatches_generated.h\ 233 factory_methods_generated.h 234 235 FULL_GEN := $(addprefix $(PATH_TO_GENERATED)/,$(GEN)) 236 $(FULL_GEN): $(SPIRV_CORE_GRAMMAR) $(GENERATOR) 237 $(GENERATOR) $< --$(notdir $(@:%_generated.h=%)) $@ 238 239 LOCAL_GENERATED_SOURCES := $(FULL_GEN) 240 241 LOCAL_C_INCLUDES += $(PATH_TO_GENERATED) 242 243 LOCAL_CFLAGS := -Wall -Werror -Wno-error=non-virtual-dtor 244 245 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) $(PATH_TO_GENERATED) 246 247 include $(BUILD_SHARED_LIBRARY) 248 249 endif # Don't build in unbundled branches 250