From: Adrian Freihofer <adrian.freihofer@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH v4 04/13] cmake.bbclass: support qemu
Date: Sun, 27 Aug 2023 21:29:46 +0200 [thread overview]
Message-ID: <20230827193200.4083340-5-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20230827193200.4083340-1-adrian.freihofer@siemens.com>
Define the CMAKE_CROSSCOMPILING_EMULATOR variable similar to what the
meson bbclass does. This allows for example to execute cross compilied
unit tests on the build machine.
CMAKE_CROSSCOMPILING_EMULATOR is a semi colon separated list of
paramters which could directly handle the -L and the -E parameters.
Creating a wrapper script is not absolutely mandatory. But anyway lets
do it similar to what the meson.bbclass does and also disable pseudo.
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
meta/classes-recipe/cmake.bbclass | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/meta/classes-recipe/cmake.bbclass b/meta/classes-recipe/cmake.bbclass
index c63b0a80b18..944b0d8fefd 100644
--- a/meta/classes-recipe/cmake.bbclass
+++ b/meta/classes-recipe/cmake.bbclass
@@ -4,6 +4,13 @@
# SPDX-License-Identifier: MIT
#
+inherit qemu
+
+EXEWRAPPER_ENABLED:class-native = "False"
+EXEWRAPPER_ENABLED:class-nativesdk = "False"
+EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}"
+DEPENDS:append = "${@' qemu-native' if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ''}"
+
# Path to the CMake file to process.
OECMAKE_SOURCEPATH ??= "${S}"
@@ -156,6 +163,20 @@ EOF
addtask generate_toolchain_file after do_patch before do_configure
+cmake_do_generate_toolchain_file:append:class-target() {
+ if [ "${EXEWRAPPER_ENABLED}" = "True" ]; then
+ # Write out a qemu wrapper that will be used as exe_wrapper so that camake
+ # can run target helper binaries through that. This also allows to execute ctest.
+ qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}"
+ echo "#!/bin/sh" > "${WORKDIR}/cmake-qemuwrapper"
+ echo "$qemu_binary \"\$@\"" >> "${WORKDIR}/cmake-qemuwrapper"
+ chmod +x "${WORKDIR}/cmake-qemuwrapper"
+ echo "set( CMAKE_CROSSCOMPILING_EMULATOR ${WORKDIR}/cmake-qemuwrapper)" \
+ >> ${WORKDIR}/toolchain.cmake
+ fi
+}
+
+
CONFIGURE_FILES = "CMakeLists.txt"
do_configure[cleandirs] = "${@d.getVar('B') if d.getVar('S') != d.getVar('B') else ''}"
--
2.41.0
next prev parent reply other threads:[~2023-08-27 19:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-27 19:29 [PATCH v4 00/13] devtool ide plugin Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 01/13] vscode: add minimal configuration Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 02/13] cmake.bbclass: refactor cmake args Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 03/13] cmake.bbclass: cleanup spaces and tabs Adrian Freihofer
2023-08-27 19:29 ` Adrian Freihofer [this message]
2023-08-27 19:29 ` [PATCH v4 05/13] devtool: new ide plugin Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 06/13] tests: add a C++ example recipe Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 07/13] cmake-example: workaround for pseudo breakeage Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 08/13] refactor: make multiprocess_launch callable without d Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 09/13] refactor: make strip_execs " Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 10/13] devtool: refactor deploy-target Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 11/13] devtool: ide make deploy-target quicker Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 12/13] oe-selftest devtool: ide tests Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 13/13] docs: cover devtool ide Adrian Freihofer
2023-08-30 14:36 ` [OE-core] [PATCH v4 00/13] devtool ide plugin Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230827193200.4083340-5-adrian.freihofer@siemens.com \
--to=adrian.freihofer@gmail.com \
--cc=adrian.freihofer@siemens.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox