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

MesonToolchain and native context #3710

Merged
merged 1 commit into from
May 6, 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
26 changes: 25 additions & 1 deletion reference/tools/meson/mesontoolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ as it can result in unexpected errors during your project's build process.
Cross-building for Apple and Android
-------------------------------------

The ``MesonToolchain`` adds all the flags required to cross-compile for Apple (MacOS M1, iOS, etc.) and Android.
The ``MesonToolchain`` generator adds all the flags required to cross-compile for Apple (MacOS M1, iOS, etc.) and Android.

**Apple**

Expand All @@ -281,6 +281,30 @@ in this example of host profile:
[conf]
tools.apple:sdk_path=/my/path/to/iPhoneOS.sdk


Cross-building and native=true
------------------------------

New since `Conan 2.3.0 <https://github.com/conan-io/conan/releases/tag/2.3.0>`__

When you are cross-building, sometimes you need to build a tool which is used to generate source files.
For this you would want to build some targets with the system's native compiler. Then, you need Conan to create both
context files:

.. code:: python

def generate(self):
tc = MesonToolchain(self)
tc.generate()
# Forcing to create the native context too
if cross_building(self):
tc = MesonToolchain(self, native=True)
tc.generate()

See also `this reference <https://mesonbuild.com/Cross-compilation.html#mixing-host-and-build-targets>`__
from the Meson documentation for more information.


Objective-C arguments
++++++++++++++++++++++

Expand Down