Skip to content

Commit

Permalink
- docs for meson toolchain
Browse files Browse the repository at this point in the history
Signed-off-by: SSE4 <[email protected]>
  • Loading branch information
SSE4 committed Dec 1, 2020
1 parent 5780424 commit 99f8e0a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions creating_packages/toolchains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ Built-in toolchains

toolchains/cmake
toolchains/make
toolchains/meson
toolchains/msbuild
62 changes: 62 additions & 0 deletions creating_packages/toolchains/meson.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.. _conan-meson-toolchain:

MesonToolchain
==============

.. warning::

This is an **experimental** feature subject to breaking changes in future releases.


The ``MesonToolchain`` can be used in the ``toolchain()`` method:


.. code:: python
from conans import ConanFile, MesonToolchain
class App(ConanFile):
settings = "os", "arch", "compiler", "build_type"
requires = "hello/0.1"
options = {"shared": [True, False]}
default_options = {"shared": False}
def toolchain(self):
tc = MesonToolchain(self)
tc.write_toolchain_files()
The ``MesonToolchain`` will generate the following file during ``conan install``
command (or before calling the ``build()`` method when the package is being
built in the cache): ``conan_meson_native.ini``

``conan_meson_native.ini`` will contain the definitions of all the Meson properties
related to the Conan options and settings for the current package, platform,
etc. This includes but is not limited to the following:


Generators
----------

The ``MesonToolchain`` only works with the ``pkg_config`` generator.
Please, do not use other generators, as they can have overlapping definitions that can conflict.


Using the toolchain in developer flow
-------------------------------------

One of the advantages of using Conan toolchains is that they can help to achieve the exact same build
with local development flows, than when the package is created in the cache.

With the ``MesonToolchain`` it is possible to do:

.. code:: bash
# Lets start in the folder containing the conanfile.py
$ mkdir build && cd build
# Install both debug and release deps and create the toolchain
$ conan install ..
# the build type Release is encoded in the toolchain already.
# This conan_meson_native.iniis specific for release
$ meson setup --native-file conan_meson_native.ini build .
$ meson compile -C build

0 comments on commit 99f8e0a

Please sign in to comment.