From 2b32ec16bb8516386a97f39b0657aabbda21b73c Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sat, 3 Aug 2024 21:10:34 +0300 Subject: [PATCH] qbs: add QbsProfile doc --- reference/tools/qbs.rst | 1 + reference/tools/qbs/qbs.rst | 4 +- reference/tools/qbs/qbsprofile.rst | 63 ++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 reference/tools/qbs/qbsprofile.rst diff --git a/reference/tools/qbs.rst b/reference/tools/qbs.rst index ffc9283427c..921beeb1abc 100644 --- a/reference/tools/qbs.rst +++ b/reference/tools/qbs.rst @@ -8,3 +8,4 @@ conan.tools.qbs qbs/qbs qbs/qbsdeps + qbs/qbsprofile diff --git a/reference/tools/qbs/qbs.rst b/reference/tools/qbs/qbs.rst index 47e495765d0..a44cc4af565 100644 --- a/reference/tools/qbs/qbs.rst +++ b/reference/tools/qbs/qbs.rst @@ -12,7 +12,7 @@ commands automatically when a package is being built directly by Conan (create, .. code-block:: python from conan import ConanFile - from conan.tools.qbs import Qbs, QbsDeps + from conan.tools.qbs import Qbs, QbsProfile, QbsDeps class App(ConanFile): settings = "os", "arch", "compiler", "build_type" @@ -22,6 +22,8 @@ commands automatically when a package is being built directly by Conan (create, default_options = {"shared": False, "fPIC": True} def generate(self): + profile = QbsProfile(self) + profile.generate() deps = QbsDeps(self) deps.generate() diff --git a/reference/tools/qbs/qbsprofile.rst b/reference/tools/qbs/qbsprofile.rst new file mode 100644 index 00000000000..8a6a8aac35f --- /dev/null +++ b/reference/tools/qbs/qbsprofile.rst @@ -0,0 +1,63 @@ +.. _conan_tools_qbsprofile: + +QbsProfile +=========== + +The ``QbsProfile`` generator produces the settings file that contains toolchain information. +This file can be imported into Qbs. The ``QbsProfile`` generator can be used like: + +.. code-block:: python + + from conan import ConanFile + + class App(ConanFile): + settings = "os", "arch", "compiler", "build_type" + requires = "hello/0.1" + generators = "QbsProfile" + + +It is also possible to use ``QbsProfile`` manually in the ``generate()`` method: + +.. code-block:: python + + from conan import ConanFile + from conan.tools.qbs import QbsProfile + + class App(ConanFile): + settings = "os", "arch", "compiler", "build_type" + requires = "hello/0.1" + + def generate(self): + profile = QbsProfile(self) + profile.generate() + +Now we can generate the file using the ``conan install`` command. + +.. code-block:: text + + $ conan install . --output-folder=build --build missing + +And import it into Qbs: + +.. code-block:: text + + $ qbs config import qbs_settings.txt --settings-dir qbs + +Note that to acutually use the imported file, Qbs should be called with ``--settings-dir``: + +.. code-block:: text + + $ qbs resolve --settings-dir qbs + +Those commands are called automatically when using the ``Qbs`` helper class. +.. seealso:: + + - Check the :ref:`Qbs helper <_conan_tools_qbs_helper>` for details. + +Reference +--------- + +.. currentmodule:: conan.tools.qbs.qbsprofile + +.. autoclass:: QbsProfile + :members: \ No newline at end of file