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"> |
Erik Faye-Lund | 6e0e550 | 2019-05-06 13:13:11 +0200 | [diff] [blame] | 5 | <title>Compilation and Installation Using Meson</title> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 6 | <link rel="stylesheet" type="text/css" href="mesa.css"> |
| 7 | </head> |
| 8 | <body> |
| 9 | |
| 10 | <div class="header"> |
Erik Faye-Lund | ecdab0d | 2019-05-06 13:26:47 +0200 | [diff] [blame] | 11 | The Mesa 3D Graphics Library |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 12 | </div> |
| 13 | |
| 14 | <iframe src="contents.html"></iframe> |
| 15 | <div class="content"> |
| 16 | |
Erik Faye-Lund | 6e0e550 | 2019-05-06 13:13:11 +0200 | [diff] [blame] | 17 | <h1>Compilation and Installation Using Meson</h1> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 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 | |
Eric Engestrom | 4bf7e7b | 2019-07-30 00:44:21 +0100 | [diff] [blame] | 47 | <p><strong>Mesa requires Meson >= 0.46.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 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 79 | <p>Basic configuration is done with:</p> |
| 80 | |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 81 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 82 | meson build/ |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 83 | </pre> |
| 84 | |
| 85 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 86 | This will create the build directory. |
| 87 | If any dependencies are missing, you can install them, or try to remove |
| 88 | the dependency with a Meson configuration option (see below). |
Eric Engestrom | c4c5c90 | 2019-01-17 16:26:26 +0000 | [diff] [blame] | 89 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 90 | |
Eric Engestrom | c4c5c90 | 2019-01-17 16:26:26 +0000 | [diff] [blame] | 91 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 92 | To review the options which Meson chose, run: |
| 93 | </p> |
| 94 | <pre> |
| 95 | meson configure build/ |
| 96 | </pre> |
| 97 | |
| 98 | <p> |
| 99 | Meson does not currently support listing configuration options before |
| 100 | running "meson build/" but this feature is being discussed upstream. |
Eric Engestrom | 00be88a | 2019-01-17 18:04:42 +0000 | [diff] [blame] | 101 | For now, we have a <code>bin/meson-options.py</code> script that prints |
| 102 | the options for you. |
| 103 | If that script doesn't work for some reason, you can always look in the |
Brian Paul | e547a1c | 2019-03-11 19:58:04 -0600 | [diff] [blame] | 104 | <a href="https://gitlab.freedesktop.org/mesa/mesa/blob/master/meson_options.txt"> |
| 105 | meson_options.txt</a> file at the root of the project. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 106 | </p> |
| 107 | |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 108 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 109 | With additional arguments <code>meson configure</code> can be used to change |
| 110 | options for a previously configured build directory. |
| 111 | All options passed to this command are in the form |
| 112 | <code>-D "option"="value"</code>. |
| 113 | For example: |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 114 | </p> |
| 115 | |
| 116 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 117 | meson configure build/ -Dprefix=/tmp/install -Dglx=true |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 118 | </pre> |
| 119 | |
| 120 | <p> |
Eric Engestrom | 57fbc2a | 2018-05-14 16:39:42 +0100 | [diff] [blame] | 121 | Note that options taking lists (such as <code>platforms</code>) are |
| 122 | <a href="http://mesonbuild.com/Build-options.html#using-build-options">a bit |
| 123 | more complicated</a>, but the simplest form compatible with Mesa options |
| 124 | is to use a comma to separate values (<code>-D platforms=drm,wayland</code>) |
| 125 | and brackets to represent an empty list (<code>-D platforms=[]</code>). |
| 126 | </p> |
| 127 | |
| 128 | <p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 129 | 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] | 130 | your configured backend to build the project in your build directory: |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 131 | </p> |
| 132 | |
| 133 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 134 | ninja -C build/ |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 135 | </pre> |
| 136 | |
| 137 | <p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 138 | The next step is to install the Mesa libraries, drivers, etc. |
| 139 | This also finishes up some final steps of the build process (such as creating |
| 140 | symbolic links for drivers). To install: |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 141 | </p> |
| 142 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 143 | <pre> |
| 144 | ninja -C build/ install |
| 145 | </pre> |
| 146 | |
Dylan Baker | a8004ef | 2018-10-22 19:33:08 -0700 | [diff] [blame] | 147 | <p> |
Eric Engestrom | 88ed5f6 | 2019-04-24 13:19:51 +0100 | [diff] [blame] | 148 | Note: autotools automatically updated translation files (used by the DRI |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 149 | configuration tool) as part of the build process, |
| 150 | Meson does not do this. Instead, you will need do this: |
Dylan Baker | a8004ef | 2018-10-22 19:33:08 -0700 | [diff] [blame] | 151 | </p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 152 | <pre> |
| 153 | ninja -C build/ xmlpool-pot xmlpool-update-po xmlpool-gmo |
| 154 | </pre> |
| 155 | |
| 156 | <h2 id="advanced">3. Advanced Usage</h2> |
Dylan Baker | a8004ef | 2018-10-22 19:33:08 -0700 | [diff] [blame] | 157 | |
Eric Engestrom | 67c5507 | 2018-05-14 16:45:31 +0100 | [diff] [blame] | 158 | <dl> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 159 | |
| 160 | <dt>Installation Location</dt> |
| 161 | <dd> |
| 162 | <p> |
| 163 | Meson default to installing libGL.so in your system's main lib/ directory |
| 164 | and DRI drivers to a dri/ subdirectory. |
| 165 | </p> |
| 166 | <p> |
| 167 | Developers will often want to install Mesa to a testing directory rather |
| 168 | than the system library directory. |
| 169 | This can be done with the --prefix option. For example: |
| 170 | </p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 171 | <pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 172 | meson --prefix="${PWD}/build/install" build/ |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 173 | </pre> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 174 | <p> |
| 175 | will put the final libraries and drivers into the build/install/ |
| 176 | directory. |
| 177 | Then you can set LD_LIBRARY_PATH and LIBGL_DRIVERS_PATH to that location |
| 178 | to run/test the driver. |
| 179 | </p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 180 | <p> |
| 181 | Meson also honors <code>DESTDIR</code> for installs. |
| 182 | </p> |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 183 | </dd> |
| 184 | |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 185 | <dt>Compiler Options</dt> |
| 186 | <dd> |
| 187 | <p>Meson supports the common CFLAGS, CXXFLAGS, etc. environment |
| 188 | variables but their use is discouraged because of the many caveats |
| 189 | in using them. |
| 190 | </p> |
| 191 | <p>Instead, it is recomended to use <code>-D${lang}_args</code> and |
| 192 | <code>-D${lang}_link_args</code>. Among the benefits of these options |
Dylan Baker | 0ff7eed | 2018-12-19 13:27:27 -0800 | [diff] [blame] | 193 | is that they are guaranteed to persist across rebuilds and reconfigurations. |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 194 | </p> |
Erik Faye-Lund | 8ef86c9 | 2019-04-18 16:13:44 +0200 | [diff] [blame] | 195 | <p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 196 | This example sets -fmax-errors for compiling C sources and -DMAGIC=123 |
| 197 | for C++ sources: |
| 198 | </p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 199 | <pre> |
| 200 | meson builddir/ -Dc_args=-fmax-errors=10 -Dcpp_args=-DMAGIC=123 |
| 201 | </pre> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 202 | </dd> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 203 | |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 204 | |
| 205 | <dt>Compiler Specification</dt> |
| 206 | <dd> |
| 207 | <p> |
| 208 | Meson supports the standard CC and CXX environment variables for |
| 209 | changing the default compiler. Note that Meson does not allow |
| 210 | changing the compilers in a configured builddir so you will need |
Dylan Baker | 0ff7eed | 2018-12-19 13:27:27 -0800 | [diff] [blame] | 211 | to create a new build dir for a different compiler. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 212 | </p> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 213 | <p> |
| 214 | This is an example of specifying the clang compilers and cleaning |
| 215 | the build directory before reconfiguring with an extra C option: |
| 216 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 217 | <pre> |
Brian Paul | 16fb82d | 2019-03-08 10:31:11 -0700 | [diff] [blame] | 218 | CC=clang CXX=clang++ meson build-clang |
| 219 | ninja -C build-clang |
| 220 | ninja -C build-clang clean |
| 221 | meson configure build -Dc_args="-Wno-typedef-redefinition" |
| 222 | ninja -C build-clang |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 223 | </pre> |
Dylan Baker | e0829f9 | 2018-09-18 09:07:25 -0700 | [diff] [blame] | 224 | <p> |
| 225 | The default compilers depends on your operating system. Meson supports most of |
| 226 | the popular compilers, a complete list is available |
| 227 | <a href="http://mesonbuild.com/Reference-tables.html#compiler-ids">here</a>. |
| 228 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 229 | </dd> |
| 230 | |
Brian Paul | 45c6da5 | 2019-03-07 20:39:49 -0700 | [diff] [blame] | 231 | <dt>LLVM</dt> |
Dylan Baker | be56f8a | 2018-09-18 09:09:47 -0700 | [diff] [blame] | 232 | <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] | 233 | dependency interface. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 234 | </p></dd> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 235 | |
| 236 | <dd><p> |
| 237 | As of meson 0.49.0 meson also has the concept of a |
| 238 | <a href="https://mesonbuild.com/Native-environments.html">"native file"</a>, |
| 239 | these files provide information about the native build environment (as opposed |
| 240 | to a cross build environment). They are ini formatted and can override where to |
| 241 | find llvm-config: |
Erik Faye-Lund | 0ea4ef2 | 2019-04-18 16:16:06 +0200 | [diff] [blame] | 242 | </p> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 243 | |
| 244 | custom-llvm.ini |
| 245 | <pre> |
| 246 | [binaries] |
| 247 | llvm-config = '/usr/local/bin/llvm/llvm-config' |
| 248 | </pre> |
| 249 | |
| 250 | Then configure meson: |
| 251 | |
| 252 | <pre> |
| 253 | meson builddir/ --native-file custom-llvm.ini |
| 254 | </pre> |
Erik Faye-Lund | 0ea4ef2 | 2019-04-18 16:16:06 +0200 | [diff] [blame] | 255 | </dd> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 256 | |
| 257 | <dd><p> |
Eric Engestrom | a563bb9 | 2019-07-31 11:49:03 +0100 | [diff] [blame^] | 258 | Meson < 0.49 doesn't support native files, so to specify a custom |
| 259 | <code>llvm-config</code> you need to modify your <code>$PATH</code> (or |
| 260 | <code>%PATH%</code> on windows), which will be searched for |
| 261 | <code>llvm-config</code>, <code>llvm-config<i>$version</i></code>, |
| 262 | and <code>llvm-config-<i>$version</i></code>: |
| 263 | </p> |
| 264 | <pre> |
| 265 | PATH=/path/to/folder/with/llvm-config:$PATH meson build |
| 266 | </pre> |
| 267 | </dd> |
| 268 | |
| 269 | <dd><p> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 270 | For selecting llvm-config for cross compiling a |
| 271 | <a href="https://mesonbuild.com/Cross-compilation.html#defining-the-environment">"cross file"</a> |
| 272 | should be used. It uses the same format as the native file above: |
Erik Faye-Lund | 767c517 | 2019-04-18 16:27:26 +0200 | [diff] [blame] | 273 | </p> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 274 | |
Erik Faye-Lund | 767c517 | 2019-04-18 16:27:26 +0200 | [diff] [blame] | 275 | <p>cross-llvm.ini</p> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 276 | <pre> |
| 277 | [binaries] |
| 278 | ... |
| 279 | llvm-config = '/usr/lib/llvm-config-32' |
| 280 | </pre> |
| 281 | |
Erik Faye-Lund | 767c517 | 2019-04-18 16:27:26 +0200 | [diff] [blame] | 282 | <p>Then configure meson:</p> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 283 | <pre> |
| 284 | meson builddir/ --cross-file cross-llvm.ini |
| 285 | </pre> |
| 286 | |
| 287 | See the <a href="#cross-compilation">Cross Compilation</a> section for more information. |
Erik Faye-Lund | 767c517 | 2019-04-18 16:27:26 +0200 | [diff] [blame] | 288 | </dd> |
Dylan Baker | a57dbe6 | 2018-12-20 11:46:08 -0800 | [diff] [blame] | 289 | |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 290 | <dt><code>PKG_CONFIG_PATH</code></dt> |
| 291 | <dd><p>The |
| 292 | <code>pkg-config</code> utility is a hard requirement for configuring and |
Dylan Baker | 2aad12b | 2018-03-01 11:32:56 -0800 | [diff] [blame] | 293 | building Mesa on Unix-like systems. It is used to search for external libraries |
| 294 | on the system. This environment variable is used to control the search path for |
| 295 | <code>pkg-config</code>. For instance, setting |
| 296 | <code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig</code> will search for package |
| 297 | metadata in <code>/usr/X11R6</code> before the standard directories.</p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 298 | </dd> |
| 299 | </dl> |
| 300 | |
| 301 | <p> |
| 302 | One of the oddities of meson is that some options are different when passed to |
| 303 | the <code>meson</code> than to <code>meson configure</code>. These options are |
| 304 | passed as --option=foo to <code>meson</code>, but -Doption=foo to <code>meson |
| 305 | configure</code>. Mesa defined options are always passed as -Doption=foo. |
Eric Engestrom | 67c5507 | 2018-05-14 16:45:31 +0100 | [diff] [blame] | 306 | </p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 307 | |
| 308 | <p>For those coming from autotools be aware of the following:</p> |
| 309 | |
| 310 | <dl> |
| 311 | <dt><code>--buildtype/-Dbuildtype</code></dt> |
| 312 | <dd><p>This option will set the compiler debug/optimisation levels to aid |
| 313 | debugging the Mesa libraries.</p> |
| 314 | |
Eric Engestrom | 37d44e2 | 2018-05-14 16:47:57 +0100 | [diff] [blame] | 315 | <p>Note that in meson this defaults to <code>debugoptimized</code>, and |
| 316 | not setting it to <code>release</code> will yield non-optimal |
| 317 | performance and binary size. Not using <code>debug</code> may interfere |
| 318 | with debugging as some code and validation will be optimized away. |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 319 | </p> |
| 320 | |
Eric Engestrom | 37d44e2 | 2018-05-14 16:47:57 +0100 | [diff] [blame] | 321 | <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] | 322 | buildtype, which causes meson to inject no additional compiler arguments, only |
| 323 | those in the C/CXXFLAGS and those that mesa itself defines.</p> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 324 | </dd> |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 325 | |
Dylan Baker | bc17ac5 | 2017-10-17 12:19:49 -0700 | [diff] [blame] | 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: |
Erik Faye-Lund | 92917e8 | 2019-04-18 15:38:01 +0200 | [diff] [blame] | 353 | </p> |
Eric Engestrom | 393a756 | 2019-01-03 16:01:18 +0000 | [diff] [blame] | 354 | <ul> |
| 355 | <li><a href="https://aur.archlinux.org/packages/meson-cross-x86-linux-gnu">meson-cross-x86-linux-gnu</a></li> |
| 356 | <li><a href="https://aur.archlinux.org/packages/meson-cross-aarch64-linux-gnu">meson-cross-aarch64-linux-gnu</a></li> |
| 357 | </ul> |
Eric Engestrom | 393a756 | 2019-01-03 16:01:18 +0000 | [diff] [blame] | 358 | |
| 359 | <p> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 360 | 32-bit build on x86 linux: |
Erik Faye-Lund | 41573d4 | 2019-04-18 16:12:08 +0200 | [diff] [blame] | 361 | </p> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 362 | <pre> |
| 363 | [binaries] |
| 364 | c = '/usr/bin/gcc' |
| 365 | cpp = '/usr/bin/g++' |
| 366 | ar = '/usr/bin/gcc-ar' |
| 367 | strip = '/usr/bin/strip' |
| 368 | pkgconfig = '/usr/bin/pkg-config-32' |
| 369 | llvm-config = '/usr/bin/llvm-config32' |
| 370 | |
| 371 | [properties] |
| 372 | c_args = ['-m32'] |
| 373 | c_link_args = ['-m32'] |
| 374 | cpp_args = ['-m32'] |
| 375 | cpp_link_args = ['-m32'] |
| 376 | |
| 377 | [host_machine] |
| 378 | system = 'linux' |
| 379 | cpu_family = 'x86' |
| 380 | cpu = 'i686' |
| 381 | endian = 'little' |
| 382 | </pre> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 383 | |
| 384 | <p> |
| 385 | 64-bit build on ARM linux: |
Erik Faye-Lund | 41573d4 | 2019-04-18 16:12:08 +0200 | [diff] [blame] | 386 | </p> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 387 | <pre> |
| 388 | [binaries] |
| 389 | c = '/usr/bin/aarch64-linux-gnu-gcc' |
| 390 | cpp = '/usr/bin/aarch64-linux-gnu-g++' |
Eric Engestrom | 8b363bc | 2019-01-03 15:44:42 +0000 | [diff] [blame] | 391 | ar = '/usr/bin/aarch64-linux-gnu-gcc-ar' |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 392 | strip = '/usr/bin/aarch64-linux-gnu-strip' |
| 393 | pkgconfig = '/usr/bin/aarch64-linux-gnu-pkg-config' |
| 394 | exe_wrapper = '/usr/bin/qemu-aarch64-static' |
| 395 | |
| 396 | [host_machine] |
| 397 | system = 'linux' |
Eric Engestrom | 8b363bc | 2019-01-03 15:44:42 +0000 | [diff] [blame] | 398 | cpu_family = 'aarch64' |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 399 | cpu = 'aarch64' |
| 400 | endian = 'little' |
| 401 | </pre> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 402 | |
| 403 | <p> |
| 404 | 64-bit build on x86 windows: |
Erik Faye-Lund | 41573d4 | 2019-04-18 16:12:08 +0200 | [diff] [blame] | 405 | </p> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 406 | <pre> |
| 407 | [binaries] |
| 408 | c = '/usr/bin/x86_64-w64-mingw32-gcc' |
| 409 | cpp = '/usr/bin/x86_64-w64-mingw32-g++' |
| 410 | ar = '/usr/bin/x86_64-w64-mingw32-ar' |
| 411 | strip = '/usr/bin/x86_64-w64-mingw32-strip' |
| 412 | pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' |
| 413 | exe_wrapper = 'wine' |
| 414 | |
| 415 | [host_machine] |
| 416 | system = 'windows' |
| 417 | cpu_family = 'x86_64' |
| 418 | cpu = 'i686' |
| 419 | endian = 'little' |
| 420 | </pre> |
Eric Engestrom | b0319d0 | 2018-11-29 13:16:42 +0000 | [diff] [blame] | 421 | |
Eric Engestrom | 67c5507 | 2018-05-14 16:45:31 +0100 | [diff] [blame] | 422 | </div> |
| 423 | </body> |
| 424 | </html> |