Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PkgConfigDeps][MesonToolchain] Added build context folder mechanism #3640

Merged
merged 6 commits into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions reference/tools/gnu/pkgconfigdeps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ you can activate it using the **build_context_activated** attribute:
pc.generate()


build_context_suffix
build_context_folder
^^^^^^^^^^^^^^^^^^^^

*New since Conan 2.2.0*

When you have the same package as a **build-require** and as a **regular require** it will
cause a conflict in the generator because the file names of the ``*.pc`` files will
collide as well as the names, requires names, etc.
Expand All @@ -122,9 +124,30 @@ also have a **regular require**. Solving this conflict is specially important wh
cross-building because the tool (that will run in the building machine) belongs to a
different binary package than the library, that will "run" in the host machine.

You can use the **build_context_suffix** attribute to specify a suffix for a requirement,
so the files/requires/names of the requirement in the build context (tool require) will be
renamed:
You can use the ``build_context_folder`` attribute to specify a folder to save the `*.pc` files created by all those
build requirements listed in the ``build_context_activated`` one:

.. code-block:: python

tool_requires = ["my_tool/0.0.1"]
requires = ["my_tool/0.0.1"]
def generate(self):
pc = PkgConfigDeps(self)
# generate the *.pc file for the tool require
pc.build_context_activated = ["my_tool"]
# save all the *.pc files coming from the "my_tool" build context and its requirements
pc.build_context_folder = "build" # [generators_folder]/build/
pc.generate()



build_context_suffix
^^^^^^^^^^^^^^^^^^^^

*DEPRECATED: use build_context_folder attribute instead*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still not very clear that the deprecation of this and the recommendation to use build_context_suffix is the way to go also for autotools. If it is not, maybe we should recommend this for Meson only?

Maybe we need to understand the potential autotools usages of the build_context_suffix and build_context_folder


Same concept as the quoted ``build_context_folder`` attribute above, but this is meant to specify a suffix for a requirement,
so the files/requires/names of the requirement in the build context (tool require) will be renamed:

.. code-block:: python

Expand All @@ -139,6 +162,11 @@ renamed:
pc.generate()


.. important::

This attribute should not be used simultaneously with the ``build_context_folder`` attribute.


.. _PkgConfigDeps Properties:

Properties
Expand Down