Skip to content

Yocto recipe example

Joel Guittet edited this page Jan 10, 2021 · 5 revisions

Yocto recipe example

The following Yocto recipe cote_1.0.0.bb can be used to build and install cote on an embedded device. It depends of discover, axon and amp recipes. It also depends of cjson cjson_1.7.14.bb recipe provided below (not available in all Yocto releases).

DESCRIPTION = "Zero-configuration microservices library in C"
AUTHOR = "Joel Guittet"
HOMEPAGE = "https://github.com/joelguittet/c-cote"
SECTION = "libs"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=69f6c60655b137621ee252a0f2cdb692"

inherit cmake pkgconfig

PR = "r0"

S = "${WORKDIR}/git"

# Dependencies
DEPENDS_${PN} = "cjson discover axon amp"
RDEPENDS_${PN} += "cjson discover axon amp"
do_compile[depends] = "cjson:do_populate_sysroot discover:do_populate_sysroot axon:do_populate_sysroot amp:do_populate_sysroot"

# Flags
CFLAGS += " -I${STAGING_DIR_TARGET}/usr/include/cjson/ -I${STAGING_DIR_TARGET}/usr/include/discover/ -I${STAGING_DIR_TARGET}/usr/include/axon/ -I${STAGING_DIR_TARGET}/usr/include/amp/"
CXXFLAGS += " -I${STAGING_DIR_TARGET}/usr/include/cjson/ -I${STAGING_DIR_TARGET}/usr/include/discover/ -I${STAGING_DIR_TARGET}/usr/include/axon/ -I${STAGING_DIR_TARGET}/usr/include/amp/"

# Sources
SRC_URI = " \
    git://github.com/joelguittet/c-cote.git;tag=${PV}-${PR} \
"

BBCLASSEXTEND = "native nativesdk"

DESCRIPTION = "Ultralightweight JSON parser in ANSI C"
AUTHOR = "Dave Gamble"
HOMEPAGE = "https://github.com/DaveGamble/cJSON"
SECTION = "libs"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=218947f77e8cb8e2fa02918dc41c50d0"

inherit cmake pkgconfig

PR = "r0"

S = "${WORKDIR}/git"

# CMake extras
EXTRA_OECMAKE += "\
    -DENABLE_CJSON_UTILS=ON \
    -DENABLE_CUSTOM_COMPILER_FLAGS=OFF \
    -DBUILD_SHARED_AND_STATIC_LIBS=ON \
"

# Sources
SRC_URI = " \
    git://github.com/DaveGamble/cJSON.git;tag=v${PV} \
"
    
BBCLASSEXTEND = "native nativesdk"

Clone this wiki locally