From 018fd6aecf82409f5f652a24810cf68092ace406 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Wed, 15 Dec 2021 11:13:10 +0000 Subject: [PATCH] arm/trusted-firmware-m: use Ninja to build Ninja is a better Make. Add progress feedback and parallelisation options, reducing the time to build TF-M on my machine from 100s to 6s. Signed-off-by: Ross Burton Signed-off-by: Jon Mason --- .../trusted-firmware-m/trusted-firmware-m_1.5.0.bb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.5.0.bb b/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.5.0.bb index 8e795deb..fe3f729c 100644 --- a/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.5.0.bb +++ b/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.5.0.bb @@ -48,6 +48,7 @@ INHIBIT_DEFAULT_DEPS = "1" PACKAGE_ARCH = "${MACHINE_ARCH}" DEPENDS += "cmake-native \ + ninja-native \ python3-intelhex-native \ python3-jinja2-native \ python3-pyyaml-native \ @@ -88,6 +89,8 @@ EXTRA_OECMAKE += "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" EXTRA_OECMAKE += "-DMBEDCRYPTO_PATH=${S}/../mbedtls -DTFM_TEST_REPO_PATH=${S}/../tf-m-tests -DMCUBOOT_PATH=${S}/../mcuboot" +export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}" + # Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application CFLAGS[unexport] = "1" LDFLAGS[unexport] = "1" @@ -103,7 +106,7 @@ do_patch[postfuncs] += "apply_local_patches" do_configure[cleandirs] = "${B}" do_configure() { - cmake -G"Unix Makefiles" -S ${S} -B ${B} ${EXTRA_OECMAKE} ${PACKAGECONFIG_CONFARGS} + cmake -GNinja -S ${S} -B ${B} ${EXTRA_OECMAKE} ${PACKAGECONFIG_CONFARGS} } # Invoke install here as there's no point in splitting compile from install: the @@ -113,6 +116,7 @@ do_configure() { do_compile() { cmake --build ${B} -- install } +do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+" do_install() { # TODO install headers and static libraries when we know how they're used