-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nnstreamer: sync from yocto3.1 [1/1]
PD#SWPL-158766 Problem: add nnstreamer in yocto. Solution: add new bb file and its dependencies. Verify: local Signed-off-by: yi.liu <[email protected]> Change-Id: Icdf8f909e776421b7de3274c76aebaa373649bea
- Loading branch information
1 parent
2515622
commit 743bfe9
Showing
18 changed files
with
1,371 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
SUMMARY = "Shell Script Automated Tester (unit testing executable files)" | ||
DESCRIPTION = "Shell Script Automated Tester (unit testing executable files)" | ||
|
||
SECTION = "Development" | ||
LICENSE = "Apache-2.0" | ||
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \ | ||
file://debian/copyright;md5=9ad9849cc2d52d5b8200d053d510e7d2" | ||
|
||
SRC_URI = "git://github.com/myungjoo/SSAT;branch=main;protocol=https" | ||
|
||
PV = "1.0.0+git${SRCPV}" | ||
SRCREV = "${AUTOREV}" | ||
|
||
S = "${WORKDIR}/git" | ||
|
||
do_install () { | ||
install -d ${D}${bindir} | ||
install -p -m 0755 ${S}/ssat.sh ${D}${bindir}/ | ||
install -p -m 0644 ${S}/ssat-api.sh ${D}${bindir}/ | ||
cd ${D}${bindir} | ||
ln -s ssat.sh ssat | ||
} | ||
|
||
sysroot_stage_all:append() { | ||
install -d ${SYSROOT_DESTDIR}${bindir} | ||
install -p -m 0755 ${D}${bindir}/ssat.sh ${SYSROOT_DESTDIR}${bindir} | ||
install -p -m 0755 ${D}${bindir}/ssat-api.sh ${SYSROOT_DESTDIR}${bindir} | ||
cd ${SYSROOT_DESTDIR}${bindir} | ||
ln -s ssat.sh ssat | ||
} | ||
|
||
FILES:${PN} += "${bindir}/ssat \ | ||
${bindir}/ssat.sh \ | ||
${bindir}/ssat-api.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
SUMMARY = "NNStreamer-Examlple" | ||
DESCRIPTION = "Example applications of nnstreamer. Note that we have to enable the 'apptest' CI module in the near future." | ||
SECTION = "AI" | ||
LICENSE = "LGPLv2.1" | ||
LIC_FILES_CHKSUM = "\ | ||
file://LICENSE;md5=a6f89e2100d9b6cdffcea4f398e37343 \ | ||
file://debian/copyright;md5=0462ef8fa89a1f53f2e65e74940519ef \ | ||
" | ||
|
||
DEPENDS = "\ | ||
orc-native \ | ||
glib-2.0 \ | ||
gstreamer1.0 \ | ||
gstreamer1.0-plugins-base \ | ||
python3 \ | ||
python3-numpy \ | ||
gtest \ | ||
json-glib \ | ||
" | ||
DEPENDS += "\ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow-lite','tensorflow-lite','',d)} \ | ||
" | ||
SRC_URI = "\ | ||
git://github.com/nnstreamer/nnstreamer-example.git;branch=main;protocol=https \ | ||
" | ||
|
||
SRCREV = "${AUTOREV}" | ||
|
||
S = "${WORKDIR}/git" | ||
|
||
inherit meson pkgconfig | ||
|
||
|
||
PACKAGECONFIG ??= "\ | ||
${@bb.utils.contains('DISTRO_FEATURES','opencv','opencv','',d)} \ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow','tensorflow','',d)} \ | ||
" | ||
|
||
|
||
INSANE_SKIP:${PN} += "dev-so" | ||
|
||
FILES:${PN} += "\ | ||
${libdir}/*.so \ | ||
${libdir}/gstreamer-1.0/*.so \ | ||
" | ||
|
||
|
||
|
||
PACKAGES =+ "\ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow-lite', \ | ||
'${PN}-tensorflow-lite', \ | ||
'', d)} \ | ||
" | ||
|
||
|
||
FILES:${PN}-tensorflow-lite += "\ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow-lite', \ | ||
'${libdir}/nnstreamer/filters/libnnstreamer_filter_tensorflow2-lite.so', \ | ||
'', d)} \ | ||
" | ||
RPROVIDES:${PN}-tensorflow-lite = "${libdir}/nnstreamer/filters/libnnstreamer_filter_tensorflow2-lite.so" | ||
|
||
|
||
|
||
RDEPENDS:${PN} = "\ | ||
glib-2.0 \ | ||
json-glib \ | ||
gstreamer1.0 \ | ||
gstreamer1.0-plugins-base \ | ||
python3 \ | ||
python3-numpy \ | ||
python3-math \ | ||
" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
SUMMARY = "NNStreamer, Stream Pipeline Paradigm for Nerual Network Applications" | ||
DESCRIPTION = "NNStreamer is a GStreamer plugin allowing to construct neural network applications with stream pipeline paradigm." | ||
SECTION = "AI" | ||
LICENSE = "LGPLv2.1" | ||
LIC_FILES_CHKSUM = "\ | ||
file://LICENSE;md5=c25e5c1949624d71896127788f1ba590 \ | ||
file://debian/copyright;md5=0462ef8fa89a1f53f2e65e74940519ef \ | ||
" | ||
|
||
DEPENDS = "\ | ||
orc-native \ | ||
glib-2.0 \ | ||
gstreamer1.0 \ | ||
gstreamer1.0-plugins-base \ | ||
python3 \ | ||
python3-numpy \ | ||
gtest \ | ||
json-glib \ | ||
" | ||
DEPENDS += "\ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow-lite','tensorflow-lite','',d)} \ | ||
" | ||
SRC_URI = "\ | ||
git://github.com/nnstreamer/nnstreamer.git;branch=main;protocol=https \ | ||
" | ||
|
||
PV = "2.1.0+git${SRCPV}" | ||
SRCREV = "${AUTOREV}" | ||
|
||
S = "${WORKDIR}/git" | ||
|
||
inherit meson pkgconfig | ||
|
||
EXTRA_OEMESON += "\ | ||
-Denable-test=true \ | ||
-Dinstall-test=true \ | ||
-Dskip-tflite-flatbuf-check=true \ | ||
-Denable-pbtxt-converter=false \ | ||
" | ||
|
||
PACKAGECONFIG ??= "\ | ||
${@bb.utils.contains('DISTRO_FEATURES','opencv','opencv','',d)} \ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow','tensorflow','',d)} \ | ||
" | ||
|
||
do_install:append() { | ||
rm -f ${D}/${bindir}/unittest-nnstreamer/tests/test_models/models/tvm* | ||
cd ${D}/${libdir} | ||
ln -sf ./gstreamer-1.0/libnnstreamer.so ./libnnstreamer.so | ||
} | ||
INSANE_SKIP:${PN} += "dev-so" | ||
|
||
FILES:${PN} += "\ | ||
${libdir}/*.so \ | ||
${libdir}/gstreamer-1.0/*.so \ | ||
${libdir}/nnstreamer/decoders/* \ | ||
${sysconfdir}/nnstreamer.ini \ | ||
" | ||
|
||
PACKAGES =+ "\ | ||
${PN}-unittest \ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow-lite', \ | ||
'${PN}-tensorflow-lite', \ | ||
'', d)} \ | ||
" | ||
|
||
FILES:${PN}-unittest += "\ | ||
${libdir}/nnstreamer/customfilters/* \ | ||
${bindir}/unittest-nnstreamer/* \ | ||
" | ||
|
||
FILES:${PN}-tensorflow-lite += "\ | ||
${@bb.utils.contains('DISTRO_FEATURES','tensorflow-lite', \ | ||
'${libdir}/nnstreamer/filters/libnnstreamer_filter_tensorflow2-lite.so', \ | ||
'', d)} \ | ||
" | ||
RPROVIDES:${PN}-tensorflow-lite = "${libdir}/nnstreamer/filters/libnnstreamer_filter_tensorflow2-lite.so" | ||
|
||
RDEPENDS:${PN}-unittest = "nnstreamer gstreamer1.0-plugins-good ssat" | ||
RDEPENDS:${PN}-unittest += "\ | ||
${@bb.utils.contains( \ | ||
'DISTRO_FEATURES','tensorflow-lite', \ | ||
'${libdir}/nnstreamer/filters/libnnstreamer_filter_tensorflow2-lite.so', \ | ||
'', d)} \ | ||
" | ||
|
||
RDEPENDS:${PN} = "\ | ||
glib-2.0 \ | ||
json-glib \ | ||
gstreamer1.0 \ | ||
gstreamer1.0-plugins-base \ | ||
python3 \ | ||
python3-numpy \ | ||
python3-math \ | ||
" | ||
|
||
RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'tensorflow-lite', 'nnstreamer-tensorflow-lite', '', d)}" | ||
|
||
FILES:${PN}-dev = "\ | ||
${includedir}/nnstreamer/* \ | ||
${libdir}/*.a \ | ||
${libdir}/pkgconfig/*.pc \ | ||
" |
127 changes: 127 additions & 0 deletions
127
...-nn/tensorflow-lite/files/0001-build-Add-bundle-static-lib-script-in-CMakeLists.txt.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
From 20a40c1f6aed4adba43af4b2a5b83a9a555f33ed Mon Sep 17 00:00:00 2001 | ||
From: Yongjoo Ahn <[email protected]> | ||
Date: Fri, 2 Dec 2022 15:24:57 +0900 | ||
Subject: [PATCH] [build] Add bundle static lib script in CMakeLists.txt | ||
|
||
- Modify cmake build scripts to build "whole-bundled" static library | ||
|
||
Change-Id: Icb823d8cf3b1727c2513404a038a3c6cc1166ffb | ||
Signed-off-by: Yongjoo Ahn <[email protected]> | ||
--- | ||
tensorflow/lite/CMakeLists.txt | 100 +++++++++++++++++++++++++++++++++ | ||
1 file changed, 100 insertions(+) | ||
|
||
diff --git tensorflow/lite/CMakeLists.txt tensorflow/lite/CMakeLists.txt | ||
index 073b29c4860..632862cccb2 100644 | ||
--- a/tensorflow/lite/CMakeLists.txt | ||
+++ b/tensorflow/lite/CMakeLists.txt | ||
@@ -535,6 +535,106 @@ target_link_libraries(tensorflow-lite | ||
${TFLITE_TARGET_DEPENDENCIES} | ||
) | ||
|
||
+# The libtensorflow-lite.a isn't self-contained since all the transitive dependencies are not included. | ||
+# Let libtensorflow-lite-bundled.a contains all the deps. | ||
+# The bundling snippet is from https://cristianadam.eu/20190501/bundling-together-static-libraries-with-cmake/ | ||
+function(bundle_static_library tgt_name bundled_tgt_name) | ||
+ list(APPEND static_libs ${tgt_name}) | ||
+ | ||
+ function(_recursively_collect_dependencies input_target) | ||
+ set(_input_link_libraries LINK_LIBRARIES) | ||
+ get_target_property(_input_type ${input_target} TYPE) | ||
+ if (${_input_type} STREQUAL "INTERFACE_LIBRARY") | ||
+ set(_input_link_libraries INTERFACE_LINK_LIBRARIES) | ||
+ endif() | ||
+ get_target_property(public_dependencies ${input_target} ${_input_link_libraries}) | ||
+ foreach(dependency IN LISTS public_dependencies) | ||
+ if(TARGET ${dependency}) | ||
+ get_target_property(alias ${dependency} ALIASED_TARGET) | ||
+ if (TARGET ${alias}) | ||
+ set(dependency ${alias}) | ||
+ endif() | ||
+ get_target_property(_type ${dependency} TYPE) | ||
+ if (${_type} STREQUAL "STATIC_LIBRARY") | ||
+ list(APPEND static_libs ${dependency}) | ||
+ endif() | ||
+ | ||
+ get_property(library_already_added | ||
+ GLOBAL PROPERTY _${tgt_name}_static_bundle_${dependency}) | ||
+ if (NOT library_already_added) | ||
+ set_property(GLOBAL PROPERTY _${tgt_name}_static_bundle_${dependency} ON) | ||
+ _recursively_collect_dependencies(${dependency}) | ||
+ endif() | ||
+ endif() | ||
+ endforeach() | ||
+ set(static_libs ${static_libs} PARENT_SCOPE) | ||
+ endfunction() | ||
+ | ||
+ _recursively_collect_dependencies(${tgt_name}) | ||
+ | ||
+ list(REMOVE_DUPLICATES static_libs) | ||
+ | ||
+ set(bundled_tgt_full_name | ||
+ ${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${bundled_tgt_name}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
+ | ||
+ if (CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|GNU)$") | ||
+ file(WRITE ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in | ||
+ "CREATE ${bundled_tgt_full_name}\n" ) | ||
+ | ||
+ foreach(tgt IN LISTS static_libs) | ||
+ file(APPEND ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in | ||
+ "ADDLIB $<TARGET_FILE:${tgt}>\n") | ||
+ endforeach() | ||
+ | ||
+ file(APPEND ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in "SAVE\n") | ||
+ file(APPEND ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in "END\n") | ||
+ | ||
+ file(GENERATE | ||
+ OUTPUT ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar | ||
+ INPUT ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in) | ||
+ | ||
+ set(ar_tool ${CMAKE_AR}) | ||
+ if (CMAKE_INTERPROCEDURAL_OPTIMIZATION) | ||
+ set(ar_tool ${CMAKE_CXX_COMPILER_AR}) | ||
+ endif() | ||
+ | ||
+ add_custom_command( | ||
+ COMMAND ${ar_tool} -M < ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar | ||
+ OUTPUT ${bundled_tgt_full_name} | ||
+ COMMENT "Bundling ${bundled_tgt_name}" | ||
+ VERBATIM) | ||
+ elseif(MSVC) | ||
+ find_program(lib_tool lib) | ||
+ | ||
+ foreach(tgt IN LISTS static_libs) | ||
+ list(APPEND static_libs_full_names $<TARGET_FILE:${tgt}>) | ||
+ endforeach() | ||
+ | ||
+ add_custom_command( | ||
+ COMMAND ${lib_tool} /NOLOGO /OUT:${bundled_tgt_full_name} ${static_libs_full_names} | ||
+ OUTPUT ${bundled_tgt_full_name} | ||
+ COMMENT "Bundling ${bundled_tgt_name}" | ||
+ VERBATIM) | ||
+ else() | ||
+ message(FATAL_ERROR "Unknown bundle scenario!") | ||
+ endif() | ||
+ | ||
+ add_custom_target(bundling_target ALL DEPENDS ${bundled_tgt_full_name}) | ||
+ add_dependencies(bundling_target ${tgt_name}) | ||
+ | ||
+ add_library(${bundled_tgt_name} STATIC IMPORTED) | ||
+ set_target_properties(${bundled_tgt_name} | ||
+ PROPERTIES | ||
+ IMPORTED_LOCATION ${bundled_tgt_full_name} | ||
+ INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${tgt_name},INTERFACE_INCLUDE_DIRECTORIES>) | ||
+ add_dependencies(${bundled_tgt_name} bundling_target) | ||
+ | ||
+endfunction() | ||
+ | ||
+if (NOT TFLITE_BUILD_SHARED_LIB) | ||
+ bundle_static_library(tensorflow-lite tensorflow-lite-bundled) | ||
+endif() | ||
+ | ||
if (NOT BUILD_SHARED_LIBS) | ||
list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DTFL_STATIC_LIBRARY_BUILD") | ||
endif() | ||
-- | ||
2.17.1 | ||
|
Oops, something went wrong.