Skip to content

Commit 505cdf9

Browse files
authored
qbs: add QbsProfile doc (#3825)
1 parent af1c1a9 commit 505cdf9

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

reference/tools/qbs.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ conan.tools.qbs
88

99
qbs/qbs
1010
qbs/qbsdeps
11+
qbs/qbsprofile

reference/tools/qbs/qbs.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ commands automatically when a package is being built directly by Conan (create,
1212
.. code-block:: python
1313
1414
from conan import ConanFile
15-
from conan.tools.qbs import Qbs, QbsDeps
15+
from conan.tools.qbs import Qbs, QbsProfile, QbsDeps
1616
1717
class App(ConanFile):
1818
settings = "os", "arch", "compiler", "build_type"
@@ -22,6 +22,8 @@ commands automatically when a package is being built directly by Conan (create,
2222
default_options = {"shared": False, "fPIC": True}
2323
2424
def generate(self):
25+
profile = QbsProfile(self)
26+
profile.generate()
2527
deps = QbsDeps(self)
2628
deps.generate()
2729

reference/tools/qbs/qbsprofile.rst

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.. _conan_tools_qbsprofile:
2+
3+
QbsProfile
4+
===========
5+
6+
The ``QbsProfile`` generator produces the settings file that contains toolchain information.
7+
This file can be imported into Qbs. The ``QbsProfile`` generator can be used like:
8+
9+
.. code-block:: python
10+
11+
from conan import ConanFile
12+
13+
class App(ConanFile):
14+
settings = "os", "arch", "compiler", "build_type"
15+
requires = "hello/0.1"
16+
generators = "QbsProfile"
17+
18+
19+
It is also possible to use ``QbsProfile`` manually in the ``generate()`` method:
20+
21+
.. code-block:: python
22+
23+
from conan import ConanFile
24+
from conan.tools.qbs import QbsProfile
25+
26+
class App(ConanFile):
27+
settings = "os", "arch", "compiler", "build_type"
28+
requires = "hello/0.1"
29+
30+
def generate(self):
31+
profile = QbsProfile(self)
32+
profile.generate()
33+
34+
Now we can generate the file using the ``conan install`` command.
35+
36+
.. code-block:: text
37+
38+
$ conan install . --output-folder=build --build missing
39+
40+
And import it into Qbs:
41+
42+
.. code-block:: text
43+
44+
$ qbs config import qbs_settings.txt --settings-dir qbs
45+
46+
Note that to acutually use the imported file, Qbs should be called with ``--settings-dir``:
47+
48+
.. code-block:: text
49+
50+
$ qbs resolve --settings-dir qbs
51+
52+
Those commands are called automatically when using the ``Qbs`` helper class.
53+
.. seealso::
54+
55+
- Check the :ref:`Qbs helper <_conan_tools_qbs_helper>` for details.
56+
57+
Reference
58+
---------
59+
60+
.. currentmodule:: conan.tools.qbs.qbsprofile
61+
62+
.. autoclass:: QbsProfile
63+
:members:

0 commit comments

Comments
 (0)