Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
| 5 | <title>Compilation and Installation using Meson</title> |
| 6 | <link rel="stylesheet" type="text/css" href="mesa.css"> |
| 7 | </head> |
| 8 | <body> |
| 9 | |
| 10 | <div class="header"> |
| 11 | <h1>The Mesa 3D Graphics Library</h1> |
| 12 | </div> |
| 13 | |
| 14 | <iframe src="contents.html"></iframe> |
| 15 | <div class="content"> |
| 16 | |
| 17 | <h1>Compilation and Installation using Meson</h1> |
| 18 | |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 19 | <ul> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 20 | <li><a href="#intro">Introduction</a></li> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 21 | <li><a href="#basic">Basic Usage</a></li> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 22 | <li><a href="#advanced">Advanced Usage</a></li> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 23 | <li><a href="#cross-compilation">Cross-compilation and 32-bit builds</a></li> |
| 24 | </ul> |
| 25 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 26 | <h2 id="intro">1. Introduction</h2> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 27 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 28 | <p>For general information about Meson see the |
| 29 | <a href="http://mesonbuild.com/">Meson website</a>.</p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 30 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 31 | <p><strong>Mesa's Meson build system is generally considered stable and ready |
| 32 | for production.</strong></p> |
| 33 | |
| 34 | <p>The Meson build of Mesa is tested on Linux, macOS, Cygwin and Haiku, FreeBSD, |
Dylan Baker | 1da6066 | 2018-09-18 09:01:45 -0700 | [diff] [blame] | 35 | DragonflyBSD, NetBSD, and should work on OpenBSD.</p> |
Dylan Baker | 2aad12b | 2018-03-01 11:32:56 -0800 | [diff] [blame] | 36 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 37 | <p>If Meson is not already installed on your system, you can typically |
| 38 | install it with your package installer. For example:</p> |
| 39 | <pre> |
| 40 | sudo apt-get install meson # Ubuntu |
| 41 | </pre> |
| 42 | or |
| 43 | <pre> |
| 44 | sudo dnf install meson # Fedora |
| 45 | </pre> |
| 46 | |
Dylan Baker | 1da6066 | 2018-09-18 09:01:45 -0700 | [diff] [blame] | 47 | <p><strong>Mesa requires Meson >= 0.45.0 to build.</strong> |
Dylan Baker | 2aad12b | 2018-03-01 11:32:56 -0800 | [diff] [blame] | 48 | |
| 49 | Some older versions of meson do not check that they are too old and will error |
| 50 | out in odd ways. |
| 51 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 52 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 53 | <p>You'll also need <a href="https://ninja-build.org/">Ninja</a>. |
| 54 | If it's not already installed, use apt-get or dnf to install |
| 55 | the <em>ninja-build</em> package. |
| 56 | </p> |
| 57 | |
| 58 | <h2 id="basic">2. Basic Usage</h2> |
| 59 | |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 60 | <p> |
| 61 | The meson program is used to configure the source directory and generates |
| 62 | either a ninja build file or Visual Studio® build files. The latter must |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 63 | be enabled via the <code>--backend</code> switch, as ninja is the default |
| 64 | backend on all |
| 65 | operating systems. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 66 | </p> |
| 67 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 68 | <p> |
| 69 | Meson only supports out-of-tree builds, and must be passed a |
| 70 | directory to put built and generated sources into. We'll call that directory |
| 71 | "build" here. |
| 72 | It's recommended to create a |
| 73 | <a href="http://mesonbuild.com/Using-multiple-build-directories.html"> |
| 74 | separate build directory</a> for each configuration you might want to use. |
| 75 | </p> |
| 76 | |
| 77 | |
| 78 | |
| 79 | </p> |
| 80 | |
| 81 | <p>Basic configuration is done with:</p> |
| 82 | |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 83 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 84 | meson build/ |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 85 | </pre> |
| 86 | |
| 87 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 88 | This will create the build directory. |
| 89 | If any dependencies are missing, you can install them, or try to remove |
| 90 | the dependency with a Meson configuration option (see below). |
Eric Engestrom | c4c5c90 | 2019-01-17 16:26:26 +0000 | [diff] [blame] | 91 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 92 | |
Eric Engestrom | c4c5c90 | 2019-01-17 16:26:26 +0000 | [diff] [blame] | 93 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 94 | To review the options which Meson chose, run: |
| 95 | </p> |
| 96 | <pre> |
| 97 | meson configure build/ |
| 98 | </pre> |
| 99 | |
| 100 | <p> |
| 101 | Meson does not currently support listing configuration options before |
| 102 | running "meson build/" but this feature is being discussed upstream. |
Eric Engestrom | 00be88a | 2019-01-17 18:04:42 +0000 | [diff] [blame] | 103 | For now, we have a <code>bin/meson-options.py</code> script that prints |
| 104 | the options for you. |
| 105 | If that script doesn't work for some reason, you can always look in the |
Eric Engestrom | c4c5c90 | 2019-01-17 16:26:26 +0000 | [diff] [blame] | 106 | <code>meson_options.txt</code> file at the root of the project. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 107 | </p> |
| 108 | |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 109 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 110 | With additional arguments <code>meson configure</code> can be used to change |
| 111 | options for a previously configured build directory. |
| 112 | All options passed to this command are in the form |
| 113 | <code>-D "option"="value"</code>. |
| 114 | For example: |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 115 | </p> |
| 116 | |
| 117 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 118 | meson configure build/ -Dprefix=/tmp/install -Dglx=true |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 119 | </pre> |
| 120 | |
| 121 | <p> |
Eric Engestrom | 57fbc2a | 2018-05-14 16:39:42 +0100 | [diff] [blame] | 122 | Note that options taking lists (such as <code>platforms</code>) are |
| 123 | <a href="http://mesonbuild.com/Build-options.html#using-build-options">a bit |
| 124 | more complicated</a>, but the simplest form compatible with Mesa options |
| 125 | is to use a comma to separate values (<code>-D platforms=drm,wayland</code>) |
| 126 | and brackets to represent an empty list (<code>-D platforms=[]</code>). |
| 127 | </p> |
| 128 | |
| 129 | <p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 130 | Once you've run the initial <code>meson</code> command successfully you can use |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 131 | your configured backend to build the project in your build directory: |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 132 | </p> |
| 133 | |
| 134 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 135 | ninja -C build/ |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 136 | </pre> |
| 137 | |
| 138 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 139 | The next step is to install the Mesa libraries, drivers, etc. |
| 140 | This also finishes up some final steps of the build process (such as creating |
| 141 | symbolic links for drivers). To install: |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 142 | </p> |
| 143 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 144 | <pre> |
| 145 | ninja -C build/ install |
| 146 | </pre> |
| 147 | |
Dylan Baker | a8004ef | 2018-10-22 19:33:08 -0700 | [diff] [blame] | 148 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 149 | Note: autotools automatically updates translation files (used by the DRI |
| 150 | configuration tool) as part of the build process, |
| 151 | Meson does not do this. Instead, you will need do this: |
Dylan Baker | a8004ef | 2018-10-22 19:33:08 -0700 | [diff] [blame] | 152 | </p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 153 | <pre> |
| 154 | ninja -C build/ xmlpool-pot xmlpool-update-po xmlpool-gmo |
| 155 | </pre> |
| 156 | |
| 157 | <h2 id="advanced">3. Advanced Usage</h2> |
Dylan Baker | a8004ef | 2018-10-22 19:33:08 -0700 | [diff] [blame] | 158 | |
Eric Engestrom | 67c5507 | 2018-05-14 16:45:31 +0100 | [diff] [blame] | 159 | <dl> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 160 | |
| 161 | <dt>Installation Location</dt> |
| 162 | <dd> |
| 163 | <p> |
| 164 | Meson default to installing libGL.so in your system's main lib/ directory |
| 165 | and DRI drivers to a dri/ subdirectory. |
| 166 | </p> |
| 167 | <p> |
| 168 | Developers will often want to install Mesa to a testing directory rather |
| 169 | than the system library directory. |
| 170 | This can be done with the --prefix option. For example: |
| 171 | </p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 172 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 173 | meson --prefix="${PWD}/build/install" build/ |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 174 | </pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 175 | <p> |
| 176 | will put the final libraries and drivers into the build/install/ |
| 177 | directory. |
| 178 | Then you can set LD_LIBRARY_PATH and LIBGL_DRIVERS_PATH to that location |
| 179 | to run/test the driver. |
| 180 | </p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 181 | <p> |
| 182 | Meson also honors <code>DESTDIR</code> for installs. |
| 183 | </p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 184 | </dd> |
| 185 | |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 186 | <dt>Compiler Options</dt> |
| 187 | <dd> |
| 188 | <p>Meson supports the common CFLAGS, CXXFLAGS, etc. environment |
| 189 | variables but their use is discouraged because of the many caveats |
| 190 | in using them. |
| 191 | </p> |
| 192 | <p>Instead, it is recomended to use <code>-D${lang}_args</code> and |
| 193 | <code>-D${lang}_link_args</code>. Among the benefits of these options |
Dylan Baker | 0ff7eed | 2018-12-19 13:27:27 -0800 | [diff] [blame] | 194 | is that they are guaranteed to persist across rebuilds and reconfigurations. |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 195 | </p> |
| 196 | This example sets -fmax-errors for compiling C sources and -DMAGIC=123 |
| 197 | for C++ sources: |
| 198 | </p> |
| 199 | <p> |
| 200 | <pre> |
| 201 | meson builddir/ -Dc_args=-fmax-errors=10 -Dcpp_args=-DMAGIC=123 |
| 202 | </pre> |
| 203 | </p> |
| 204 | </dd> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 205 | |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 206 | |
| 207 | <dt>Compiler Specification</dt> |
| 208 | <dd> |
| 209 | <p> |
| 210 | Meson supports the standard CC and CXX environment variables for |
| 211 | changing the default compiler. Note that Meson does not allow |
| 212 | changing the compilers in a configured builddir so you will need |
Dylan Baker | 0ff7eed | 2018-12-19 13:27:27 -0800 | [diff] [blame] | 213 | to create a new build dir for a different compiler. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 214 | </p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 215 | <p> |
| 216 | This is an example of specifying the clang compilers and cleaning |
| 217 | the build directory before reconfiguring with an extra C option: |
| 218 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 219 | <pre> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame^] | 220 | CC=clang CXX=clang++ meson build-clang |
| 221 | ninja -C build-clang |
| 222 | ninja -C build-clang clean |
| 223 | meson configure build -Dc_args="-Wno-typedef-redefinition" |
| 224 | ninja -C build-clang |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 225 | </pre> |
Dylan Baker | e0829f9 | 2018-09-18 09:07:25 -0700 | [diff] [blame] | 226 | <p> |
| 227 | The default compilers depends on your operating system. Meson supports most of |
| 228 | the popular compilers, a complete list is available |
| 229 | <a href="http://mesonbuild.com/Reference-tables.html#compiler-ids">here</a>. |
| 230 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 231 | </dd> |
| 232 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 233 | <dt>LLVM</dt> |
Dylan Baker | be56f8a | 2018-09-18 09:09:47 -0700 | [diff] [blame] | 234 | <dd><p>Meson includes upstream logic to wrap llvm-config using its standard |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 235 | dependency interface. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 236 | </p></dd> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 237 | |
| 238 | <dd><p> |
| 239 | As of meson 0.49.0 meson also has the concept of a |
| 240 | <a href="https://mesonbuild.com/Native-environments.html">"native file"</a>, |
| 241 | these files provide information about the native build environment (as opposed |
| 242 | to a cross build environment). They are ini formatted and can override where to |
| 243 | find llvm-config: |
| 244 | |
| 245 | custom-llvm.ini |
| 246 | <pre> |
| 247 | [binaries] |
| 248 | llvm-config = '/usr/local/bin/llvm/llvm-config' |
| 249 | </pre> |
| 250 | |
| 251 | Then configure meson: |
| 252 | |
| 253 | <pre> |
| 254 | meson builddir/ --native-file custom-llvm.ini |
| 255 | </pre> |
| 256 | </p></dd> |
| 257 | |
| 258 | <dd><p> |
| 259 | For selecting llvm-config for cross compiling a |
| 260 | <a href="https://mesonbuild.com/Cross-compilation.html#defining-the-environment">"cross file"</a> |
| 261 | should be used. It uses the same format as the native file above: |
| 262 | |
| 263 | cross-llvm.ini |
| 264 | <pre> |
| 265 | [binaries] |
| 266 | ... |
| 267 | llvm-config = '/usr/lib/llvm-config-32' |
| 268 | </pre> |
| 269 | |
| 270 | Then configure meson: |
| 271 | |
| 272 | <pre> |
| 273 | meson builddir/ --cross-file cross-llvm.ini |
| 274 | </pre> |
| 275 | |
| 276 | See the <a href="#cross-compilation">Cross Compilation</a> section for more information. |
| 277 | </dd></p> |
| 278 | |
| 279 | <dd><p> |
| 280 | For older versions of meson <code>$PATH</code> (or <code>%PATH%</code> on |
| 281 | windows) will be searched for llvm-config (and llvm-config$version and |
| 282 | llvm-config-$version), you can override this environment variable to control |
| 283 | the search: <code>PATH=/path/with/llvm-config:$PATH meson build</code>. |
| 284 | </dd></p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 285 | </dl> |
| 286 | |
Dylan Baker | 2aad12b | 2018-03-01 11:32:56 -0800 | [diff] [blame] | 287 | <dl> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 288 | <dt><code>PKG_CONFIG_PATH</code></dt> |
| 289 | <dd><p>The |
| 290 | <code>pkg-config</code> utility is a hard requirement for configuring and |
Dylan Baker | 2aad12b | 2018-03-01 11:32:56 -0800 | [diff] [blame] | 291 | building Mesa on Unix-like systems. It is used to search for external libraries |
| 292 | on the system. This environment variable is used to control the search path for |
| 293 | <code>pkg-config</code>. For instance, setting |
| 294 | <code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig</code> will search for package |
| 295 | metadata in <code>/usr/X11R6</code> before the standard directories.</p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 296 | </dd> |
| 297 | </dl> |
| 298 | |
| 299 | <p> |
| 300 | One of the oddities of meson is that some options are different when passed to |
| 301 | the <code>meson</code> than to <code>meson configure</code>. These options are |
| 302 | passed as --option=foo to <code>meson</code>, but -Doption=foo to <code>meson |
| 303 | configure</code>. Mesa defined options are always passed as -Doption=foo. |
Eric Engestrom | 67c5507 | 2018-05-14 16:45:31 +0100 | [diff] [blame] | 304 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 305 | |
| 306 | <p>For those coming from autotools be aware of the following:</p> |
| 307 | |
| 308 | <dl> |
| 309 | <dt><code>--buildtype/-Dbuildtype</code></dt> |
| 310 | <dd><p>This option will set the compiler debug/optimisation levels to aid |
| 311 | debugging the Mesa libraries.</p> |
| 312 | |
Eric Engestrom | 37d44e2 | 2018-05-14 16:47:57 +0100 | [diff] [blame] | 313 | <p>Note that in meson this defaults to <code>debugoptimized</code>, and |
| 314 | not setting it to <code>release</code> will yield non-optimal |
| 315 | performance and binary size. Not using <code>debug</code> may interfere |
| 316 | with debugging as some code and validation will be optimized away. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 317 | </p> |
| 318 | |
Eric Engestrom | 37d44e2 | 2018-05-14 16:47:57 +0100 | [diff] [blame] | 319 | <p> For those wishing to pass their own optimization flags, use the <code>plain</code> |
Dylan Baker | 2aad12b | 2018-03-01 11:32:56 -0800 | [diff] [blame] | 320 | buildtype, which causes meson to inject no additional compiler arguments, only |
| 321 | those in the C/CXXFLAGS and those that mesa itself defines.</p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 322 | </dd> |
| 323 | </dl> |
| 324 | |
| 325 | <dl> |
| 326 | <dt><code>-Db_ndebug</code></dt> |
Eric Engestrom | 37d44e2 | 2018-05-14 16:47:57 +0100 | [diff] [blame] | 327 | <dd><p>This option controls assertions in meson projects. When set to <code>false</code> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 328 | (the default) assertions are enabled, when set to true they are disabled. This |
| 329 | is unrelated to the <code>buildtype</code>; setting the latter to |
| 330 | <code>release</code> will not turn off assertions. |
| 331 | </p> |
| 332 | </dd> |
| 333 | </dl> |
Eric Engestrom | 67c5507 | 2018-05-14 16:45:31 +0100 | [diff] [blame] | 334 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 335 | <h2 id="cross-compilation">4. Cross-compilation and 32-bit builds</h2> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 336 | |
| 337 | <p><a href="https://mesonbuild.com/Cross-compilation.html">Meson supports |
| 338 | cross-compilation</a> by specifying a number of binary paths and |
| 339 | settings in a file and passing this file to <code>meson</code> or |
| 340 | <code>meson configure</code> with the <code>--cross-file</code> |
| 341 | parameter.</p> |
| 342 | |
| 343 | <p>This file can live at any location, but you can use the bare filename |
| 344 | (without the folder path) if you put it in $XDG_DATA_HOME/meson/cross or |
| 345 | ~/.local/share/meson/cross</p> |
| 346 | |
| 347 | <p>Below are a few example of cross files, but keep in mind that you |
| 348 | will likely have to alter them for your system.</p> |
| 349 | |
| 350 | <p> |
Eric Engestrom | 393a756 | 2019-01-03 16:01:18 +0000 | [diff] [blame] | 351 | Those running on ArchLinux can use the AUR-maintained packages for some |
| 352 | of those, as they'll have the right values for your system: |
| 353 | <ul> |
| 354 | <li><a href="https://aur.archlinux.org/packages/meson-cross-x86-linux-gnu">meson-cross-x86-linux-gnu</a></li> |
| 355 | <li><a href="https://aur.archlinux.org/packages/meson-cross-aarch64-linux-gnu">meson-cross-aarch64-linux-gnu</a></li> |
| 356 | </ul> |
| 357 | </p> |
| 358 | |
| 359 | <p> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 360 | 32-bit build on x86 linux: |
| 361 | <pre> |
| 362 | [binaries] |
| 363 | c = '/usr/bin/gcc' |
| 364 | cpp = '/usr/bin/g++' |
| 365 | ar = '/usr/bin/gcc-ar' |
| 366 | strip = '/usr/bin/strip' |
| 367 | pkgconfig = '/usr/bin/pkg-config-32' |
| 368 | llvm-config = '/usr/bin/llvm-config32' |
| 369 | |
| 370 | [properties] |
| 371 | c_args = ['-m32'] |
| 372 | c_link_args = ['-m32'] |
| 373 | cpp_args = ['-m32'] |
| 374 | cpp_link_args = ['-m32'] |
| 375 | |
| 376 | [host_machine] |
| 377 | system = 'linux' |
| 378 | cpu_family = 'x86' |
| 379 | cpu = 'i686' |
| 380 | endian = 'little' |
| 381 | </pre> |
| 382 | </p> |
| 383 | |
| 384 | <p> |
| 385 | 64-bit build on ARM linux: |
| 386 | <pre> |
| 387 | [binaries] |
| 388 | c = '/usr/bin/aarch64-linux-gnu-gcc' |
| 389 | cpp = '/usr/bin/aarch64-linux-gnu-g++' |
Eric Engestrom | 8b363bc | 2019-01-03 15:44:42 +0000 | [diff] [blame] | 390 | ar = '/usr/bin/aarch64-linux-gnu-gcc-ar' |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 391 | strip = '/usr/bin/aarch64-linux-gnu-strip' |
| 392 | pkgconfig = '/usr/bin/aarch64-linux-gnu-pkg-config' |
| 393 | exe_wrapper = '/usr/bin/qemu-aarch64-static' |
| 394 | |
| 395 | [host_machine] |
| 396 | system = 'linux' |
Eric Engestrom | 8b363bc | 2019-01-03 15:44:42 +0000 | [diff] [blame] | 397 | cpu_family = 'aarch64' |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 398 | cpu = 'aarch64' |
| 399 | endian = 'little' |
| 400 | </pre> |
| 401 | </p> |
| 402 | |
| 403 | <p> |
| 404 | 64-bit build on x86 windows: |
| 405 | <pre> |
| 406 | [binaries] |
| 407 | c = '/usr/bin/x86_64-w64-mingw32-gcc' |
| 408 | cpp = '/usr/bin/x86_64-w64-mingw32-g++' |
| 409 | ar = '/usr/bin/x86_64-w64-mingw32-ar' |
| 410 | strip = '/usr/bin/x86_64-w64-mingw32-strip' |
| 411 | pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' |
| 412 | exe_wrapper = 'wine' |
| 413 | |
| 414 | [host_machine] |
| 415 | system = 'windows' |
| 416 | cpu_family = 'x86_64' |
| 417 | cpu = 'i686' |
| 418 | endian = 'little' |
| 419 | </pre> |
| 420 | </p> |
| 421 | |
Eric Engestrom | 67c5507 | 2018-05-14 16:45:31 +0100 | [diff] [blame] | 422 | </div> |
| 423 | </body> |
| 424 | </html> |