From c583c40e7699f472d92fedd562ae799e74b0df4b Mon Sep 17 00:00:00 2001
From: Stefan Schmidt <stefan.schmidt@huawei.com>
Date: Thu, 10 Mar 2022 20:06:49 +0100
Subject: [PATCH] matter: add linux examples to build

Adding the currently available Matter example for Linux. This will give
us more test applications. Before we upstream this we would need to
decide if we want to split these off into a dedicated package.

Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
---
 ...all-Linux-examples-in-the-default-bu.patch | 36 +++++++++++++++++++
 .../recipes-connectivity/matter/matter_git.bb | 10 +++++-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 meta-oniro-staging/recipes-connectivity/matter/matter/0001-BUILD.gn-enbale-all-Linux-examples-in-the-default-bu.patch

diff --git a/meta-oniro-staging/recipes-connectivity/matter/matter/0001-BUILD.gn-enbale-all-Linux-examples-in-the-default-bu.patch b/meta-oniro-staging/recipes-connectivity/matter/matter/0001-BUILD.gn-enbale-all-Linux-examples-in-the-default-bu.patch
new file mode 100644
index 00000000..b922d207
--- /dev/null
+++ b/meta-oniro-staging/recipes-connectivity/matter/matter/0001-BUILD.gn-enbale-all-Linux-examples-in-the-default-bu.patch
@@ -0,0 +1,36 @@
+From 0c592f854ac44c8388f55e8e78b553d5a0976272 Mon Sep 17 00:00:00 2001
+From: Stefan Schmidt <stefan.schmidt@huawei.com>
+Date: Thu, 10 Mar 2022 18:07:05 +0100
+Subject: [PATCH] BUILD.gn: enbale all Linux examples in the default build
+
+Instead of doing extra builds for each example we enable the ones we are
+interested in by default.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
+---
+ BUILD.gn | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/BUILD.gn b/BUILD.gn
+index 09b8f2956..1334a45c8 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -107,6 +107,13 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
+       deps += [
+         ":certification",
+         "${chip_root}/examples/shell/standalone:chip-shell",
++        "${chip_root}/examples/all-clusters-app/linux:chip-all-clusters-app",
++        "${chip_root}/examples/thermostat/linux:thermostat-app",
++        "${chip_root}/examples/tv-app/linux:chip-tv-app",
++        "${chip_root}/examples/tv-casting-app/linux:chip-tv-casting-app",
++        "${chip_root}/examples/bridge-app/linux:chip-bridge-app",
++        "${chip_root}/examples/lighting-app/linux:chip-lighting-app",
++        "${chip_root}/examples/door-lock-app/linux:chip-door-lock-app",
+         "${chip_root}/src/app/tests/integration:chip-im-initiator",
+         "${chip_root}/src/app/tests/integration:chip-im-responder",
+         "${chip_root}/src/lib/address_resolve:address-resolve-tool",
+-- 
+2.35.1
+
diff --git a/meta-oniro-staging/recipes-connectivity/matter/matter_git.bb b/meta-oniro-staging/recipes-connectivity/matter/matter_git.bb
index 14dac22e..ec951de4 100644
--- a/meta-oniro-staging/recipes-connectivity/matter/matter_git.bb
+++ b/meta-oniro-staging/recipes-connectivity/matter/matter_git.bb
@@ -41,6 +41,7 @@ SRC_URI = "git://github.com/project-chip/connectedhomeip.git;protocol=https;name
            git://github.com/nestlabs/nlio.git;protocol=https;destsuffix=git/third_party/nlio/repo;name=nlio;branch=master \
            file://0001-projectmatter-use-Yocto-toolchain-and-flags.patch \
            file://0002-mbedtls-disable-building-integrated-library-in-Yocto.patch \
+           file://0001-BUILD.gn-enbale-all-Linux-examples-in-the-default-bu.patch \
            "
 
 PV = "0.0+git${SRCPV}"
@@ -60,7 +61,7 @@ GN_ARGS += "chip_enable_python_modules=false"
 
 # GCC v11 reports multiple problems that span across project's source code and
 # submodules. Temporarily disabling those warnings for the whole project
-TARGET_CFLAGS:append = " -Wno-format-truncation -Wno-stringop-truncation -Wno-format-security"
+TARGET_CFLAGS:append = " -Wno-format-truncation -Wno-stringop-truncation -Wno-format-security -Wno-unused-result"
 
 do_install() {
     install -d ${D}${bindir}
@@ -73,4 +74,11 @@ do_install() {
     install ${B}/chip-shell ${D}${bindir}
     install ${B}/chip-tool ${D}${bindir}
     install ${B}/spake2p ${D}${bindir}
+    install ${B}/chip-all-clusters-app ${D}${bindir}
+    install ${B}/chip-bridge-app ${D}${bindir}
+    install ${B}/chip-door-lock-app ${D}${bindir}
+    install ${B}/chip-lighting-app ${D}${bindir}
+    install ${B}/chip-tv-app ${D}${bindir}
+    install ${B}/chip-tv-casting-app ${D}${bindir}
+    install ${B}/thermostat-app ${D}${bindir}
 }
-- 
GitLab