1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

rust: provide examples for C library generation in rust

rust-c-lib-example is a little rust code which provide
a single function to print a formatted date (via the chrono crate)
from an input timestamp in millisecond. It has the necessary FFI
annotation and inherit cargo_c class for the C ABI compatible
library generation.

rust-c-lib-example is meson project for the C code which
will call the print_date function from rust-c-lib-example
if no argument is provided, if any argument is provided
it will print "Hello world in rust from C!"

add a runtime test case to check if all went well.

(From OE-Core rev: bb177c7764b1bc47157d57d7a34930e59a7acef3)

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Frederic Martinsons
2023-08-17 07:04:15 +02:00
committed by Richard Purdie
parent c318d1914e
commit 5116f2b2cf
4 changed files with 122 additions and 0 deletions
@@ -0,0 +1,15 @@
DESCRIPTION = "A simple example for rust C library"
HOMEPAGE = "https://gitlab.com/fmartinsonsHome/rust-c-lib-example"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=cb9c441273ed8a029701a086befbfc63"
SRC_URI = " \
git://gitlab.com/fmartinsonsHome/rust-c-lib-example.git;branch=main;protocol=https \
"
SRCREV = "fc53c457f69aa5221ec1f8619a007e8150db5e60"
S = "${WORKDIR}/git"
inherit cargo_c
require ${BPN}-crates.inc