diff mbox series

ref-manual: document cmake-qemu class

Message ID 20231231154843.1418654-1-adrian.freihofer@siemens.com
State New
Headers show
Series ref-manual: document cmake-qemu class | expand

Commit Message

Adrian Freihofer Dec. 31, 2023, 3:48 p.m. UTC
(From yocto-docs rev: d7c05e4eed4ed436f2ce961df46f9654af83ffec)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 documentation/ref-manual/classes.rst | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Michael Opdenacker Jan. 8, 2024, 4:23 p.m. UTC | #1
Hi Adrian

On 31.12.23 at 16:48, Adrian Freihofer wrote:
> (From yocto-docs rev: d7c05e4eed4ed436f2ce961df46f9654af83ffec)
>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>   documentation/ref-manual/classes.rst | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
>
> diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
> index a8afe9f2dcb..c9bc0f08c6c 100644
> --- a/documentation/ref-manual/classes.rst
> +++ b/documentation/ref-manual/classes.rst
> @@ -377,6 +377,33 @@ If you need to install custom CMake toolchain files supplied by the application
>   being built, you should install them (during :ref:`ref-tasks-install`) to the
>   preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
>   
> +.. _ref-classes-cmake-qemu:
> +
> +``cmake-qemu``
> +==============
> +
> +The :ref:`ref-classes-cmake-qemu` class might be used instead of the
> +:ref:`ref-classes-cmake` class. In addition to the features provided by the
> +:ref:`ref-classes-cmake` class the :ref:`ref-classes-cmake-qemu` class passes
> +the ``CMAKE_CROSSCOMPILING_EMULATOR`` setting to ``cmake``. This allows to use
> +qemu-usermode for the execution of cross-compiled binaries on the host machine.
> +For more information about ``CMAKE_CROSSCOMPILING_EMULATOR`` please refer to
> +the `related section of the CMake documentation <https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html>`__.
> +
> +Not all platforms are supported by Qemu. This class only works for machines with
> +the ``qemu-usermode`` in the :ref:`ref-features-machine`. Using qemu-usermode therefore
> +involves a certain risk, which is also the reason why this feature is not part of
> +the main cmake class by default.
> +
> +One use case is the execution of cross-compiled unit tests with CTest on the build
> +machine. If ``CMAKE_CROSSCOMPILING_EMULATOR`` is configured::
> +
> +   cmake --build --target test
> +
> +works transparently with qemu-usermode.
> +If the CMake project is developed with this use case in mind this works very nicely
> +also out of an IDE configured to use cmake-native for cross compiling.


Many thanks for this update!
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>

I just made a few formatting and styling updates, which you can check on 
https://git.yoctoproject.org/yocto-docs/commit/?h=master-next&id=b2e396bd970ea8f27ba575b49c1489e2181442b8
Not to late to correct me if I misunderstood what you meant.

Thanks again
Michael.
Adrian Freihofer Jan. 8, 2024, 10:24 p.m. UTC | #2
Hi Michael

> I just made a few formatting and styling updates, which you can check
> on 
> https://git.yoctoproject.org/yocto-docs/commit/?h=master-next&id=b2e396bd970ea8f27ba575b49c1489e2181442b8
> Not to late to correct me if I misunderstood what you meant.
> 
Looks good. Thank you.
Adrian
diff mbox series

Patch

diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index a8afe9f2dcb..c9bc0f08c6c 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -377,6 +377,33 @@  If you need to install custom CMake toolchain files supplied by the application
 being built, you should install them (during :ref:`ref-tasks-install`) to the
 preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
 
+.. _ref-classes-cmake-qemu:
+
+``cmake-qemu``
+==============
+
+The :ref:`ref-classes-cmake-qemu` class might be used instead of the
+:ref:`ref-classes-cmake` class. In addition to the features provided by the
+:ref:`ref-classes-cmake` class the :ref:`ref-classes-cmake-qemu` class passes
+the ``CMAKE_CROSSCOMPILING_EMULATOR`` setting to ``cmake``. This allows to use
+qemu-usermode for the execution of cross-compiled binaries on the host machine.
+For more information about ``CMAKE_CROSSCOMPILING_EMULATOR`` please refer to
+the `related section of the CMake documentation <https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html>`__.
+
+Not all platforms are supported by Qemu. This class only works for machines with
+the ``qemu-usermode`` in the :ref:`ref-features-machine`. Using qemu-usermode therefore
+involves a certain risk, which is also the reason why this feature is not part of
+the main cmake class by default.
+
+One use case is the execution of cross-compiled unit tests with CTest on the build
+machine. If ``CMAKE_CROSSCOMPILING_EMULATOR`` is configured::
+
+   cmake --build --target test
+
+works transparently with qemu-usermode.
+If the CMake project is developed with this use case in mind this works very nicely
+also out of an IDE configured to use cmake-native for cross compiling.
+
 .. _ref-classes-cml1:
 
 ``cml1``