diff options
author | Michael Davidsaver <mdavidsaver@gmail.com> | 2022-07-08 11:20:24 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-07-11 22:46:58 +0300 |
commit | 34fcb00ec072cef671dc9f822f8ce3ce5c8d843e (patch) | |
tree | 19fcc6b50f6a21ed00b8dc551cd249a674f34c37 /docs | |
parent | e7d87b6f58c653c3962479f59867397ffc15c32f (diff) | |
download | meson-34fcb00ec072cef671dc9f822f8ce3ce5c8d843e.zip meson-34fcb00ec072cef671dc9f822f8ce3ce5c8d843e.tar.gz meson-34fcb00ec072cef671dc9f822f8ce3ce5c8d843e.tar.bz2 |
docs: add cross-file example
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Cross-compilation.md | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/docs/markdown/Cross-compilation.md b/docs/markdown/Cross-compilation.md index 4f5ddce..e44b4dd 100644 --- a/docs/markdown/Cross-compilation.md +++ b/docs/markdown/Cross-compilation.md @@ -4,7 +4,34 @@ short-description: Setting up cross-compilation # Cross compilation -Meson has full support for cross compilation. Since cross compiling is +Meson has full support for cross compilation through the use of +a cross build definition file. An minimal example of one such +file `x86_64-w64-mingw32.txt` for a GCC/MinGW cross compiler +targeting 64-bit Windows could be: + +```ini +[binaries] +c = 'x86_64-w64-mingw32-gcc' +cpp = 'x86_64-w64-mingw32-g++' +ar = 'x86_64-w64-mingw32-ar' +strip = 'x86_64-w64-mingw32-strip' +exe_wrapper = 'wine64' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' +``` + +Which is then used during the `setup` phase. + +```sh +meson setup --cross-file x86_64-w64-mingw32.txt build-mingw +meson compile -C build-mingw +``` + +Since cross compiling is more complicated than native building, let's first go over some nomenclature. The three most important definitions are traditionally called *build*, *host* and *target*. This is confusing because those |