Lines Matching +full:bare +full:- +full:cross +full:- +full:build
5 ---------------
10 **Mesa's Meson build system is generally considered stable and ready for
15 Mesa requires Meson >= 0.52.0 to build.
19 <https://mesonbuild.com/Getting-meson.html>`__ to install the
22 The Meson build of Mesa is tested on Linux, macOS, Windows, Cygwin,
25 Unix-like OSes
31 .. code-block:: console
33 sudo apt-get install meson # Ubuntu
37 .. code-block:: console
44 You'll also need `Ninja <https://ninja-build.org/>`__. If it's not
45 already installed, use apt-get or dnf to install the *ninja-build*
53 modules (Mako). You also need pkg-config (a hard dependency of Meson),
57 .. code-block:: console
64 .. code-block:: console
70 .. code-block:: console
72 py -3 -m pip install meson mako
78 --------------
81 generates either a Ninja build file or Visual Studio® build files. The
82 latter must be enabled via the ``--backend`` switch, as Ninja is the
85 Meson only supports out-of-tree builds, and must be passed a directory
87 "build" here. It's recommended to create a `separate build
88 directory <https://mesonbuild.com/Using-multiple-build-directories.html>`__
93 .. code-block:: console
95 meson build/
97 This will create the build directory. If any dependencies are missing,
103 .. code-block:: console
105 meson configure build/
108 running "meson build/" but this feature is being discussed upstream. For
109 now, we have a ``bin/meson-options.py`` script that prints the options
112 `meson_options.txt <https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/meson_options.txt>`__
116 options for a previously configured build directory. All options passed
117 to this command are in the form ``-D "option"="value"``. For example:
119 .. code-block:: console
121 meson configure build/ -Dprefix=/tmp/install -Dglx=true
124 complicated <https://mesonbuild.com/Build-options.html#using-build-options>`__,
126 separate values (``-D platforms=drm,wayland``) and brackets to represent
127 an empty list (``-D platforms=[]``).
130 your configured backend to build the project in your build directory:
132 .. code-block:: console
134 ninja -C build/
137 finishes up some final steps of the build process (such as creating
140 .. code-block:: console
142 ninja -C build/ install
150 clang-cl, or ICL (the Intel Compiler), read on.
153 Meson with these it to open a shell. For clang-cl you will need to open
155 file <https://mesonbuild.com/Native-environments.html>`__, or with the
160 ``--backend=vs`` to Meson will generate a Visual Studio solution. If you
161 want to use ICL or clang-cl with the vsbackend you will need Meson
165 -----------------
174 than the system library directory. This can be done with the --prefix
177 .. code-block:: console
179 meson --prefix="${PWD}/build/install" build/
181 will put the final libraries and drivers into the build/install/
193 Instead, it is recommended to use ``-D${lang}_args`` and
194 ``-D${lang}_link_args``. Among the benefits of these options is that
197 This example sets -fmax-errors for compiling C sources and -DMAGIC=123
200 .. code-block:: console
202 meson builddir/ -Dc_args=-fmax-errors=10 -Dcpp_args=-DMAGIC=123
210 build dir for a different compiler.
213 build directory before reconfiguring with an extra C option:
215 .. code-block:: console
217 CC=clang CXX=clang++ meson build-clang
218 ninja -C build-clang
219 ninja -C build-clang clean
220 meson configure build -Dc_args="-Wno-typedef-redefinition"
221 ninja -C build-clang
225 `here <https://mesonbuild.com/Reference-tables.html#compiler-ids>`__.
230 Meson includes upstream logic to wrap llvm-config using its standard
237 ``-Dcmake_module_path`` option in this Meson version, which points to
240 .. code-block:: console
242 meson builddir -Dcmake_module_path=/home/user/mycmake/prefix
245 file" <https://mesonbuild.com/Native-environments.html>`__, these files
246 provide information about the native build environment (as opposed to a
247 cross build environment). They are ini formatted and can override where
248 to find llvm-config:
250 custom-llvm.ini
255 llvm-config = '/usr/local/bin/llvm/llvm-config'
259 .. code-block:: console
261 meson builddir/ --native-file custom-llvm.ini
264 ``llvm-config`` you need to modify your ``$PATH`` (or ``%PATH%`` on
265 Windows), which will be searched for ``llvm-config``,
266 ``llvm-config$version``, and ``llvm-config-$version``:
268 .. code-block:: console
270 PATH=/path/to/folder/with/llvm-config:$PATH meson build
272 For selecting llvm-config for cross compiling a `"cross
273 file" <https://mesonbuild.com/Cross-compilation.html#defining-the-environment>`__
276 cross-llvm.ini
282 llvm-config = '/usr/lib/llvm-config-32'
283 cmake = '/usr/bin/cmake-for-my-arch'
285 Obviously, only cmake or llvm-config is required.
289 .. code-block:: console
291 meson builddir/ --cross-file cross-llvm.ini
293 See the :ref:`Cross Compilation <cross-compilation>` section for more
296 On Windows (and in other cases), using llvm-config or CMake may be
298 `wrap <https://mesonbuild.com/Wrap-dependency-system-manual.html>`__, in
301 - Install the binaries and headers into the
303 - Add a meson.build file to that directory (more on that later)
307 - ``dep_llvm``: a ``declare_dependency()`` object with
312 - ``irbuilder_h``: a ``files()`` object pointing to llvm/IR/IRBuilder.h
314 - ``has_rtti``: a ``bool`` that declares whether LLVM was built with
317 such a meson.build file might look like:
361 in build failures.
366 The ``pkg-config`` utility is a hard requirement for configuring and
367 building Mesa on Unix-like systems. It is used to search for external
369 the search path for ``pkg-config``. For instance, setting
378 passed as --option=foo to ``meson``, but -Doption=foo to
380 -Doption=foo.
384 ``--buildtype/-Dbuildtype``
389 setting it to ``release`` will yield non-optimal performance and
398 ``-Db_ndebug``
404 .. _cross-compilation:
406 4. Cross-compilation and 32-bit builds
407 --------------------------------------
410 cross-compilation <https://mesonbuild.com/Cross-compilation.html>`__ by
412 this file to ``meson`` or ``meson configure`` with the ``--cross-file``
415 This file can live at any location, but you can use the bare filename
416 (without the folder path) if you put it in $XDG_DATA_HOME/meson/cross or
417 ~/.local/share/meson/cross
419 Below are a few example of cross files, but keep in mind that you will
422 Those running on ArchLinux can use the AUR-maintained packages for some
425 - `meson-cross-x86-linux-gnu <https://aur.archlinux.org/packages/meson-cross-x86-linux-gnu>`__
426 - `meson-cross-aarch64-linux-gnu <https://aur.archlinux.org/packages/meson-cross-aarch64-linux-gnu…
428 32-bit build on x86 linux:
435 ar = '/usr/bin/gcc-ar'
437 pkgconfig = '/usr/bin/pkg-config-32'
438 llvm-config = '/usr/bin/llvm-config32'
441 c_args = ['-m32']
442 c_link_args = ['-m32']
443 cpp_args = ['-m32']
444 cpp_link_args = ['-m32']
452 64-bit build on ARM linux:
457 c = '/usr/bin/aarch64-linux-gnu-gcc'
458 cpp = '/usr/bin/aarch64-linux-gnu-g++'
459 ar = '/usr/bin/aarch64-linux-gnu-gcc-ar'
460 strip = '/usr/bin/aarch64-linux-gnu-strip'
461 pkgconfig = '/usr/bin/aarch64-linux-gnu-pkg-config'
462 exe_wrapper = '/usr/bin/qemu-aarch64-static'
470 64-bit build on x86 Windows:
475 c = '/usr/bin/x86_64-w64-mingw32-gcc'
476 cpp = '/usr/bin/x86_64-w64-mingw32-g++'
477 ar = '/usr/bin/x86_64-w64-mingw32-ar'
478 strip = '/usr/bin/x86_64-w64-mingw32-strip'
479 pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'