-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile-aarch64
101 lines (82 loc) · 4.82 KB
/
Makefile-aarch64
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
# Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
TARGET_TOOLCHAIN_PREFIX = aarch64-linux-gnu-
TF_SRC_DIR ?=/home/craft/workspace/gem5/tensorflow_src
TFLITE_INC_DIR ?=$(TF_SRC_DIR)
FLATBUFFERS_INC_DIR ?=$(TF_SRC_DIR)/build/flatbuffers/include
TFLITE_LIB_DIR ?=/home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM
TFLITE_FLATBUF_LIB_DIR ?=/home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/_deps/flatbuffers-build
TFLITE_RUY_LIB_DIR ?=/home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/_deps/ruy-build/ruy
TFLITE_FARMHASH_LIB_DIR ?=/home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/_deps/farmhash-build
TFLITE_FFT2D_DIR ?=/home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/_deps/fft2d-build
TFLITE_CPUINFO_DIR ?=/home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/_deps/cpuinfo-build
TFLITE_CLOG_DIR ?=/home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/_deps/clog-build
OPENCV_SRC_DIR ?=/home/craft/workspace/gem5/opencv
OPENCV_INC_DIR ?=$(OPENCV_SRC_DIR)/build/install/include/opencv4/
OPENCV_LIB_DIR ?=$(OPENCV_SRC_DIR)/build/install/lib/
OPENCV_LIB_3RDPARTY_DIR ?=$(OPENCV_SRC_DIR)/build/install/lib/opencv4/3rdparty/
PHONY: all
all: classification/tflite_classification_arm segmentation/tflite_segmentation detection/tflite_detection_arm
LIBS = $(TFLITE_LIB_DIR)/libtensorflow-lite.a
LIBS += $(TFLITE_RUY_LIB_DIR)/libruy_ctx.a \
$(TFLITE_RUY_LIB_DIR)/libruy_frontend.a \
$(TFLITE_RUY_LIB_DIR)/libruy_tune.a \
$(TFLITE_RUY_LIB_DIR)/libruy_context.a \
$(TFLITE_RUY_LIB_DIR)/libruy_context_get_ctx.a \
\
$(TFLITE_RUY_LIB_DIR)/libruy_thread_pool.a \
$(TFLITE_RUY_LIB_DIR)/libruy_wait.a \
$(TFLITE_RUY_LIB_DIR)/libruy_allocator.a \
$(TFLITE_RUY_LIB_DIR)/libruy_system_aligned_alloc.a \
$(TFLITE_RUY_LIB_DIR)/libruy_cpuinfo.a \
$(TFLITE_RUY_LIB_DIR)/libruy_blocking_counter.a \
\
$(TFLITE_RUY_LIB_DIR)/libruy_apply_multiplier.a \
$(TFLITE_RUY_LIB_DIR)/libruy_trmul.a \
$(TFLITE_RUY_LIB_DIR)/libruy_kernel_arm.a \
$(TFLITE_RUY_LIB_DIR)/libruy_block_map.a \
$(TFLITE_RUY_LIB_DIR)/libruy_pack_arm.a \
$(TFLITE_RUY_LIB_DIR)/libruy_prepacked_cache.a \
$(TFLITE_RUY_LIB_DIR)/libruy_prepare_packed_matrices.a \
$(TFLITE_RUY_LIB_DIR)/libruy_denormal.a
LIBS += $(TFLITE_FLATBUF_LIB_DIR)/libflatbuffers.a
LIBS += $(TFLITE_FARMHASH_LIB_DIR)/libfarmhash.a
LIBS += $(TFLITE_FFT2D_DIR)/libfft2d_fftsg.a
LIBS += $(TFLITE_FFT2D_DIR)/libfft2d_fftsg2d.a
LIBS += $(TFLITE_CPUINFO_DIR)/libcpuinfo.a
# LIBS += /home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/_deps/xnnpack-build/libXNNPACK.a
# LIBS += /home/craft/workspace/DNN/tensorflow-lite-cpp-examples/build_tflite_2_11_1_ARM/pthreadpool/libpthreadpool.a
LIBS += build_tflite_2_11_1_ARM/_deps/cpuinfo-build/deps/clog/libclog.a
# LIBS += $(TFLITE_CLOG_DIR)/libclog.a
LIBS += $(OPENCV_LIB_DIR)/libopencv_world.a
LIBS += $(OPENCV_LIB_3RDPARTY_DIR)/liblibjpeg-turbo.a \
$(OPENCV_LIB_3RDPARTY_DIR)/liblibpng.a \
$(OPENCV_LIB_3RDPARTY_DIR)/libtegra_hal.a \
$(OPENCV_LIB_3RDPARTY_DIR)/libzlib.a
LIBS += -lstdc++ -lpthread -lm -ldl -lrt -static
INCLUDES := -I. -I$(FLATBUFFERS_INC_DIR) -I$(TFLITE_INC_DIR) -I$(OPENCV_INC_DIR)
CCFLAGS = --std=c++11 -O3 -DNDEBUG -fPIC
CXX := ${TARGET_TOOLCHAIN_PREFIX}g++
COMMON_SRC = model_utils.cc utils.cc nms.cpp
classification/tflite_classification_arm: classification.cc $(COMMON_SRC)
mkdir -p classification
$(CXX) classification.cc $(COMMON_SRC) -o classification/tflite_classification_arm $(LDFLAGS) $(LIBS) $(CXXFLAGS) $(CCFLAGS) $(INCLUDES)
segmentation/tflite_segmentation: segmentation.cc $(COMMON_SRC)
mkdir -p segmentation
$(CXX) segmentation.cc $(COMMON_SRC) -o segmentation/tflite_segmentation $(LDFLAGS) $(LIBS) $(CXXFLAGS) $(CCFLAGS) $(INCLUDES)
detection/tflite_detection_arm: detection.cc yolov5.cc yolov3.cc mobilenetssd.cc $(COMMON_SRC)
mkdir -p detection
$(CXX) detection.cc yolov5.cc yolov3.cc mobilenetssd.cc $(COMMON_SRC) -o detection/tflite_detection_arm $(LDFLAGS) $(LIBS) $(CXXFLAGS) $(CCFLAGS) $(INCLUDES)
clean:
rm -rf classification/tflite_classification_arm segmentation/tflite_segmentation detection/tflite_detection