From d1e39f8229ec3a7ed24f9b4284310517aa6b69a7 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek <zbigniew.bodek@huawei.com> Date: Tue, 22 Dec 2020 15:30:48 +0000 Subject: [PATCH] Improve TARGET_ADAPTER selection using python function Add get_target_adapter() to return proper TARGET_ADAPTER type for linux, liteos_a or liteos_m. Raise an exception when the target system is not supported. Signed-off-by: Zbigniew Bodek <zbigniew.bodek@huawei.com> --- recipes-samgr/samgr/samgr_git.bb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/recipes-samgr/samgr/samgr_git.bb b/recipes-samgr/samgr/samgr_git.bb index 86aef0bc..a9c8b60f 100644 --- a/recipes-samgr/samgr/samgr_git.bb +++ b/recipes-samgr/samgr/samgr_git.bb @@ -18,8 +18,17 @@ S = "${WORKDIR}/git" CFLAGS_SAMGR = "${CFLAGS} -I${S}/samgr/adapter -I${S}/samgr -I${S}/samgr/source -I${S}/samgr/registry -fPIC -shared" LDFLAGS_SAMGR = "${LDFLAGS} -lsec -pthread -L${B} -Wl,-soname,lib${PN}.so.${PVMAJOR}" -# Note: modify this when adapting to LiteOS -TARGET_ADAPTER = '${@ "posix" if "linux" in d.getVar("TARGET_OS", False) else "cmsis"}' +def get_target_adapter(d): + targetOs = d.getVar('TARGET_OS', True) + if targetOs == "linux" or targetOs == "liteos_a": + targetAdapter = "posix" + elif targetOs == "liteos_m": + targetAdapter = "cmsis" + else: + raise bb.parse.SkipPackage("OS '%s' is not supported by ohos-foundation" % targetOs) + return targetAdapter + +TARGET_ADAPTER = "${@get_target_adapter(d)}" do_compile () { ${CC} ${CFLAGS_SAMGR} ${LDFLAGS_SAMGR} \ -- GitLab