summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/cmake-qemu.bbclass
diff options
context:
space:
mode:
authorAdrian Freihofer <adrian.freihofer@gmail.com>2023-12-07 21:52:48 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-13 11:58:15 +0000
commitd7c05e4eed4ed436f2ce961df46f9654af83ffec (patch)
tree9190e3f54477d74c2aab38cd6479334c28b315b8 /meta/classes-recipe/cmake-qemu.bbclass
parent66ba89328565ca12e7658fb5c37169f2508f5745 (diff)
downloadpoky-d7c05e4eed4ed436f2ce961df46f9654af83ffec.tar.gz
cmake-qemu.bbclass: make it more usable
Make the cmake-qemu.bbclass more usable: - Drop the CMAKE_EXEWRAPPER_ENABLED variable (which does not make much sense without the second commit of the original patch series). - Inherit qemu to make the cmake-qemu a drop in replacement for cmake. (From OE-Core rev: 5cb05ca6542aa6239e0371dd9df4705b168d245e) Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/cmake-qemu.bbclass')
-rw-r--r--meta/classes-recipe/cmake-qemu.bbclass20
1 files changed, 12 insertions, 8 deletions
diff --git a/meta/classes-recipe/cmake-qemu.bbclass b/meta/classes-recipe/cmake-qemu.bbclass
index 76b748f340..46a89e2827 100644
--- a/meta/classes-recipe/cmake-qemu.bbclass
+++ b/meta/classes-recipe/cmake-qemu.bbclass
@@ -5,18 +5,22 @@
5# 5#
6# Not all platforms are supported by Qemu. Using qemu-user therefore 6# Not all platforms are supported by Qemu. Using qemu-user therefore
7# involves a certain risk, which is also the reason why this feature 7# involves a certain risk, which is also the reason why this feature
8# is not activated by default. 8# is not part of the main cmake class by default.
9#
10# One use case is the execution of cross-compiled unit tests with CTest
11# on the build machine. If CMAKE_EXEWRAPPER_ENABLED is configured,
12# cmake --build --target test
13# works transparently with qemu-user. If the cmake project is developed
14# with this use case in mind this works very nicely also out of an IDE
15# configured to use cmake-native for cross compiling.
9 16
10inherit qemu 17inherit qemu cmake
11 18
12CMAKE_EXEWRAPPER_ENABLED:class-native = "False" 19DEPENDS:append:class-target = "${@' qemu-native' if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) else ''}"
13CMAKE_EXEWRAPPER_ENABLED:class-nativesdk = "False"
14CMAKE_EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}"
15DEPENDS:append = "${@' qemu-native' if d.getVar('CMAKE_EXEWRAPPER_ENABLED') == 'True' else ''}"
16 20
17cmake_do_generate_toolchain_file:append:class-target() { 21cmake_do_generate_toolchain_file:append:class-target() {
18 if [ "${CMAKE_EXEWRAPPER_ENABLED}" = "True" ]; then 22 if [ "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}" ]; then
19 # Write out a qemu wrapper that will be used as exe_wrapper so that camake 23 # Write out a qemu wrapper that will be used as exe_wrapper so that cmake
20 # can run target helper binaries through that. This also allows to execute ctest. 24 # can run target helper binaries through that. This also allows to execute ctest.
21 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}" 25 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_DIR_HOST}/${libdir}','${STAGING_DIR_HOST}/${base_libdir}'])}"
22 echo "#!/bin/sh" > "${WORKDIR}/cmake-qemuwrapper" 26 echo "#!/bin/sh" > "${WORKDIR}/cmake-qemuwrapper"