diff --git a/kas/iot2050.yml b/kas/iot2050.yml index ba472229f..82cd88e47 100644 --- a/kas/iot2050.yml +++ b/kas/iot2050.yml @@ -35,6 +35,9 @@ repos: url: https://gitlab.com/cip-project/cip-core/isar-cip-core.git commit: bafd102601ae21c2b2643d536d62fb7cc5f98767 + meta-hailo: + path: ${TOPDIR}/../meta-hailo + local_conf_header: standard: | CONF_VERSION = "1" diff --git a/kas/opt/meta-hailo.yml b/kas/opt/meta-hailo.yml new file mode 100644 index 000000000..b7ba9aeeb --- /dev/null +++ b/kas/opt/meta-hailo.yml @@ -0,0 +1,16 @@ +# +# Copyright (c) Siemens AG, 2024 +# +# Authors: +# Li Hua Qian +# +# This file is subject to the terms and conditions of the MIT License. See +# COPYING.MIT file in the top-level directory. +# + +header: + version: 14 + +repos: + meta-hailo: + path: ${TOPDIR}/../meta-hailo diff --git a/meta-hailo/MAINTAINERS.md b/meta-hailo/MAINTAINERS.md new file mode 100644 index 000000000..b32d992c5 --- /dev/null +++ b/meta-hailo/MAINTAINERS.md @@ -0,0 +1,5 @@ +# Maintainers + +- Diogo Ivo +- Felix Moessbauer +- Li Hua Qian diff --git a/meta-hailo/README.md b/meta-hailo/README.md new file mode 100644 index 000000000..d66bbc935 --- /dev/null +++ b/meta-hailo/README.md @@ -0,0 +1,25 @@ +# meta-hailo - Support for HAILO NPU chips + +This repo provides recipes to build the kernel and userspace drivers and utilities +for the Hailo-8 NPU chip. +This includes the following main components: + +- hailo-pci (OSS kernel module) +- hailo-firmware (proprietary firmware for hailo8 chip) +- hailort (Userspace API) + - hailortcli (tool) + - hailort (service) + - libhailort (c library) + - libhailort-dev (dev package) + - python3-hailort (python library) + +> Note: `numpy==1.23.3` was preinstalled. Please do not upgrade it, as +> `hailort v4.18.0` requires this specific version. Upgrading `numpy` may cause +> `pyhailort` to fail to execute. + +## Versioning + +This layer is versioned according to the major hailo driver version. +Note, that the kernel ABI is not stable and by that the version of the +userspace components need to perfectly match the version of the firmware +and the kernel module. diff --git a/meta-hailo/conf/layer.conf b/meta-hailo/conf/layer.conf new file mode 100644 index 000000000..e934e44e5 --- /dev/null +++ b/meta-hailo/conf/layer.conf @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +BBPATH .= ":${LAYERDIR}" + +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "hailo" +BBFILE_PATTERN_hailo = "^${LAYERDIR}/recipes-" +BBFILE_PRIORITY_hailo = "6" +LAYERVERSION_hailo = "3" + +LAYERSERIES_COMPAT_hailo = "next" + +LAYERDIR_hailo = "${LAYERDIR}" diff --git a/meta-hailo/kas/hailo-img-ci-amd64.yml b/meta-hailo/kas/hailo-img-ci-amd64.yml new file mode 100644 index 000000000..7e82b4664 --- /dev/null +++ b/meta-hailo/kas/hailo-img-ci-amd64.yml @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: Copyright 2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +header: + version: 10 + includes: + - kas/opt/hailo.inc.yml + +build_system: isar +machine: qemuamd64 +distro: debian-bookworm +target: hailo-image-ci + +local_conf_header: + default-user: | + USERS += "root" + USER_root[flags] += "clear-text-password" + USER_root[password] ??= "root" + ccache: | + USE_CCACHE = "1" diff --git a/meta-hailo/kas/hailo-packages-bookworm-amd64.yml b/meta-hailo/kas/hailo-packages-bookworm-amd64.yml new file mode 100644 index 000000000..d47eba16b --- /dev/null +++ b/meta-hailo/kas/hailo-packages-bookworm-amd64.yml @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +header: + version: 10 + includes: + - kas/opt/hailo.inc.yml + +build_system: isar +machine: qemuamd64 +distro: debian-bookworm +target: + - hailo-pci-amd64 + - hailo-firmware + - hailort diff --git a/meta-hailo/kas/hailo-packages-bookworm-arm64.yml b/meta-hailo/kas/hailo-packages-bookworm-arm64.yml new file mode 100644 index 000000000..7e56c0456 --- /dev/null +++ b/meta-hailo/kas/hailo-packages-bookworm-arm64.yml @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +header: + version: 10 + includes: + - kas/opt/hailo.inc.yml + +build_system: isar +machine: qemuarm64 +distro: debian-bookworm +target: + - hailo-pci-arm64 + - hailo-firmware + - hailort diff --git a/meta-hailo/kas/opt/hailo.inc.lock.yml b/meta-hailo/kas/opt/hailo.inc.lock.yml new file mode 100644 index 000000000..6a7a45e1e --- /dev/null +++ b/meta-hailo/kas/opt/hailo.inc.lock.yml @@ -0,0 +1,6 @@ +header: + version: 14 +overrides: + repos: + isar: + commit: 9dc362cd7115074c0f60843e687ed89db5c9339a diff --git a/meta-hailo/kas/opt/hailo.inc.yml b/meta-hailo/kas/opt/hailo.inc.yml new file mode 100644 index 000000000..46eac0080 --- /dev/null +++ b/meta-hailo/kas/opt/hailo.inc.yml @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +header: + version: 15 + +repos: + isar: + url: https://github.com/ilbers/isar.git + branch: next + layers: + meta: + meta-isar: + patches: + 01-kmod-cross: + repo: hailo + path: patches/isar/0001-auto-disable-cross-for-kmod-build-against-distro-ker.patch + + hailo: + +build_system: isar + +local_conf_header: + crossbuild: | + ISAR_CROSS_COMPILE = "1" diff --git a/meta-hailo/recipes-app/hailort/files/debian/control b/meta-hailo/recipes-app/hailort/files/debian/control new file mode 100644 index 000000000..bc2771f04 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/control @@ -0,0 +1,94 @@ +Source: hailort +Maintainer: Felix Moessbauer , Li Hua Qian +Section: devel +Priority: optional +Standards-Version: 4.6.1 +Build-Depends: + debhelper-compat (=13), + cmake, + bash-completion, + libspdlog-dev, + libprotobuf-dev, + nlohmann-json3-dev, + libgrpc-dev, + libgrpc++-dev, + libreaderwriterqueue-dev:native, + protobuf-compiler, + protobuf-compiler-grpc, + libbenchmark-dev, + dh-python, + libpython3-all-dev, + python3-all-dev:any, + pybind11-dev, + python3-setuptools, + python3-wheel:native, + python3-verboselogs (>= 1.7~), + libeigen3-dev, + pkg-config, + libglib2.0-dev, + libgstreamer1.0-dev, + libgstreamer-plugins-base1.0-dev + +Package: hailortcli +Architecture: any +Multi-Arch: foreign +Description: userspace API for running inference on the hailo8 chip (tool) +Depends: + libhailort, + ${misc:Depends}, + ${shlibs:Depends} +Suggests: + bash-completion + +Package: hailort +Architecture: any +Multi-Arch: foreign +Description: userspace API for running inference on the hailo8 chip (service) +Depends: + libhailort, + ${misc:Depends}, + ${shlibs:Depends} + +Package: libhailort +Architecture: any +Multi-Arch: same +Description: userspace API for running inference on the hailo8 chip (lib) +Depends: + ${misc:Depends}, + ${shlibs:Depends} + +Package: python3-hailort +Architecture: any +Multi-Arch: same +Description: userspace API for running inference on the hailo8 chip (python package) +Depends: + ${python3:Depends}, + ${misc:Depends}, + ${shlibs:Depends}, + python3-numpy (= 1.23.3) + +Package: libhailort-dev +Architecture: any +Multi-Arch: foreign +Description: userspace API for running inference on the hailo8 chip (dev) +Depends: + libhailort (=${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} + +Package: libgsthailo +Architecture: any +Multi-Arch: same +Description: hailort GStreamer element (HailoNet) (lib) +Depends: + ${misc:Depends}, + ${shlibs:Depends} + +Package: libgsthailo-dev +Architecture: any +Multi-Arch: foreign +Description: hailort GStreamer element (HailoNet) (dev) +Depends: + libgsthailo (=${binary:Version}), + ${misc:Depends}, + ${shlibs:Depends} \ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/debian/hailort.install b/meta-hailo/recipes-app/hailort/files/debian/hailort.install new file mode 100644 index 000000000..b4944ec20 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/hailort.install @@ -0,0 +1,4 @@ +etc/default/hailort_service +usr/bin/hailort_service +# erronous upstream install path, fix here +usr/usr/share/bash-completion/completions/hailortcli usr/share/bash-completion/completions/ diff --git a/meta-hailo/recipes-app/hailort/files/debian/hailort.service b/meta-hailo/recipes-app/hailort/files/debian/hailort.service new file mode 100644 index 000000000..c9ec090b2 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/hailort.service @@ -0,0 +1,16 @@ +[Unit] +Description=HailoRT service +Documentation=https://github.com/hailo-ai/hailort + +[Service] +Type=forking +EnvironmentFile=/etc/default/hailort_service +ExecStart=/usr/bin/hailort_service +Restart=on-failure +RemainAfterExit=yes +PIDFile=/run/hailo/hailort_service.pid +ExecReload=/bin/kill -HUP $MAINPID +ExecStartPost=/bin/sleep 0.1 + +[Install] +WantedBy=multi-user.target diff --git a/meta-hailo/recipes-app/hailort/files/debian/hailortcli.install b/meta-hailo/recipes-app/hailort/files/debian/hailortcli.install new file mode 100644 index 000000000..eb44e2a89 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/hailortcli.install @@ -0,0 +1 @@ +usr/bin/hailortcli diff --git a/meta-hailo/recipes-app/hailort/files/debian/libgsthailo-dev.install b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo-dev.install new file mode 100644 index 000000000..214678390 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo-dev.install @@ -0,0 +1 @@ +usr/include/gstreamer-1.0/gst/hailo/tensor_meta.hpp \ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/debian/libgsthailo.install b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo.install new file mode 100644 index 000000000..dc69f1301 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libgsthailo.install @@ -0,0 +1 @@ +usr/lib/aarch64-linux-gnu/libgsthailo.so \ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/debian/libhailort-dev.install b/meta-hailo/recipes-app/hailort/files/debian/libhailort-dev.install new file mode 100644 index 000000000..5527f1029 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libhailort-dev.install @@ -0,0 +1,3 @@ +usr/include/hailo +usr/lib/*/libhailort.so +usr/lib/*/cmake/HailoRT diff --git a/meta-hailo/recipes-app/hailort/files/debian/libhailort.install b/meta-hailo/recipes-app/hailort/files/debian/libhailort.install new file mode 100644 index 000000000..e98bce3f8 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/libhailort.install @@ -0,0 +1 @@ +usr/lib/*/libhailort.so.* diff --git a/meta-hailo/recipes-app/hailort/files/debian/libhailort.so.4.18.0 b/meta-hailo/recipes-app/hailort/files/debian/libhailort.so.4.18.0 new file mode 100644 index 000000000..780498b1b Binary files /dev/null and b/meta-hailo/recipes-app/hailort/files/debian/libhailort.so.4.18.0 differ diff --git a/meta-hailo/recipes-app/hailort/files/debian/not-installed b/meta-hailo/recipes-app/hailort/files/debian/not-installed new file mode 100644 index 000000000..1406d22b8 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/not-installed @@ -0,0 +1,3 @@ +usr/bin/hailo +usr/lib/systemd/system/hailort.service +usr/lib/python3.*/dist-packages/hailo_tutorials/* diff --git a/meta-hailo/recipes-app/hailort/files/debian/python3-hailort.install b/meta-hailo/recipes-app/hailort/files/debian/python3-hailort.install new file mode 100644 index 000000000..cb668641a --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/python3-hailort.install @@ -0,0 +1,2 @@ +usr/lib/python3*/dist-packages/hailort-*.egg-info +usr/lib/python3*/dist-packages/hailo_platform diff --git a/meta-hailo/recipes-app/hailort/files/debian/rules b/meta-hailo/recipes-app/hailort/files/debian/rules new file mode 100644 index 000000000..859bdf59a --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/debian/rules @@ -0,0 +1,27 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + +%: + dh $@ --with python3 + +ifeq ($(DEB_HOST_ARCH),arm64) + CMAKE_TOOLCHAIN_FILE := $(CURDIR)/hailort/libhailort/cmake/toolchains/linux.aarch64.cmake +endif + +override_dh_auto_configure: + dh_auto_configure --buildsystem=pybuild --sourcedir=hailort/libhailort/bindings/python/platform + dh_auto_configure --buildsystem=cmake -- \ + -DHAILO_BUILD_SERVICE=ON \ + -DHAILO_BUILD_GSTREAMER=ON \ + -DCMAKE_BUILD_TYPE=Release + +override_dh_auto_build: + CMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) \ + dh_auto_build --buildsystem=pybuild --sourcedir=hailort/libhailort/bindings/python/platform + dh_auto_build --buildsystem=cmake + +override_dh_auto_install: + CMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) \ + dh_auto_install --buildsystem=pybuild --sourcedirectory=hailort/libhailort/bindings/python/platform + dh_auto_install --buildsystem=cmake diff --git a/meta-hailo/recipes-app/hailort/files/patches/0001-do-not-use-spdlog-formatting-internals.patch b/meta-hailo/recipes-app/hailort/files/patches/0001-do-not-use-spdlog-formatting-internals.patch new file mode 100644 index 000000000..252a73e60 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0001-do-not-use-spdlog-formatting-internals.patch @@ -0,0 +1,122 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Fri, 12 Jan 2024 18:56:16 +0100 +Subject: [PATCH] do not use spdlog formatting internals + +As a preparation for using the packaged versions of spdlog, we need +to avoid including spdlog internal headers. These headers are only +available when using the builtin fmt library, but distros ususally +ship an external version of libfmt. Also, the external version is more +strict w.r.t formatting of enums by requiring either a formatter, or +an explicit cast to the underlaying integer type. For the sake of +simplicity, we introduce the cast. + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + hailort/common/utils.hpp | 4 +++- + .../resource_manager/resource_manager_builder.cpp | 3 ++- + .../libhailort/src/stream_common/nms_stream.cpp | 15 ++++++++++----- + .../libhailort/src/vdma/channel/channel_id.hpp | 2 +- + 4 files changed, 16 insertions(+), 8 deletions(-) + +diff --git a/hailort/common/utils.hpp b/hailort/common/utils.hpp +index 3eb719e2c13c..1de45bd0b325 100644 +--- a/hailort/common/utils.hpp ++++ b/hailort/common/utils.hpp +@@ -17,7 +17,8 @@ + #include "hailo/buffer.hpp" + + #include "common/logger_macros.hpp" +-#include ++#include ++#include + + #include + #include +@@ -26,6 +27,7 @@ + #include + #include + #include ++#include + + + namespace hailort +diff --git a/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp b/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp +index 0f8985f0ae77..627273b8bfe5 100644 +--- a/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp ++++ b/hailort/libhailort/src/core_op/resource_manager/resource_manager_builder.cpp +@@ -1096,7 +1096,8 @@ static Expected create_switch_lcu_batch_action(con + CHECK_AS_EXPECTED((ContextSwitchConfigAction::Type::EnableLcuDefault == action->get_type()) || + (ContextSwitchConfigAction::Type::SwitchLcuBatch == action->get_type()) || + (ContextSwitchConfigAction::Type::EnableLcuNonDefault == action->get_type()), HAILO_INVALID_ARGUMENT, +- "Invalid action type - must be enable lcu (default or non default) or switch lcu batch, Received type {}", action->get_type()); ++ "Invalid action type - must be enable lcu (default or non default), Received type {}", ++ static_cast(action->get_type())); + + TRY(const auto params_buffer, action->serialize_params(context_resources)); + +diff --git a/hailort/libhailort/src/stream_common/nms_stream.cpp b/hailort/libhailort/src/stream_common/nms_stream.cpp +index 79aa29c4b4d8..7d43948a1f1a 100644 +--- a/hailort/libhailort/src/stream_common/nms_stream.cpp ++++ b/hailort/libhailort/src/stream_common/nms_stream.cpp +@@ -77,7 +77,8 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + if (HAILO_BURST_TYPE_H8_PER_CLASS == burst_type) { + CHECK_IN_DEBUG((NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER == (*burst_state)) || + (NMSBurstState::NMS_BURST_STATE_WAITING_FOR_PADDING == (*burst_state)), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H8 NMS burst cannot receive delimeter while in state {}", (*burst_state)); ++ "Invalid state, H8 NMS burst cannot receive delimeter while in state {}", ++ static_cast(*burst_state)); + // To differentiate from H8 padding - where we should not increment amount of delimeters found + if ((*burst_state) == NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER) { + (*num_delimeters_received)++; +@@ -99,12 +100,14 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + + } else if (HAILO_BURST_TYPE_H15_PER_CLASS == burst_type) { + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 Per class NMS burst cannot receive delimeter while in state {}", (*burst_state)); ++ "Invalid state, H15 Per class NMS burst cannot receive delimeter while in state {}", ++ static_cast(*burst_state)); + (*num_delimeters_received)++; + *burst_state = NMSBurstState::NMS_BURST_STATE_WAITING_FOR_IMAGE_DELIMETER; + } else { + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_DELIMETER == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 Per Frame NMS burst cannot receive delimeter while in state {}", (*burst_state)); ++ "Invalid state, H15 Per Frame NMS burst cannot receive delimeter while in state {}", ++ static_cast(*burst_state)); + // in hailo15 per frame - if number of delimeter is same as num classes - we expect image delimeter next + // otherwise expect another delimeter + (*num_delimeters_received)++; +@@ -121,7 +124,8 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + "Invalid state, H8 NMS burst cannot receive image delimeter"); + + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_IMAGE_DELIMETER == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 NMS burst cannot receive image delimeter in state {}", (*burst_state)); ++ "Invalid state, H15 NMS burst cannot receive image delimeter in state {}", ++ static_cast(*burst_state)); + + // in both hailo15 per class and per frame - when receiving image delimeter we move to expecting padding + *burst_state = NMSBurstState::NMS_BURST_STATE_WAITING_FOR_PADDING; +@@ -143,7 +147,8 @@ hailo_status NMSStreamReader::advance_state_machine(NMSBurstState *burst_state, + { + if ((HAILO_BURST_TYPE_H15_PER_CLASS == burst_type) || (HAILO_BURST_TYPE_H15_PER_FRAME == burst_type)) { + CHECK_IN_DEBUG(NMSBurstState::NMS_BURST_STATE_WAITING_FOR_PADDING == (*burst_state), HAILO_NMS_BURST_INVALID_DATA, +- "Invalid state, H15 NMS burst cannot receive padding in state {}", (*burst_state)); ++ "Invalid state, H15 NMS burst cannot receive padding in state {}", ++ static_cast(*burst_state)); + } + // In case of padding next state is wait for padding unless it is last padding of burst - then next state will be + // Wait for delimeter - will only get to this stage in debug - in release once image delimeter is read we ignore rest of +diff --git a/hailort/libhailort/src/vdma/channel/channel_id.hpp b/hailort/libhailort/src/vdma/channel/channel_id.hpp +index 09fb0432edd3..9928c31a343a 100644 +--- a/hailort/libhailort/src/vdma/channel/channel_id.hpp ++++ b/hailort/libhailort/src/vdma/channel/channel_id.hpp +@@ -12,7 +12,7 @@ + + #include "hailo/hailort.h" + #include "common/logger_macros.hpp" +-#include ++#include + #include + + diff --git a/meta-hailo/recipes-app/hailort/files/patches/0002-use-distro-version-of-packages-if-possible.patch b/meta-hailo/recipes-app/hailort/files/patches/0002-use-distro-version-of-packages-if-possible.patch new file mode 100644 index 000000000..8ade3fed3 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0002-use-distro-version-of-packages-if-possible.patch @@ -0,0 +1,451 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Fri, 12 Jan 2024 18:12:26 +0100 +Subject: [PATCH] use distro version of packages if possible + +This patch replaces the vendored components with the version shipped +by the linux distribution (if possible). + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + hailort/CMakeLists.txt | 15 +++++- + hailort/hailort_server/CMakeLists.txt | 3 +- + hailort/hailort_service/CMakeLists.txt | 5 +- + hailort/hailortcli/CMakeLists.txt | 7 +-- + hailort/hrpc/server.cpp | 33 ++++++++++++ + hailort/hrpc_protocol/CMakeLists.txt | 2 +- + hailort/libhailort/CMakeLists.txt | 6 +-- + .../bindings/python/src/CMakeLists.txt | 21 +++----- + hailort/libhailort/src/CMakeLists.txt | 7 +-- + .../src/network_group/network_group.cpp | 33 ++++++++++++ + .../src/utils/measurement_utils.hpp | 2 +- + .../src/vdma/driver/hailort_driver.cpp | 52 +++++++++++++++++++ + hailort/prepare_externals/CMakeLists.txt | 11 ---- + hailort/rpc/CMakeLists.txt | 4 +- + 14 files changed, 149 insertions(+), 52 deletions(-) + +diff --git a/hailort/CMakeLists.txt b/hailort/CMakeLists.txt +index 5dcaa06c2537..edea76ee3804 100644 +--- a/hailort/CMakeLists.txt ++++ b/hailort/CMakeLists.txt +@@ -46,9 +46,20 @@ endif() + # TODO: move protobuf and grpc to inner cmake files + set(HAILO_EXTERNAL_DIR ${CMAKE_CURRENT_LIST_DIR}/external) + set(HAILO_EXTERNALS_CMAKE_SCRIPTS ${CMAKE_CURRENT_LIST_DIR}/cmake/external/) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/protobuf.cmake) ++find_package(Protobuf REQUIRED) ++find_package(nlohmann_json 3.9.1 REQUIRED) ++find_package(benchmark REQUIRED) ++find_package(spdlog 1.8 REQUIRED) ++find_package(Eigen3 REQUIRED) ++find_path(RWQ_FOUND name readerwriterqueue.h REQUIRED) + if(HAILO_BUILD_SERVICE) +- include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/grpc.cmake) ++ find_package(gRPC REQUIRED) ++endif() ++if(HAILO_BUILD_PYBIND) ++ find_package(pybind11 REQUIRED) ++endif() ++if(ENABLE_TESTING) ++ find_package(Catch2 REQUIRED) + endif() + + set(HAILORT_INC_DIR ${PROJECT_SOURCE_DIR}/hailort/libhailort/include) +diff --git a/hailort/hailort_server/CMakeLists.txt b/hailort/hailort_server/CMakeLists.txt +index d288066dc741..b9263c8282dc 100644 +--- a/hailort/hailort_server/CMakeLists.txt ++++ b/hailort/hailort_server/CMakeLists.txt +@@ -1,6 +1,5 @@ + cmake_minimum_required(VERSION 3.0.0) + +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) + include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/readerwriterqueue.cmake) + + set(THREADS_PREFER_PTHREAD_FLAG ON) +@@ -52,4 +51,4 @@ target_link_libraries(hailort_server PRIVATE + rpc_proto + spdlog::spdlog + readerwriterqueue +-) +\ No newline at end of file ++) +diff --git a/hailort/hailort_service/CMakeLists.txt b/hailort/hailort_service/CMakeLists.txt +index a470a3ddf0a0..4d3c52095f58 100644 +--- a/hailort/hailort_service/CMakeLists.txt ++++ b/hailort/hailort_service/CMakeLists.txt +@@ -1,7 +1,5 @@ + cmake_minimum_required(VERSION 3.0.0) + +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) +- + if(WIN32) + set(HAILORT_SERVICE_OS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/windows") + elseif(UNIX) +@@ -23,9 +21,8 @@ set_property(TARGET hailort_service PROPERTY CXX_STANDARD 14) + target_link_libraries(hailort_service + libhailort + spdlog::spdlog +- grpc++_unsecure ++ gRPC::grpc++_unsecure + hailort_rpc_grpc_proto +- readerwriterqueue + ) + if(WIN32) + # Needed in order to compile eth utils (we compile here ${HAILORT_COMMON_CPP_SOURCES}, consider removing) +diff --git a/hailort/hailortcli/CMakeLists.txt b/hailort/hailortcli/CMakeLists.txt +index 8b180dadc291..1add7146af56 100644 +--- a/hailort/hailortcli/CMakeLists.txt ++++ b/hailort/hailortcli/CMakeLists.txt +@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.0.0) + + include(GNUInstallDirs) + include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/cli11.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/json.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/readerwriterqueue.cmake) + include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/dotwriter.cmake) + + set(HAILORTCLI_CPP_FILES +@@ -69,10 +66,8 @@ set_property(TARGET hailortcli PROPERTY INSTALL_RPATH "$ORIGIN" "../lib/") # Lin + target_link_libraries(hailortcli + libhailort + CLI11::CLI11 +- nlohmann_json ++ nlohmann_json::nlohmann_json + spdlog::spdlog +- readerwriterqueue +- eigen + DotWriter + scheduler_mon_proto + profiler_proto) +diff --git a/hailort/hrpc/server.cpp b/hailort/hrpc/server.cpp +index 304c41c67a25..e72de4112f1a 100644 +--- a/hailort/hrpc/server.cpp ++++ b/hailort/hrpc/server.cpp +@@ -9,6 +9,39 @@ + + #include "server.hpp" + ++// Add a formatter spec for HailoRpcActionID ++template <> ++struct fmt::formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const HailoRpcActionID& id, FormatContext& ctx) { ++ std::string name; ++ switch (id) { ++ case HailoRpcActionID::VDEVICE__CREATE: name = "VDEVICE__CREATE"; break; ++ case HailoRpcActionID::VDEVICE__DESTROY: name = "VDEVICE__DESTROY"; break; ++ case HailoRpcActionID::VDEVICE__CREATE_INFER_MODEL: name = "VDEVICE__CREATE_INFER_MODEL"; break; ++ case HailoRpcActionID::INFER_MODEL__DESTROY: name = "INFER_MODEL__DESTROY"; break; ++ case HailoRpcActionID::INFER_MODEL__CREATE_CONFIGURED_INFER_MODEL: name = "INFER_MODEL__CREATE_CONFIGURED_INFER_MODEL"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__DESTROY: name = "CONFIGURED_INFER_MODEL__DESTROY"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SET_SCHEDULER_TIMEOUT: name = "CONFIGURED_INFER_MODEL__SET_SCHEDULER_TIMEOUT"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SET_SCHEDULER_THRESHOLD: name = "CONFIGURED_INFER_MODEL__SET_SCHEDULER_THRESHOLD"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SET_SCHEDULER_PRIORITY: name = "CONFIGURED_INFER_MODEL__SET_SCHEDULER_PRIORITY"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__GET_HW_LATENCY_MEASUREMENT: name = "CONFIGURED_INFER_MODEL__GET_HW_LATENCY_MEASUREMENT"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__ACTIVATE: name = "CONFIGURED_INFER_MODEL__ACTIVATE"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__DEACTIVATE: name = "CONFIGURED_INFER_MODEL__DEACTIVATE"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__SHUTDOWN: name = "CONFIGURED_INFER_MODEL__SHUTDOWN"; break; ++ case HailoRpcActionID::CONFIGURED_INFER_MODEL__RUN_ASYNC: name = "CONFIGURED_INFER_MODEL__RUN_ASYNC"; break; ++ case HailoRpcActionID::CALLBACK_CALLED: name = "CALLBACK_CALLED"; break; ++ case HailoRpcActionID::MAX_VALUE: name = "MAX_VALUE"; break; ++ default: name = "UNKNOWN"; break; ++ } ++ return format_to(ctx.out(), "{}", name); ++ } ++}; ++ + namespace hrpc + { + +diff --git a/hailort/hrpc_protocol/CMakeLists.txt b/hailort/hrpc_protocol/CMakeLists.txt +index d6b925ad1b87..591b3928be91 100644 +--- a/hailort/hrpc_protocol/CMakeLists.txt ++++ b/hailort/hrpc_protocol/CMakeLists.txt +@@ -4,7 +4,7 @@ protobuf_generate_cpp(PROTO_RPC_SRC PROTO_RPC_HEADER rpc.proto) + get_filename_component(PROTO_HEADER_DIRECTORY ${PROTO_RPC_HEADER} DIRECTORY) + + add_library(rpc_proto STATIC EXCLUDE_FROM_ALL ${PROTO_RPC_SRC} ${PROTO_RPC_HEADER}) +-target_link_libraries(rpc_proto libprotobuf-lite) ++target_link_libraries(rpc_proto protobuf::libprotobuf-lite) + set_target_properties(rpc_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + # https://github.com/protocolbuffers/protobuf/tree/master/cmake#notes-on-compiler-warnings +diff --git a/hailort/libhailort/CMakeLists.txt b/hailort/libhailort/CMakeLists.txt +index 33e183a98910..ab46f83483ad 100644 +--- a/hailort/libhailort/CMakeLists.txt ++++ b/hailort/libhailort/CMakeLists.txt +@@ -14,7 +14,7 @@ protobuf_generate_python(PROTO_HEF_PY hef.proto) # TODO (HRT-12504): Copy hef_pb + protobuf_generate_python(PROTO_HEF_PY tracer_profiler.proto) + + add_library(hef_proto ${PROTO_HEF_SRC} ${PROTO_HEF_HEADER} ${PROTO_HEF_PY}) +-target_link_libraries(hef_proto libprotobuf-lite) ++target_link_libraries(hef_proto protobuf::libprotobuf-lite) + set_target_properties(hef_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + # https://github.com/protocolbuffers/protobuf/tree/master/cmake#notes-on-compiler-warnings +@@ -33,7 +33,7 @@ endif() + + protobuf_generate_cpp(PROTO_SCHEDULER_MON_SRC PROTO_SCHEDULER_MON_HEADR scheduler_mon.proto) + add_library(scheduler_mon_proto ${PROTO_SCHEDULER_MON_SRC} ${PROTO_SCHEDULER_MON_HEADR}) +-target_link_libraries(scheduler_mon_proto libprotobuf-lite) ++target_link_libraries(scheduler_mon_proto protobuf::libprotobuf-lite) + set_target_properties(scheduler_mon_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + target_compile_options(scheduler_mon_proto PRIVATE /wd4244) +@@ -47,7 +47,7 @@ target_include_directories(scheduler_mon_proto + + protobuf_generate_cpp(PROTO_PROFILER_SRC PROTO_PROFILER_HEADR tracer_profiler.proto) + add_library(profiler_proto ${PROTO_PROFILER_SRC} ${PROTO_PROFILER_HEADR}) +-target_link_libraries(profiler_proto libprotobuf-lite) ++target_link_libraries(profiler_proto protobuf::libprotobuf-lite) + set_target_properties(profiler_proto PROPERTIES CXX_STANDARD 14 GENERATED TRUE POSITION_INDEPENDENT_CODE ON) + if(CMAKE_HOST_WIN32) + target_compile_options(profiler_proto PRIVATE /wd4244) +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index 1b5706c98862..913716297564 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -13,7 +13,6 @@ option(HAILORT_INCLUDE_DIR "Path to include dir of libhailort" "") + + include(ExternalProject) + include(GNUInstallDirs) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/pybind11.cmake) + include_directories(${HAILORT_COMMON_DIR}) + + FUNCTION(exclude_archive_libs_symbols target) # should be same as in common_compiler_options.cmake +@@ -26,19 +25,7 @@ FUNCTION(exclude_archive_libs_symbols target) # should be same as in common_comp + endif() + ENDFUNCTION() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +- if(NOT DEFINED PYBIND11_PYTHON_VERSION) +- message(FATAL_ERROR "PYBIND11_PYTHON_VERSION is not defined. To build _pyhailort, pass python version") +- endif() +- string(REPLACE "." "" dpython ${PYBIND11_PYTHON_VERSION}) # E.g "3.5" -> "35" +- if(${dpython} LESS "38") +- set(m_flag "m") +- else() +- set(m_flag "") +- endif() +- set(PYTHON_MODULE_EXTENSION ".cpython-${dpython}${m_flag}-${CMAKE_SYSTEM_PROCESSOR}-linux-gnu.so") +-endif() +- ++find_package(pybind11 REQUIRED) + pybind11_add_module(_pyhailort + pyhailort.cpp + device_api.cpp +@@ -82,8 +69,12 @@ if(LIBHAILORT_PATH AND HAILORT_INCLUDE_DIR) + elseif(LIBHAILORT_PATH OR HAILORT_INCLUDE_DIR) + message(FATAL_ERROR "Both LIBHAILORT_PATH and HAILORT_INCLUDE_DIR must be defined or none of them") + else() ++ message(STATUS "skip find_package, CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}") ++ message(STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}") + find_package(HailoRT 4.18.0 EXACT REQUIRED) +- target_link_libraries(_pyhailort PRIVATE HailoRT::libhailort) ++ ++ include_directories("${HAILORT_PROJECT_SOURCE_DIR}/hailort/libhailort/include") ++ target_link_libraries(_pyhailort PRIVATE libhailort) + endif() + + if(WIN32) +diff --git a/hailort/libhailort/src/CMakeLists.txt b/hailort/libhailort/src/CMakeLists.txt +index 5136024403c5..8a3e9b8e0a50 100644 +--- a/hailort/libhailort/src/CMakeLists.txt ++++ b/hailort/libhailort/src/CMakeLists.txt +@@ -5,9 +5,6 @@ find_package(Threads REQUIRED) + include(GNUInstallDirs) + include(CMakePackageConfigHelpers) + include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/common_compiler_options.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/spdlog.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/readerwriterqueue.cmake) +-include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/eigen.cmake) + + FUNCTION(relative_to_absolute_paths output) + SET(listVar "") +@@ -91,11 +88,11 @@ target_link_libraries(libhailort PRIVATE hef_proto) + target_link_libraries(libhailort PRIVATE profiler_proto) + target_link_libraries(libhailort PRIVATE scheduler_mon_proto) + target_link_libraries(libhailort PRIVATE spdlog::spdlog) +-target_link_libraries(libhailort PRIVATE readerwriterqueue) + target_link_libraries(libhailort PRIVATE Eigen3::Eigen) ++ + target_link_libraries(libhailort PRIVATE rpc_proto) + if(HAILO_BUILD_SERVICE) +- target_link_libraries(libhailort PRIVATE grpc++_unsecure) ++ target_link_libraries(libhailort PRIVATE gRPC::grpc++_unsecure) + target_link_libraries(libhailort PRIVATE hailort_rpc_grpc_proto) + endif() + if(CMAKE_SYSTEM_NAME STREQUAL QNX) +diff --git a/hailort/libhailort/src/network_group/network_group.cpp b/hailort/libhailort/src/network_group/network_group.cpp +index bc3de09bae4c..de1a2a06cd58 100644 +--- a/hailort/libhailort/src/network_group/network_group.cpp ++++ b/hailort/libhailort/src/network_group/network_group.cpp +@@ -27,6 +27,39 @@ + #include "utils/buffer_storage.hpp" + #include "hef/hef_internal.hpp" + ++namespace fmt { ++ // Add a formatter spec for BufferType ++ template <> ++ struct formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const hailort::BufferType& type, FormatContext& ctx) { ++ std::string type_str; ++ switch (type) { ++ case hailort::BufferType::UNINITIALIZED: ++ type_str = "UNINITIALIZED"; ++ break; ++ case hailort::BufferType::VIEW: ++ type_str = "VIEW"; ++ break; ++ case hailort::BufferType::PIX_BUFFER: ++ type_str = "PIX_BUFFER"; ++ break; ++ case hailort::BufferType::DMA_BUFFER: ++ type_str = "DMA_BUFFER"; ++ break; ++ default: ++ type_str = "UNKNOWN"; ++ break; ++ } ++ return fmt::format_to(ctx.out(), "{}", type_str); ++ } ++ }; ++} ++ + namespace hailort + { + +diff --git a/hailort/libhailort/src/utils/measurement_utils.hpp b/hailort/libhailort/src/utils/measurement_utils.hpp +index ae9e3fbfe8b5..6923c6d13e49 100644 +--- a/hailort/libhailort/src/utils/measurement_utils.hpp ++++ b/hailort/libhailort/src/utils/measurement_utils.hpp +@@ -87,7 +87,7 @@ + #define _HAILO_MEASUREMENT_UTILS_HPP_ + + #include "measurement_utils_internal.hpp" +-#include ++#include + + namespace hailort { + namespace utils { +diff --git a/hailort/libhailort/src/vdma/driver/hailort_driver.cpp b/hailort/libhailort/src/vdma/driver/hailort_driver.cpp +index 891eb92eb379..f7d3f1263f25 100755 +--- a/hailort/libhailort/src/vdma/driver/hailort_driver.cpp ++++ b/hailort/libhailort/src/vdma/driver/hailort_driver.cpp +@@ -25,6 +25,58 @@ + #error "unsupported platform!" + #endif + ++namespace fmt { ++ // Add a formatter spec for HailoRTDriver::PcieSessionType ++ template <> ++ struct formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const hailort::HailoRTDriver::PcieSessionType& type, FormatContext& ctx) { ++ std::string type_str; ++ switch (type) { ++ case hailort::HailoRTDriver::PcieSessionType::CLIENT: ++ type_str = "CLIENT"; ++ break; ++ case hailort::HailoRTDriver::PcieSessionType::SERVER: ++ type_str = "SERVER"; ++ break; ++ default: ++ type_str = "UNKNOWN"; ++ break; ++ } ++ return fmt::format_to(ctx.out(), "{}", type_str); ++ } ++ }; ++ ++ // Add a formatter spec for HailoRTDriver::DmaDirection ++ template <> ++ struct formatter { ++ constexpr auto parse(format_parse_context& ctx) { ++ return ctx.begin(); ++ } ++ ++ template ++ auto format(const hailort::HailoRTDriver::DmaBufferType& type, FormatContext& ctx) { ++ std::string type_str; ++ switch (type) { ++ case hailort::HailoRTDriver::DmaBufferType::USER_PTR_BUFFER: ++ type_str = "USER_PTR_BUFFER"; ++ break; ++ case hailort::HailoRTDriver::DmaBufferType::DMABUF_BUFFER: ++ type_str = "DMABUF_BUFFER"; ++ break; ++ default: ++ type_str = "UNKNOWN"; ++ break; ++ } ++ return fmt::format_to(ctx.out(), "{}", type_str); ++ } ++ }; ++} ++ + namespace hailort + { + +diff --git a/hailort/prepare_externals/CMakeLists.txt b/hailort/prepare_externals/CMakeLists.txt +index 6166c4ce4f0c..6f518610689f 100644 +--- a/hailort/prepare_externals/CMakeLists.txt ++++ b/hailort/prepare_externals/CMakeLists.txt +@@ -4,19 +4,8 @@ project(hailort_prebuild) + set(HAILO_EXTERNALS_EXCLUDE_TARGETS ON) + + message("Downloading dependencies to ${HAILO_EXTERNAL_DIR} ...") +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/pybind11.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/catch2.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/spdlog.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/json.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/dotwriter.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/benchmark.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/readerwriterqueue.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/eigen.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/cli11.cmake) +-include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/protobuf.cmake) +-if(HAILO_BUILD_SERVICE) +- include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/grpc.cmake) +-endif() + if(CMAKE_SYSTEM_NAME STREQUAL QNX) + include(${CMAKE_CURRENT_LIST_DIR}/../cmake/external/pevents.cmake) + endif() +diff --git a/hailort/rpc/CMakeLists.txt b/hailort/rpc/CMakeLists.txt +index 7823cb57f0ba..c2a89df1de43 100644 +--- a/hailort/rpc/CMakeLists.txt ++++ b/hailort/rpc/CMakeLists.txt +@@ -12,7 +12,7 @@ set(hailort_rpc_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/hailort_rpc.grpc.pb.h") + set(HAILO_PROTOBUF_PROTOC $) + if(HAILO_BUILD_SERVICE) + if(CMAKE_HOST_UNIX) +- set(HAILO_GRPC_CPP_PLUGIN_EXECUTABLE "${HAILO_EXTERNAL_DIR}/grpc-build/grpc_cpp_plugin") ++ set(HAILO_GRPC_CPP_PLUGIN_EXECUTABLE "$") + else() + set(HAILO_GRPC_CPP_PLUGIN_EXECUTABLE "${HAILO_EXTERNAL_DIR}/grpc-build/Release/grpc_cpp_plugin.exe") + endif() +@@ -36,7 +36,7 @@ add_library(hailort_rpc_grpc_proto STATIC EXCLUDE_FROM_ALL + ${hailort_rpc_proto_hdrs}) + + set_target_properties(hailort_rpc_grpc_proto PROPERTIES POSITION_INDEPENDENT_CODE ON) +-target_link_libraries(hailort_rpc_grpc_proto libprotobuf-lite grpc++_unsecure) ++target_link_libraries(hailort_rpc_grpc_proto protobuf::libprotobuf-lite gRPC::grpc++_unsecure) + # Include generated *.pb.h files + target_include_directories(hailort_rpc_grpc_proto PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") + disable_exceptions(hailort_rpc_grpc_proto) +\ No newline at end of file diff --git a/meta-hailo/recipes-app/hailort/files/patches/0003-install-independent-of-build-target.patch b/meta-hailo/recipes-app/hailort/files/patches/0003-install-independent-of-build-target.patch new file mode 100644 index 000000000..3ac36d526 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0003-install-independent-of-build-target.patch @@ -0,0 +1,107 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Sat, 13 Jan 2024 12:12:14 +0100 +Subject: [PATCH] install independent of build target + +Previously, cmake did only install the components when building the +Release target. However, the configuration should be selectable by the +user (or the distro). This patch removes this condition, so the user can +always install the currently built configuration. + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + hailort/hailort_service/CMakeLists.txt | 3 --- + hailort/hailortcli/CMakeLists.txt | 1 - + hailort/libhailort/bindings/gstreamer/CMakeLists.txt | 2 +- + hailort/libhailort/bindings/python/src/CMakeLists.txt | 2 -- + hailort/libhailort/doc/CMakeLists.txt | 2 +- + hailort/libhailort/src/CMakeLists.txt | 1 - + 6 files changed, 2 insertions(+), 9 deletions(-) + +diff --git a/hailort/hailort_service/CMakeLists.txt b/hailort/hailort_service/CMakeLists.txt +index 4d3c52095f58..5f7facc48c0b 100644 +--- a/hailort/hailort_service/CMakeLists.txt ++++ b/hailort/hailort_service/CMakeLists.txt +@@ -52,7 +52,6 @@ if (UNIX) + install( + FILES "${HAILORT_SERVICE_ENV_VARS_FILE}" + DESTINATION "${ENV_VARS_FILE_DIR}" +- CONFIGURATIONS Release + COMPONENT hailort_service + ) + +@@ -61,7 +60,6 @@ if (UNIX) + install( + FILES "${HAILORT_SERVICE_UNIT_FILE}" + DESTINATION "${SYSTEMD_UNIT_DIR}" +- CONFIGURATIONS Release + COMPONENT hailort_service + ) + endif() +@@ -69,7 +67,6 @@ endif() + install( + TARGETS hailort_service + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- CONFIGURATIONS Release + ) + + set(DAEMON_PID_DIR "/run/hailo") +diff --git a/hailort/hailortcli/CMakeLists.txt b/hailort/hailortcli/CMakeLists.txt +index 1add7146af56..4a2d5e751802 100644 +--- a/hailort/hailortcli/CMakeLists.txt ++++ b/hailort/hailortcli/CMakeLists.txt +@@ -88,6 +88,5 @@ target_include_directories(hailortcli + + install(TARGETS hailortcli + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- CONFIGURATIONS Release + ) + cli11_install_completion_file(hailortcli) +\ No newline at end of file +diff --git a/hailort/libhailort/bindings/gstreamer/CMakeLists.txt b/hailort/libhailort/bindings/gstreamer/CMakeLists.txt +index 5a601802738a..012e17c4bfea 100644 +--- a/hailort/libhailort/bindings/gstreamer/CMakeLists.txt ++++ b/hailort/libhailort/bindings/gstreamer/CMakeLists.txt +@@ -61,4 +61,4 @@ install(TARGETS gsthailo + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + # TODO: get gstreamer-1.0 in an automate way + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/gstreamer-1.0/gst/hailo/" +- CONFIGURATIONS Release) ++) +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index 913716297564..4d25762df8d9 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -99,6 +99,4 @@ add_dependencies(pyhailort_venv _pyhailort) + + install(TARGETS _pyhailort + LIBRARY DESTINATION ${HAILO_PYHAILORT_TARGET_DIR} +- CONFIGURATIONS Release + ) +- +diff --git a/hailort/libhailort/doc/CMakeLists.txt b/hailort/libhailort/doc/CMakeLists.txt +index 73d0964c5e6f..9f2ea9c2778c 100644 +--- a/hailort/libhailort/doc/CMakeLists.txt ++++ b/hailort/libhailort/doc/CMakeLists.txt +@@ -25,7 +25,7 @@ if(DOXYGEN_FOUND) + + install( + DIRECTORY "${DOXYGEN_OUTPUT_DIR}" DESTINATION "doc/" +- CONFIGURATIONS Release) ++ ) + + add_custom_target(doc ALL DEPENDS doxygen) + +diff --git a/hailort/libhailort/src/CMakeLists.txt b/hailort/libhailort/src/CMakeLists.txt +index 8a3e9b8e0a50..048fdd0ffe38 100644 +--- a/hailort/libhailort/src/CMakeLists.txt ++++ b/hailort/libhailort/src/CMakeLists.txt +@@ -163,7 +163,6 @@ target_compile_definitions(libhailort PUBLIC + + install(TARGETS libhailort + EXPORT HailoRTTargets +- CONFIGURATIONS Release + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/meta-hailo/recipes-app/hailort/files/patches/0004-install-python-bindings-into-dist-packages.patch b/meta-hailo/recipes-app/hailort/files/patches/0004-install-python-bindings-into-dist-packages.patch new file mode 100644 index 000000000..e20029fa1 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0004-install-python-bindings-into-dist-packages.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Moessbauer +Date: Tue, 16 Jan 2024 16:28:15 +0100 +Subject: [PATCH] install python bindings into dist-packages + +This patch installs the hailort python bindings into the python +site-packages location, so python can automatically find this +dependency. + +Signed-off-by: Felix Moessbauer +Signed-off-by: Li Hua Qian +--- + .../bindings/python/src/CMakeLists.txt | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index 4d25762df8d9..b96d64a77895 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -90,12 +90,19 @@ target_compile_options(_pyhailort PRIVATE ${HAILORT_COMPILE_OPTIONS}) + exclude_archive_libs_symbols(_pyhailort) + + # TODO (HRT-8637): change this hard-coded path +-set(HAILO_PYHAILORT_TARGET_DIR ${CMAKE_CURRENT_LIST_DIR}/../platform/hailo_platform/pyhailort/) ++if(WIN32) ++ set(HAILO_PYHAILORT_TARGET_DIR ${CMAKE_CURRENT_LIST_DIR}/../platform/hailo_platform/pyhailort/) ++else() ++ find_package(Python3 COMPONENTS Interpreter Development REQUIRED) ++ set(HAILO_PYHAILORT_TARGET_DIR "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/dist-packages/hailo_platform/pyhailort") ++endif() + +-add_custom_target(pyhailort_venv ALL +- COMMAND ${CMAKE_COMMAND} -E copy $ ${HAILO_PYHAILORT_TARGET_DIR} +-) +-add_dependencies(pyhailort_venv _pyhailort) ++if(WIN32) ++ add_custom_target(pyhailort_venv ALL ++ COMMAND ${CMAKE_COMMAND} -E copy $ ${HAILO_PYHAILORT_TARGET_DIR} ++ ) ++ add_dependencies(pyhailort_venv _pyhailort) ++endif() + + install(TARGETS _pyhailort + LIBRARY DESTINATION ${HAILO_PYHAILORT_TARGET_DIR} diff --git a/meta-hailo/recipes-app/hailort/files/patches/0005-Fix-cross-compilation-issue-for-pybuild.patch b/meta-hailo/recipes-app/hailort/files/patches/0005-Fix-cross-compilation-issue-for-pybuild.patch new file mode 100644 index 000000000..ec657e68c --- /dev/null +++ b/meta-hailo/recipes-app/hailort/files/patches/0005-Fix-cross-compilation-issue-for-pybuild.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Li Hua Qian +Date: Tue, 12 Nov 2024 16:56:33 +0800 +Subject: [PATCH] Fix cross-compilation issue for pybuild + +This patch fix the pybuild cross-comiplation issue. Since it is not +possible to use the previous intermediate artifacts in Isar, we rebuild +the libhailort in pybuild. + +Signed-off-by: Li Hua Qian +--- + hailort/libhailort/CMakeLists.txt | 3 ++ + .../bindings/python/src/CMakeLists.txt | 16 ++++++++- + hailort/libhailort/src/CMakeLists.txt | 35 ++++++++++++++++++- + 3 files changed, 52 insertions(+), 2 deletions(-) + +diff --git a/hailort/libhailort/CMakeLists.txt b/hailort/libhailort/CMakeLists.txt +index ab46f83483ad..259debb87301 100644 +--- a/hailort/libhailort/CMakeLists.txt ++++ b/hailort/libhailort/CMakeLists.txt +@@ -27,6 +27,9 @@ target_include_directories(hef_proto + $ + ) + ++if(NOT HAILO_BUILD_PROFILER) ++ option(HAILO_BUILD_PROFILER "Build hailort profiler" ON) ++endif() + if(HAILO_BUILD_PROFILER) + add_definitions( -DHAILO_ENABLE_PROFILER_BUILD ) + endif() +diff --git a/hailort/libhailort/bindings/python/src/CMakeLists.txt b/hailort/libhailort/bindings/python/src/CMakeLists.txt +index b96d64a77895..920c9395fd97 100644 +--- a/hailort/libhailort/bindings/python/src/CMakeLists.txt ++++ b/hailort/libhailort/bindings/python/src/CMakeLists.txt +@@ -15,6 +15,14 @@ include(ExternalProject) + include(GNUInstallDirs) + include_directories(${HAILORT_COMMON_DIR}) + ++if(NOT Protobuf_FOUND) ++ find_package(Protobuf REQUIRED) ++endif() ++if(NOT TARGET libhailort) ++ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../hrpc_protocol/ ${CMAKE_BINARY_DIR}/rpc_proto) ++ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../ ${CMAKE_BINARY_DIR}/libhailort) ++endif() ++ + FUNCTION(exclude_archive_libs_symbols target) # should be same as in common_compiler_options.cmake + if(WIN32) + # TODO: check if there are required actions for Windows +@@ -71,10 +79,16 @@ elseif(LIBHAILORT_PATH OR HAILORT_INCLUDE_DIR) + else() + message(STATUS "skip find_package, CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}") + message(STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}") +- find_package(HailoRT 4.18.0 EXACT REQUIRED) + + include_directories("${HAILORT_PROJECT_SOURCE_DIR}/hailort/libhailort/include") + target_link_libraries(_pyhailort PRIVATE libhailort) ++ target_compile_definitions( ++ _pyhailort ++ PUBLIC ++ HAILORT_MAJOR_VERSION=4 ++ HAILORT_MINOR_VERSION=18 ++ HAILORT_REVISION_VERSION=0 ++ ) + endif() + + if(WIN32) +diff --git a/hailort/libhailort/src/CMakeLists.txt b/hailort/libhailort/src/CMakeLists.txt +index 048fdd0ffe38..10809b150694 100644 +--- a/hailort/libhailort/src/CMakeLists.txt ++++ b/hailort/libhailort/src/CMakeLists.txt +@@ -38,7 +38,7 @@ if(HAILO_BUILD_SERVICE) + add_subdirectory(service) + endif() + +-set(common_dir "${PROJECT_SOURCE_DIR}/common/src") ++set(common_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../../common/src") + set(COMMON_C_SOURCES + ${common_dir}/firmware_status.c + ${common_dir}/md5.c +@@ -64,6 +64,12 @@ set(HAILORT_SRCS_ABS ${HAILORT_CPP_SOURCES} ${HAILORT_COMMON_CPP_SOURCES} ${COMM + SET_SOURCE_FILES_PROPERTIES(${C_SOURCES} PROPERTIES LANGUAGE CXX) + add_library(libhailort SHARED ${HAILORT_SRCS_ABS}) + ++if(NOT DEFINED FIRMWARE_VERSION_MAJOR) ++ add_definitions( -DFIRMWARE_VERSION_MAJOR=4 ) ++ add_definitions( -DFIRMWARE_VERSION_MINOR=18 ) ++ add_definitions( -DFIRMWARE_VERSION_REVISION=0 ) ++endif() ++ + # Include libraries + if(WIN32) + target_link_libraries(libhailort PRIVATE +@@ -87,7 +93,13 @@ target_link_libraries(libhailort PRIVATE Threads::Threads) + target_link_libraries(libhailort PRIVATE hef_proto) + target_link_libraries(libhailort PRIVATE profiler_proto) + target_link_libraries(libhailort PRIVATE scheduler_mon_proto) ++if(NOT spdlog_FOUND) ++ find_package(spdlog REQUIRED) ++endif() + target_link_libraries(libhailort PRIVATE spdlog::spdlog) ++if(NOT Eigen3_FOUND) ++ find_package(Eigen3 REQUIRED) ++endif() + target_link_libraries(libhailort PRIVATE Eigen3::Eigen) + + target_link_libraries(libhailort PRIVATE rpc_proto) +@@ -143,6 +155,27 @@ target_compile_options(libhailort PRIVATE ${HAILORT_COMPILE_OPTIONS}) + disable_exceptions(libhailort) + exclude_archive_libs_symbols(libhailort) + ++if(NOT HAILORT_INC_DIR) ++ set(HAILORT_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../include") ++endif() ++if(NOT HAILORT_COMMON_DIR) ++ set(HAILORT_COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../") ++endif() ++if(NOT HAILORT_SRC_DIR) ++ set(HAILORT_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++endif() ++if(NOT COMMON_INC_DIR) ++ set(COMMON_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../common/include") ++endif() ++if(NOT DRIVER_INC_DIR) ++ set(DRIVER_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../drivers/common") ++endif() ++if(NOT RPC_DIR) ++ set(RPC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../rpc") ++endif() ++if(NOT HRPC_DIR) ++ set(HRPC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../hrpc") ++endif() + target_include_directories(libhailort + PUBLIC + $ +-- +2.34.1 + diff --git a/meta-hailo/recipes-app/hailort/hailort_4.18.0.bb b/meta-hailo/recipes-app/hailort/hailort_4.18.0.bb new file mode 100644 index 000000000..2b8249db0 --- /dev/null +++ b/meta-hailo/recipes-app/hailort/hailort_4.18.0.bb @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: Copyright 2023-2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +DESCRIPTION = "userspace API for running inference on the hailo8 chip" + +LICENSE = "MIT" + +inherit dpkg + +HAILO_EXTERNAL_DIR = "${P}/hailort/external" + +SRC_URI = " \ + git://git@github.com/hailo-ai/hailort.git;protocol=https;branch=master;name=hailort;destsuffix=${P} \ + git://github.com/hailo-ai/CLI11.git;protocol=https;nobranch=1;name=cli11;destsuffix=${HAILO_EXTERNAL_DIR}/cli11-src \ + git://github.com/hailo-ai/DotWriter.git;protocol=https;nobranch=1;name=dotwriter;destsuffix=${HAILO_EXTERNAL_DIR}/dotwriter-src" +SRC_URI += " \ + file://patches/0001-do-not-use-spdlog-formatting-internals.patch \ + file://patches/0002-use-distro-version-of-packages-if-possible.patch \ + file://patches/0003-install-independent-of-build-target.patch \ + file://patches/0004-install-python-bindings-into-dist-packages.patch \ + file://patches/0005-Fix-cross-compilation-issue-for-pybuild.patch \ +" + +SRC_URI += " \ + file://debian/control \ + file://debian/hailort.install \ + file://debian/hailort.service \ + file://debian/hailortcli.install \ + file://debian/libhailort-dev.install \ + file://debian/libhailort.install \ + file://debian/python3-hailort.install \ + file://debian/libgsthailo.install \ + file://debian/libgsthailo-dev.install \ + file://debian/not-installed \ + file://debian/rules \ + file://debian/libhailort.so.4.18.0 \ +" + +DEPENDS += "python3-verboselogs python3-numpy" +PROVIDES += "hailortcli libhailort libhailort-dev python3-hailort libgsthailo libgsthailo-dev" + +SRCREV_hailort = "01e4c7f5a7463cc61ef1b2d22c31dd80a3a07d95" +SRCREV_cli11 = "ae78ac41cf225706e83f57da45117e3e90d4a5b4" +SRCREV_dotwriter = "e5fa8f281adca10dd342b1d32e981499b8681daf" + +S = "${WORKDIR}/${P}" + +do_prepare_build[cleandirs] += "${S}/debian" +do_prepare_build() { + deb_debianize + rm -f ${S}/debian/compat + cp -r ${WORKDIR}/debian/* ${S}/debian/ +} diff --git a/meta-hailo/recipes-bsp/hailo-firmware/hailo-firmware_4.18.0.bb b/meta-hailo/recipes-bsp/hailo-firmware/hailo-firmware_4.18.0.bb new file mode 100644 index 000000000..e6189e98e --- /dev/null +++ b/meta-hailo/recipes-bsp/hailo-firmware/hailo-firmware_4.18.0.bb @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +DESCRIPTION = "hailo firmware - hailo8 chip firmware (hailo_fw.bin)" + +BASE_URI = "https://hailo-hailort.s3.eu-west-2.amazonaws.com" +FW_AWS_DIR = "Hailo8/${PV}/FW" +FW = "hailo8_fw.${PV}.bin" +LICENSE_FILE = "LICENSE" + +SRC_URI = "${BASE_URI}/${FW_AWS_DIR}/${FW};name=firmware \ + ${BASE_URI}/${FW_AWS_DIR}/${LICENSE_FILE};name=license" +SRC_URI[firmware.sha256sum] = "bfa576dd782359d74cabcb19e87c3a934dce03dea0785e41f86fecc9a687a92b" +SRC_URI[license.md5sum] = "263ee034adc02556d59ab1ebdaea2cda" + +LICENSE = "LICENSE" +LIC_FILES_CHKSUM = "file://${WORKDIR}/${LICENSE_FILE};md5=263ee034adc02556d59ab1ebdaea2cda" + +FW_PATH = "${WORKDIR}/${FW}" + +DPKG_ARCH = "all" + +inherit dpkg-raw + +do_install() { + # Stores hailo8_fw.bin in the rootfs under /lib/firmware/hailo/ + install -d ${D}/lib/firmware/hailo + install -m 0644 ${FW_PATH} ${D}/lib/firmware/hailo/hailo8_fw.bin +} diff --git a/meta-hailo/recipes-core/images/hailo-image-ci.bb b/meta-hailo/recipes-core/images/hailo-image-ci.bb new file mode 100644 index 000000000..c9aa0e95b --- /dev/null +++ b/meta-hailo/recipes-core/images/hailo-image-ci.bb @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: Copyright 2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +inherit image + +DESCRIPTION = "CI test image for HAILO" + +IMAGE_INSTALL += " \ + hailo-pci-${KERNEL_NAME} \ + hailo-firmware \ + hailortcli \ + python3-hailort \ +" diff --git a/meta-hailo/recipes-kernel/hailo-pci/hailo-pci_4.18.0.bb b/meta-hailo/recipes-kernel/hailo-pci/hailo-pci_4.18.0.bb new file mode 100644 index 000000000..0d6fea739 --- /dev/null +++ b/meta-hailo/recipes-kernel/hailo-pci/hailo-pci_4.18.0.bb @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: Copyright 2023 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License +DESCRIPTION = "hailo pcie driver - the kernel driver for pci communication with hailo8" + +LICENSE = "gpl-2.0" +LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" + +SRC_URI = "git://git@github.com/hailo-ai/hailort-drivers.git;protocol=https;branch=master" +SRCREV = "7161f9ee5918029bd4497f590003c2f87ec32507" + +require recipes-kernel/linux-module/module.inc + +S = "${WORKDIR}/git" +MODULE_DIR = "$(PWD)/linux/pcie" + +do_prepare_build:append() { + cp ${S}/linux/pcie/51-hailo-udev.rules ${S}/debian/${BPN}.udev +} diff --git a/meta-hailo/recipes-python/python-numpy/files/debian/control b/meta-hailo/recipes-python/python-numpy/files/debian/control new file mode 100644 index 000000000..d177df477 --- /dev/null +++ b/meta-hailo/recipes-python/python-numpy/files/debian/control @@ -0,0 +1,26 @@ +Source: python-numpy +Section: python +Priority: optional +Maintainer: Li Hua Qian +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-setuptools (>= 42), + libpython3-all-dev (>= 3.2), + python3-all-dev:any (>= 3.2), + python3-wheel:native, + cython3 +Standards-Version: 4.6.1 +Homepage: https://numpy.org/ +Vcs-Browser: https://github.com/numpy/numpy +Vcs-Git: https://github.com/numpy/numpy.git +Rules-Requires-Root: no + +Package: python3-numpy +Architecture: all +Multi-Arch: foreign +Depends: + ${python3:Depends}, + ${misc:Depends} +Description: NumPy is the fundamental package for array computing with Python. + NumPy is the fundamental package needed for scientific computing with Python. + This package contains the Python 3 version of NumPy. diff --git a/meta-hailo/recipes-python/python-numpy/files/debian/rules b/meta-hailo/recipes-python/python-numpy/files/debian/rules new file mode 100644 index 000000000..7e885da82 --- /dev/null +++ b/meta-hailo/recipes-python/python-numpy/files/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f + +export PYBUILD_NAME=numpy + +%: + set -x + dh $@ --with python3 --buildsystem=pybuild + +override_dh_auto_configure: + python3 setup.py build + +override_dh_auto_clean: + echo "setup.py clean is not supported" \ No newline at end of file diff --git a/meta-hailo/recipes-python/python-numpy/python-numpy_1.23.3.bb b/meta-hailo/recipes-python/python-numpy/python-numpy_1.23.3.bb new file mode 100644 index 000000000..6749f2119 --- /dev/null +++ b/meta-hailo/recipes-python/python-numpy/python-numpy_1.23.3.bb @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Copyright 2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License + +inherit dpkg + +SRC_URI = "https://github.com/numpy/numpy/archive/refs/tags/v1.23.3.tar.gz" +SRC_URI[sha256sum] = "d55da69341fd6e617ada55feec6798730457f26f08300956625c086499aced7e" + +SRC_URI += " \ + file://debian/control \ + file://debian/rules \ +" + +S = "${WORKDIR}/numpy-1.23.3" + +PROVIDES += "python3-numpy" + +DEB_BUILD_PROFILES = "nocheck" +DEB_BUILD_OPTIONS = "nocheck" + +do_prepare_build[cleandirs] += "${S}/debian" +do_prepare_build() { + deb_debianize + rm -f ${S}/debian/compat + cp ${WORKDIR}/debian/control \ + ${WORKDIR}/debian/rules \ + ${S}/debian/ +} \ No newline at end of file diff --git a/meta-hailo/recipes-python/python-verboselogs/files/debian/control b/meta-hailo/recipes-python/python-verboselogs/files/debian/control new file mode 100644 index 000000000..ccee6b70f --- /dev/null +++ b/meta-hailo/recipes-python/python-verboselogs/files/debian/control @@ -0,0 +1,22 @@ +Source: python-verboselogs +Section: python +Priority: optional +Maintainer: Felix Moessbauer +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-setuptools (>=42), + libpython3-all-dev (>=3.2), + python3-all-dev:any (>=3.2), + python3-wheel:native, +Standards-Version: 4.6.1 +Homepage: https://verboselogs.readthedocs.io/ +Vcs-Browser: https://github.com/xolox/python-verboselogs +Vcs-Git: https://github.com/xolox/python-verboselogs.git +Rules-Requires-Root: no + +Package: python3-verboselogs +Architecture: all +Multi-Arch: foreign +Depends: ${python3:Depends}, ${misc:Depends} +Description: extends Pythons logging module to add the log levels + The levels NOTICE, SPAM, SUCCESS and VERBOSE are added diff --git a/meta-hailo/recipes-python/python-verboselogs/files/debian/rules b/meta-hailo/recipes-python/python-verboselogs/files/debian/rules new file mode 100644 index 000000000..a6e3156fe --- /dev/null +++ b/meta-hailo/recipes-python/python-verboselogs/files/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export PYBUILD_NAME=verboselogs + +%: + dh $@ --with python3 --buildsystem=pybuild diff --git a/meta-hailo/recipes-python/python-verboselogs/python-verboselogs_1.7.bb b/meta-hailo/recipes-python/python-verboselogs/python-verboselogs_1.7.bb new file mode 100644 index 000000000..eb2a53a05 --- /dev/null +++ b/meta-hailo/recipes-python/python-verboselogs/python-verboselogs_1.7.bb @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: Copyright 2024 Siemens AG +# SPDX-License-Identifier: LicenseRef-Siemens-Inner-Source-License + +# Warning: This package seems abandoned. Latest commit is from 7 years ago + +inherit dpkg + +SRC_URI = "git://github.com/xolox/python-verboselogs.git;protocol=https;branch=master" +SRCREV ="3cebc69e03588bb6c3726c38c324b12732989292" + +SRC_URI += " \ + file://debian/control \ + file://debian/rules \ +" + +S = "${WORKDIR}/git" + +PROVIDES += "python3-verboselogs" + +DEB_BUILD_PROFILES = "nocheck" +DEB_BUILD_OPTIONS = "nocheck" + +do_prepare_build[cleandirs] += "${S}/debian" +do_prepare_build() { + deb_debianize + rm -f ${S}/debian/compat + cp ${WORKDIR}/debian/control \ + ${WORKDIR}/debian/rules \ + ${S}/debian/ +} diff --git a/recipes-core/images/iot2050-image-example.bb b/recipes-core/images/iot2050-image-example.bb index a3195aa83..08617e60e 100644 --- a/recipes-core/images/iot2050-image-example.bb +++ b/recipes-core/images/iot2050-image-example.bb @@ -43,6 +43,15 @@ IMAGE_INSTALL += " \ tee-supplicant \ iot2050-event-record \ linux-headers-${KERNEL_NAME} \ + hailo-pci-${KERNEL_NAME} \ + hailo-firmware \ + hailortcli \ + libhailort \ + libhailort-dev \ + libgsthailo \ + libgsthailo-dev \ + python3-hailort \ + hailort \ " IOT2050_NODE_RED_SUPPORT ?= "1"