diff mbox series

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

Message ID 20260430085357.2071082-1-tokita.hiroshi@gmail.com
State New
Headers show
Series [meta-zephyr,master] zephyr.bbclass: Add support for Zephyr snippets | expand

Commit Message

TOKITA Hiroshi April 30, 2026, 8:53 a.m. UTC
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 <tokita.hiroshi@gmail.com>
---
 meta-zephyr-core/classes-recipe/zephyr.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

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