forked from conan-io/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: SSE4 <[email protected]>
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,4 +102,5 @@ Built-in toolchains | |
|
||
toolchains/cmake | ||
toolchains/make | ||
toolchains/meson | ||
toolchains/msbuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |