Skip to content

Commit 0d12266

Browse files
Added native info (#3710)
1 parent 00c0e5e commit 0d12266

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

reference/tools/meson/mesontoolchain.rst

+25-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ as it can result in unexpected errors during your project's build process.
258258
Cross-building for Apple and Android
259259
-------------------------------------
260260

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

263263
**Apple**
264264

@@ -282,6 +282,30 @@ in this example of host profile:
282282
[conf]
283283
tools.apple:sdk_path=/my/path/to/iPhoneOS.sdk
284284
285+
286+
Cross-building and native=true
287+
------------------------------
288+
289+
New since `Conan 2.3.0 <https://github.com/conan-io/conan/releases/tag/2.3.0>`__
290+
291+
When you are cross-building, sometimes you need to build a tool which is used to generate source files.
292+
For this you would want to build some targets with the system's native compiler. Then, you need Conan to create both
293+
context files:
294+
295+
.. code:: python
296+
297+
def generate(self):
298+
tc = MesonToolchain(self)
299+
tc.generate()
300+
# Forcing to create the native context too
301+
if cross_building(self):
302+
tc = MesonToolchain(self, native=True)
303+
tc.generate()
304+
305+
See also `this reference <https://mesonbuild.com/Cross-compilation.html#mixing-host-and-build-targets>`__
306+
from the Meson documentation for more information.
307+
308+
285309
Objective-C arguments
286310
++++++++++++++++++++++
287311

0 commit comments

Comments
 (0)