2022-05-27 14:20:08 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# tensorflow-lite
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2022-12-07 20:16:34 +01:00
|
|
|
TENSORFLOW_LITE_VERSION = v2.11.0
|
2022-05-27 14:20:08 +02:00
|
|
|
TENSORFLOW_LITE_SITE = $(call github,tensorflow,tensorflow,$(TENSORFLOW_LITE_VERSION))
|
|
|
|
TENSORFLOW_LITE_SUBDIR = tensorflow/lite
|
2022-12-07 20:16:34 +01:00
|
|
|
TENSORFLOW_LITE_LICENSE = Apache-2.0
|
|
|
|
TENSORFLOW_LITE_LICENSE_FILES = LICENSE
|
2022-05-27 14:20:08 +02:00
|
|
|
|
|
|
|
TENSORFLOW_LITE_INSTALL_STAGING = YES
|
|
|
|
TENSORFLOW_LITE_SUPPORTS_IN_SOURCE_BUILD = NO
|
2022-12-07 20:16:34 +01:00
|
|
|
TENSORFLOW_LITE_DEPENDENCIES += \
|
|
|
|
host-pkgconf \
|
|
|
|
host-flatbuffers \
|
|
|
|
cpuinfo \
|
|
|
|
eigen \
|
|
|
|
farmhash \
|
|
|
|
fft2d \
|
|
|
|
flatbuffers \
|
|
|
|
gemmlowp \
|
|
|
|
libabseil-cpp \
|
|
|
|
neon2sse \
|
|
|
|
ruy \
|
|
|
|
xnnpack
|
|
|
|
|
|
|
|
TENSORFLOW_LITE_CONF_OPTS = \
|
|
|
|
-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -funsafe-math-optimizations \
|
|
|
|
-I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR) \
|
|
|
|
-I$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy/core/include \
|
|
|
|
-I$(STAGING_DIR)/usr/include/pybind11 \
|
|
|
|
-I$(STAGING_DIR)/usr/include/gemmlowp" \
|
|
|
|
-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -funsafe-math-optimizations \
|
|
|
|
-I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR) \
|
|
|
|
-I$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy/core/include \
|
|
|
|
-I$(STAGING_DIR)/usr/include/pybind11 \
|
|
|
|
-I$(STAGING_DIR)/usr/include/gemmlowp" \
|
|
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
|
|
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \
|
|
|
|
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
|
|
|
-Dabsl_DIR=$(STAGING_DIR)/usr/lib/cmake/absl \
|
|
|
|
-DEigen3_DIR=$(STAGING_DIR)/usr/share/eigen3/cmake \
|
|
|
|
-DFARMHASH_SOURCE_DIR=$(FARMHASH_DIR) \
|
|
|
|
-Dfarmhash_DIR=$(STAGING_DIR)/usr/lib \
|
|
|
|
-DFETCHCONTENT_FULLY_DISCONNECTED=ON \
|
|
|
|
-DFETCHCONTENT_QUIET=OFF \
|
|
|
|
-DFFT2D_SOURCE_DIR=$(STAGING_DIR)/usr/include/fft2d \
|
|
|
|
-DFlatBuffers_DIR=$(STAGING_DIR)/usr/lib/cmake/flatbuffers \
|
|
|
|
-DNEON_2_SSE_DIR=$(STAGING_DIR)/usr/lib/cmake/NEON_2_SSE \
|
|
|
|
-DTFLITE_ENABLE_EXTERNAL_DELEGATE=ON \
|
|
|
|
-DTFLITE_ENABLE_GPU=OFF \
|
|
|
|
-DTFLITE_ENABLE_INSTALL=ON \
|
|
|
|
-DTFLITE_ENABLE_MMAP=ON \
|
|
|
|
-DTFLITE_ENABLE_NNAPI=ON \
|
|
|
|
-DTFLITE_ENABLE_RUY=ON \
|
|
|
|
-DTFLITE_ENABLE_XNNPACK=ON
|
2022-05-27 14:20:08 +02:00
|
|
|
|
|
|
|
TENSORFLOW_LITE_MAKE_OPTS += _pywrap_tensorflow_interpreter_wrapper
|
|
|
|
|
2022-12-08 15:58:13 +01:00
|
|
|
TENSORFLOW_LITE_POST_INSTALL_TARGET_HOOKS = TENSORFLOW_LITE_INSTALL_TFLITE_RUNTIME
|
2022-05-27 14:20:08 +02:00
|
|
|
|
|
|
|
define TENSORFLOW_LITE_INSTALL_TFLITE_RUNTIME
|
2022-12-07 20:16:34 +01:00
|
|
|
|
|
|
|
mkdir -p $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime
|
|
|
|
mkdir -p $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime-2.11.0-py3.10.egg-info
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 755 $(@D)/$(TENSORFLOW_LITE_SUBDIR)/buildroot-build/_pywrap_tensorflow_interpreter_wrapper.so \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 755 $(@D)/$(TENSORFLOW_LITE_SUBDIR)/python/interpreter.py \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 755 $(@D)/$(TENSORFLOW_LITE_SUBDIR)/python/metrics/metrics_interface.py \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 755 $(@D)/$(TENSORFLOW_LITE_SUBDIR)/python/metrics/metrics_portable.py \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 755 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/tensorflow-lite/tflite_runtime/__init__.py \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 755 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/tensorflow-lite/tflite_runtime/MANIFEST.in \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/tensorflow-lite/tflite_runtime/dependency_links.txt \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime-2.11.0-py3.10.egg-info/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/tensorflow-lite/tflite_runtime/PKG-INFO \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime-2.11.0-py3.10.egg-info/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/tensorflow-lite/tflite_runtime/requires.txt \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime-2.11.0-py3.10.egg-info/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/tensorflow-lite/tflite_runtime/SOURCES.txt \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime-2.11.0-py3.10.egg-info/
|
|
|
|
|
|
|
|
$(INSTALL) -D -m 644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/tensorflow-lite/tflite_runtime/top_level.txt \
|
|
|
|
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/tflite_runtime-2.11.0-py3.10.egg-info/
|
2022-05-27 14:20:08 +02:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(cmake-package))
|