telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 1 | # |
| 2 | # Copyright © 2017 ARM Ltd. All rights reserved. |
David Beck | 93e4898 | 2018-09-05 13:05:09 +0100 | [diff] [blame] | 3 | # SPDX-License-Identifier: MIT |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 4 | # |
| 5 | |
| 6 | ANDROID_NN_DRIVER_LOCAL_PATH := $(call my-dir) |
| 7 | LOCAL_PATH := $(ANDROID_NN_DRIVER_LOCAL_PATH) |
| 8 | |
| 9 | # Configure these paths if you move the source or Khronos headers |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 10 | ARMNN_HEADER_PATH := $(LOCAL_PATH)/armnn/include |
| 11 | ARMNN_UTILS_HEADER_PATH := $(LOCAL_PATH)/armnn/src/armnnUtils |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 12 | OPENCL_HEADER_PATH := $(LOCAL_PATH)/clframework/include |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 13 | NN_HEADER_PATH := $(LOCAL_PATH)/../../../frameworks/ml/nn/runtime/include |
| 14 | |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 15 | ####################### |
| 16 | # libarmnn-driver@1.0 # |
| 17 | ####################### |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 18 | include $(CLEAR_VARS) |
| 19 | |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 20 | LOCAL_MODULE := libarmnn-driver@1.0 |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 21 | LOCAL_MODULE_TAGS := eng optional |
| 22 | LOCAL_ARM_MODE := arm |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 23 | LOCAL_PROPRIETARY_MODULE := true |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 24 | # Mark source files as dependent on Android.mk |
| 25 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 26 | |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 27 | LOCAL_C_INCLUDES := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 28 | $(ARMNN_HEADER_PATH) \ |
| 29 | $(ARMNN_UTILS_HEADER_PATH) \ |
| 30 | $(OPENCL_HEADER_PATH) \ |
| 31 | $(NN_HEADER_PATH) |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 32 | |
| 33 | LOCAL_CFLAGS := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 34 | -std=c++14 \ |
| 35 | -fexceptions \ |
| 36 | -Werror \ |
| 37 | -Wno-format-security |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 38 | ifeq ($(PLATFORM_VERSION),9) |
| 39 | # Required to build with the changes made to the Android ML framework starting from Android P, |
| 40 | # regardless of the HAL version used for the build. |
| 41 | LOCAL_CFLAGS+= \ |
| 42 | -DARMNN_ANDROID_P |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 43 | endif # PLATFORM_VERSION == 9 |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 44 | ifeq ($(ARMNN_DRIVER_DEBUG),1) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 45 | LOCAL_CFLAGS+= \ |
| 46 | -UNDEBUG |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 47 | endif # ARMNN_DRIVER_DEBUG == 1 |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 48 | |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 49 | LOCAL_SRC_FILES := \ |
Matteo Martincigh | 79250ab | 2018-09-04 16:28:10 +0100 | [diff] [blame] | 50 | 1.0/ArmnnDriverImpl.cpp \ |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame^] | 51 | 1.0/HalPolicy.cpp \ |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 52 | ArmnnDriverImpl.cpp \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 53 | DriverOptions.cpp \ |
| 54 | ArmnnDevice.cpp \ |
| 55 | ArmnnPreparedModel.cpp \ |
| 56 | ModelToINetworkConverter.cpp \ |
| 57 | RequestThread.cpp \ |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame^] | 58 | Utils.cpp \ |
| 59 | ConversionUtils.cpp |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 60 | |
| 61 | LOCAL_STATIC_LIBRARIES := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 62 | libneuralnetworks_common \ |
| 63 | libarmnn \ |
| 64 | libboost_log \ |
| 65 | libboost_program_options \ |
| 66 | libboost_system \ |
| 67 | libboost_thread \ |
| 68 | armnn-arm_compute |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 69 | |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 70 | LOCAL_SHARED_LIBRARIES := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 71 | libbase \ |
| 72 | libhidlbase \ |
| 73 | libhidltransport \ |
| 74 | libhidlmemory \ |
| 75 | liblog \ |
| 76 | libutils \ |
| 77 | android.hardware.neuralnetworks@1.0 \ |
| 78 | android.hidl.allocator@1.0 \ |
| 79 | android.hidl.memory@1.0 \ |
| 80 | libOpenCL |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 81 | ifeq ($(PLATFORM_VERSION),9) |
| 82 | # Required to build the 1.0 version of the NN Driver on Android P and later versions, |
| 83 | # as the 1.0 version of the NN API needs the 1.1 HAL headers to be included regardless. |
| 84 | LOCAL_SHARED_LIBRARIES+= \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 85 | android.hardware.neuralnetworks@1.1 |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 86 | endif # PLATFORM_VERSION == 9 |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 87 | |
| 88 | include $(BUILD_STATIC_LIBRARY) |
| 89 | |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 90 | ifeq ($(PLATFORM_VERSION),9) |
| 91 | # The following target is available starting from Android P |
| 92 | |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 93 | ####################### |
| 94 | # libarmnn-driver@1.1 # |
| 95 | ####################### |
| 96 | include $(CLEAR_VARS) |
| 97 | |
| 98 | LOCAL_MODULE := libarmnn-driver@1.1 |
| 99 | LOCAL_MODULE_TAGS := eng optional |
| 100 | LOCAL_ARM_MODE := arm |
| 101 | LOCAL_PROPRIETARY_MODULE := true |
| 102 | # Mark source files as dependent on Android.mk |
| 103 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 104 | |
| 105 | LOCAL_C_INCLUDES := \ |
| 106 | $(ARMNN_HEADER_PATH) \ |
| 107 | $(ARMNN_UTILS_HEADER_PATH) \ |
| 108 | $(OPENCL_HEADER_PATH) \ |
| 109 | $(NN_HEADER_PATH) |
| 110 | |
| 111 | LOCAL_CFLAGS := \ |
| 112 | -std=c++14 \ |
| 113 | -fexceptions \ |
| 114 | -Werror \ |
| 115 | -Wno-format-security \ |
| 116 | -DARMNN_ANDROID_P \ |
| 117 | -DARMNN_ANDROID_NN_V1_1 |
| 118 | ifeq ($(ARMNN_DRIVER_DEBUG),1) |
| 119 | LOCAL_CFLAGS+= \ |
| 120 | -UNDEBUG |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 121 | endif # ARMNN_DRIVER_DEBUG == 1 |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 122 | |
| 123 | LOCAL_SRC_FILES := \ |
Matteo Martincigh | 79250ab | 2018-09-04 16:28:10 +0100 | [diff] [blame] | 124 | 1.0/ArmnnDriverImpl.cpp \ |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame^] | 125 | 1.0/HalPolicy.cpp \ |
Matteo Martincigh | 79250ab | 2018-09-04 16:28:10 +0100 | [diff] [blame] | 126 | 1.1/ArmnnDriverImpl.cpp \ |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame^] | 127 | 1.1/HalPolicy.cpp \ |
Matteo Martincigh | e48bdff | 2018-09-03 13:50:50 +0100 | [diff] [blame] | 128 | ArmnnDriverImpl.cpp \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 129 | DriverOptions.cpp \ |
| 130 | ArmnnDevice.cpp \ |
| 131 | ArmnnPreparedModel.cpp \ |
| 132 | ModelToINetworkConverter.cpp \ |
| 133 | RequestThread.cpp \ |
arovir01 | b0717b5 | 2018-09-05 17:03:25 +0100 | [diff] [blame^] | 134 | Utils.cpp \ |
| 135 | ConversionUtils.cpp |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 136 | |
| 137 | LOCAL_STATIC_LIBRARIES := \ |
| 138 | libneuralnetworks_common \ |
| 139 | libarmnn \ |
| 140 | libboost_log \ |
| 141 | libboost_program_options \ |
| 142 | libboost_system \ |
| 143 | libboost_thread \ |
| 144 | armnn-arm_compute |
| 145 | |
| 146 | LOCAL_SHARED_LIBRARIES := \ |
| 147 | libbase \ |
| 148 | libhidlbase \ |
| 149 | libhidltransport \ |
| 150 | libhidlmemory \ |
| 151 | liblog \ |
| 152 | libutils \ |
| 153 | android.hardware.neuralnetworks@1.0 \ |
| 154 | android.hardware.neuralnetworks@1.1 \ |
| 155 | android.hidl.allocator@1.0 \ |
| 156 | android.hidl.memory@1.0 \ |
| 157 | libOpenCL |
| 158 | |
| 159 | include $(BUILD_STATIC_LIBRARY) |
| 160 | |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 161 | endif # PLATFORM_VERSION == 9 |
| 162 | |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 163 | ##################################################### |
| 164 | # android.hardware.neuralnetworks@1.0-service-armnn # |
| 165 | ##################################################### |
| 166 | include $(CLEAR_VARS) |
| 167 | |
| 168 | LOCAL_MODULE := android.hardware.neuralnetworks@1.0-service-armnn |
| 169 | LOCAL_INIT_RC := android.hardware.neuralnetworks@1.0-service-armnn.rc |
| 170 | LOCAL_MODULE_TAGS := eng optional |
| 171 | LOCAL_ARM_MODE := arm |
| 172 | LOCAL_MODULE_RELATIVE_PATH := hw |
| 173 | LOCAL_PROPRIETARY_MODULE := true |
| 174 | # Mark source files as dependent on Android.mk |
| 175 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 176 | |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 177 | LOCAL_C_INCLUDES := \ |
| 178 | $(ARMNN_HEADER_PATH) \ |
| 179 | $(NN_HEADER_PATH) |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 180 | |
| 181 | LOCAL_CFLAGS := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 182 | -std=c++14 \ |
| 183 | -fexceptions |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 184 | ifeq ($(ARMNN_DRIVER_DEBUG),1) |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 185 | LOCAL_CFLAGS += \ |
| 186 | -UNDEBUG |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 187 | endif # ARMNN_DRIVER_DEBUG == 1 |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 188 | |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 189 | LOCAL_SRC_FILES := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 190 | service.cpp |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 191 | |
| 192 | LOCAL_STATIC_LIBRARIES := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 193 | libarmnn-driver@1.0 \ |
| 194 | libneuralnetworks_common \ |
| 195 | libarmnn \ |
| 196 | libboost_log \ |
| 197 | libboost_program_options \ |
| 198 | libboost_system \ |
| 199 | libboost_thread \ |
| 200 | armnn-arm_compute |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 201 | |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 202 | LOCAL_SHARED_LIBRARIES := \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 203 | libbase \ |
| 204 | libhidlbase \ |
| 205 | libhidltransport \ |
| 206 | libhidlmemory \ |
| 207 | libdl \ |
| 208 | libhardware \ |
| 209 | liblog \ |
| 210 | libtextclassifier_hash \ |
| 211 | libutils \ |
| 212 | android.hardware.neuralnetworks@1.0 \ |
| 213 | android.hidl.allocator@1.0 \ |
| 214 | android.hidl.memory@1.0 \ |
| 215 | libOpenCL |
surmeh01 | deb3bdb | 2018-07-05 12:06:04 +0100 | [diff] [blame] | 216 | ifeq ($(PLATFORM_VERSION),9) |
| 217 | # Required to build the 1.0 version of the NN Driver on Android P and later versions, |
| 218 | # as the 1.0 version of the NN API needs the 1.1 HAL headers to be included regardless. |
| 219 | LOCAL_SHARED_LIBRARIES+= \ |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 220 | android.hardware.neuralnetworks@1.1 |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 221 | endif # PLATFORM_VERSION == 9 |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 222 | |
| 223 | include $(BUILD_EXECUTABLE) |
| 224 | |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 225 | ifeq ($(PLATFORM_VERSION),9) |
| 226 | # The following target is available starting from Android P |
| 227 | |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 228 | ##################################################### |
| 229 | # android.hardware.neuralnetworks@1.1-service-armnn # |
| 230 | ##################################################### |
| 231 | include $(CLEAR_VARS) |
| 232 | |
| 233 | LOCAL_MODULE := android.hardware.neuralnetworks@1.1-service-armnn |
| 234 | LOCAL_INIT_RC := android.hardware.neuralnetworks@1.1-service-armnn.rc |
| 235 | LOCAL_MODULE_TAGS := eng optional |
| 236 | LOCAL_ARM_MODE := arm |
| 237 | LOCAL_MODULE_RELATIVE_PATH := hw |
| 238 | LOCAL_PROPRIETARY_MODULE := true |
| 239 | # Mark source files as dependent on Android.mk |
| 240 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 241 | |
| 242 | LOCAL_C_INCLUDES := \ |
| 243 | $(ARMNN_HEADER_PATH) \ |
| 244 | $(NN_HEADER_PATH) |
| 245 | |
| 246 | LOCAL_CFLAGS := \ |
| 247 | -std=c++14 \ |
| 248 | -fexceptions \ |
| 249 | -DARMNN_ANDROID_NN_V1_1 |
| 250 | ifeq ($(ARMNN_DRIVER_DEBUG),1) |
| 251 | LOCAL_CFLAGS += \ |
| 252 | -UNDEBUG |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 253 | endif # ARMNN_DRIVER_DEBUG == 1 |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame] | 254 | |
| 255 | LOCAL_SRC_FILES := \ |
| 256 | service.cpp |
| 257 | |
| 258 | LOCAL_STATIC_LIBRARIES := \ |
| 259 | libarmnn-driver@1.1 \ |
| 260 | libneuralnetworks_common \ |
| 261 | libarmnn \ |
| 262 | libboost_log \ |
| 263 | libboost_program_options \ |
| 264 | libboost_system \ |
| 265 | libboost_thread \ |
| 266 | armnn-arm_compute |
| 267 | |
| 268 | LOCAL_SHARED_LIBRARIES := \ |
| 269 | libbase \ |
| 270 | libhidlbase \ |
| 271 | libhidltransport \ |
| 272 | libhidlmemory \ |
| 273 | libdl \ |
| 274 | libhardware \ |
| 275 | liblog \ |
| 276 | libtextclassifier_hash \ |
| 277 | libutils \ |
| 278 | android.hardware.neuralnetworks@1.0 \ |
| 279 | android.hardware.neuralnetworks@1.1 \ |
| 280 | android.hidl.allocator@1.0 \ |
| 281 | android.hidl.memory@1.0 \ |
| 282 | libOpenCL |
| 283 | |
| 284 | include $(BUILD_EXECUTABLE) |
| 285 | |
Matteo Martincigh | 69558df | 2018-08-31 16:18:19 +0100 | [diff] [blame] | 286 | endif # PLATFORM_VERSION == 9 |
| 287 | |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 288 | ########################## |
| 289 | # armnn module and tests # |
| 290 | ########################## |
| 291 | # Note we use ANDROID_NN_DRIVER_LOCAL_PATH rather than LOCAL_PATH because LOCAL_PATH will be overwritten |
| 292 | # when including other .mk files that set it. |
| 293 | include $(ANDROID_NN_DRIVER_LOCAL_PATH)/armnn/Android.mk |
surmeh01 | 49b9e10 | 2018-05-17 14:11:25 +0100 | [diff] [blame] | 294 | include $(ANDROID_NN_DRIVER_LOCAL_PATH)/test/Android.mk |