[meta-zephyr][master][PATCH] zephyr.bbclass: Add support for Zephyr snippets

TOKITA Hiroshi <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
Introduce ZEPHYR_SNIPPETS, which accepts one or more snippet names
separated by spaces and passes them to CMake through SNIPPET.

Signed-off-by: TOKITA Hiroshi <[email protected]>
---
 meta-zephyr-core/classes-recipe/zephyr.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta-zephyr-core/classes-recipe/zephyr.bbclass b/meta-zephyr-core/classes-recipe/zephyr.bbclass
index cebde0b..f0e8d72 100644
--- a/meta-zephyr-core/classes-recipe/zephyr.bbclass
+++ b/meta-zephyr-core/classes-recipe/zephyr.bbclass
@@ -14,6 +14,11 @@ TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
 KCONFIG_CONFIG_COMMAND ??= "menuconfig"
 KCONFIG_CONFIG_ROOTDIR ??= "${B}"
 ZEPHYR_BOARD ?= "${MACHINE}"
+ZEPHYR_SNIPPETS ?= ""
+
+def zephyr_snippet_args(d):
+    snippets = (d.getVar('ZEPHYR_SNIPPETS') or '').split()
+    return (' -DSNIPPET=' + '\\;'.join(snippets)) if snippets else ''
 
 # qemuboot writes into IMGDEPLOYDIR, force to write to DEPLOY_DIR_IMAGE
 IMGDEPLOYDIR = "${DEPLOY_DIR_IMAGE}"
@@ -27,6 +32,7 @@ python () {
 }
 
 EXTRA_OECMAKE:append = " -DZEPHYR_MODULES=${ZEPHYR_MODULES}"
+EXTRA_OECMAKE:append = "${@zephyr_snippet_args(d)}"
 
 python do_menuconfig() {
     import shutil
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.