aboutsummaryrefslogtreecommitdiff
path: root/Android.mk
blob: e69514c23405672a9e19136c0a8a357ebb90c322 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#
# Copyright © 2017 ARM Ltd. All rights reserved.
# See LICENSE file in the project root for full license information.
#

ANDROID_NN_DRIVER_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(ANDROID_NN_DRIVER_LOCAL_PATH)

# Configure these paths if you move the source or Khronos headers
ARMNN_HEADER_PATH := $(LOCAL_PATH)/armnn/include
ARMNN_UTILS_HEADER_PATH := $(LOCAL_PATH)/armnn/src/armnnUtils
OPENCL_HEADER_PATH := $(LOCAL_PATH)/clframework/include
NN_HEADER_PATH := $(LOCAL_PATH)/../../../frameworks/ml/nn/runtime/include

###################
# libarmnn-driver #
###################
include $(CLEAR_VARS)

LOCAL_MODULE := libarmnn-driver
LOCAL_MODULE_TAGS := eng optional
LOCAL_ARM_MODE := arm
LOCAL_PROPRIETARY_MODULE := true
# Mark source files as dependent on Android.mk
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk

LOCAL_C_INCLUDES := \
	$(ARMNN_HEADER_PATH) \
	$(ARMNN_UTILS_HEADER_PATH) \
	$(OPENCL_HEADER_PATH) \
	$(NN_HEADER_PATH)

LOCAL_CFLAGS := \
	-std=c++14 \
	-fexceptions \
	-Werror \
	-Wno-format-security
ifeq ($(PLATFORM_VERSION),9)
# Required to build with the changes made to the Android ML framework starting from Android P,
# regardless of the HAL version used for the build.
LOCAL_CFLAGS+= \
        -DARMNN_ANDROID_P
endif
ifeq ($(ARMNN_DRIVER_DEBUG),1)
	LOCAL_CFLAGS+= -UNDEBUG
endif

LOCAL_SRC_FILES := \
	ArmnnDriver.cpp \
	ArmnnPreparedModel.cpp \
	ModelToINetworkConverter.cpp \
	RequestThread.cpp \
	Utils.cpp

LOCAL_STATIC_LIBRARIES := \
	libneuralnetworks_common \
	libarmnn \
	libboost_log \
	libboost_program_options \
	libboost_system \
	libboost_thread \
	armnn-arm_compute

LOCAL_SHARED_LIBRARIES := \
	libbase \
	libhidlbase \
	libhidltransport \
	libhidlmemory \
	liblog \
	libutils \
	android.hardware.neuralnetworks@1.0 \
	android.hidl.allocator@1.0 \
	android.hidl.memory@1.0 \
	libOpenCL
ifeq ($(PLATFORM_VERSION),9)
# Required to build the 1.0 version of the NN Driver on Android P and later versions,
# as the 1.0 version of the NN API needs the 1.1 HAL headers to be included regardless.
LOCAL_SHARED_LIBRARIES+= \
	android.hardware.neuralnetworks@1.1
endif

include $(BUILD_STATIC_LIBRARY)

#####################################################
# android.hardware.neuralnetworks@1.0-service-armnn #
#####################################################
include $(CLEAR_VARS)

LOCAL_MODULE := android.hardware.neuralnetworks@1.0-service-armnn
LOCAL_INIT_RC := android.hardware.neuralnetworks@1.0-service-armnn.rc
LOCAL_MODULE_TAGS := eng optional
LOCAL_ARM_MODE := arm
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_PROPRIETARY_MODULE := true
# Mark source files as dependent on Android.mk
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk

LOCAL_C_INCLUDES :=	 \
	$(ARMNN_HEADER_PATH) \
	$(NN_HEADER_PATH)

LOCAL_CFLAGS := \
	-std=c++14 \
	-fexceptions
ifeq ($(ARMNN_DRIVER_DEBUG),1)
	LOCAL_CFLAGS+= -UNDEBUG
endif

LOCAL_SRC_FILES := \
	service.cpp

LOCAL_STATIC_LIBRARIES := \
	libarmnn-driver \
	libneuralnetworks_common \
	libarmnn \
	libboost_log \
	libboost_program_options \
	libboost_system \
	libboost_thread \
	armnn-arm_compute
ifeq ($(PLATFORM_VERSION),9)
# Required to build the 1.0 version of the NN Driver on Android P and later versions.
LOCAL_STATIC_LIBRARIES+= \
	libomp
endif

LOCAL_SHARED_LIBRARIES := \
	libbase \
	libhidlbase \
	libhidltransport \
	libhidlmemory \
	libdl \
	libhardware \
	liblog \
	libtextclassifier_hash \
	libutils \
	android.hardware.neuralnetworks@1.0 \
	android.hidl.allocator@1.0 \
	android.hidl.memory@1.0 \
	libOpenCL
ifeq ($(PLATFORM_VERSION),9)
# Required to build the 1.0 version of the NN Driver on Android P and later versions,
# as the 1.0 version of the NN API needs the 1.1 HAL headers to be included regardless.
LOCAL_SHARED_LIBRARIES+= \
	android.hardware.neuralnetworks@1.1
endif

include $(BUILD_EXECUTABLE)

##########################
# armnn module and tests #
##########################
# Note we use ANDROID_NN_DRIVER_LOCAL_PATH rather than LOCAL_PATH because LOCAL_PATH will be overwritten
# when including other .mk files that set it.
include $(ANDROID_NN_DRIVER_LOCAL_PATH)/armnn/Android.mk
include $(ANDROID_NN_DRIVER_LOCAL_PATH)/test/Android.mk