Lines Matching +full:meson +full:- +full:version
1 Compilation and Installation Using Meson
5 ---------------
7 For general information about Meson see the `Meson
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
20 current version of Meson.
22 The Meson build of Mesa is tested on Linux, macOS, Windows, Cygwin,
25 Unix-like OSes
28 If Meson is not already installed on your system, you can typically
31 .. code-block:: console
33 sudo apt-get install meson # Ubuntu
37 .. code-block:: console
39 sudo dnf install meson # Fedora
41 Some older versions of Meson do not check that they are too old and will
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*
51 You will need to install Python 3 and Meson as a module using pip. This
53 modules (Mako). You also need pkg-config (a hard dependency of Meson),
57 .. code-block:: console
64 .. code-block:: console
68 Then install Meson using pip
70 .. code-block:: console
72 py -3 -m pip install meson mako
75 Meson.
78 --------------
80 The Meson program is used to configure the source directory and
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
88 directory <https://mesonbuild.com/Using-multiple-build-directories.html>`__
93 .. code-block:: console
95 meson build/
98 you can install them, or try to remove the dependency with a Meson
101 To review the options which Meson chose, run:
103 .. code-block:: console
105 meson configure build/
107 Meson does not currently support listing configuration options before
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>`__
115 With additional arguments ``meson configure`` can be used to change
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=[]``).
129 Once you've run the initial ``meson`` command successfully you can use
132 .. code-block:: console
134 ninja -C build/
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 -----------------
170 Meson default to installing libGL.so in your system's main lib/
174 than the system library directory. This can be done with the --prefix
177 .. code-block:: console
179 meson --prefix="${PWD}/build/install" build/
185 Meson also honors ``DESTDIR`` for installs.
190 Meson supports the common CFLAGS, CXXFLAGS, etc. environment variables
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
207 Meson supports the standard CC and CXX environment variables for
208 changing the default compiler. Note that Meson does not allow changing
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
223 The default compilers depends on your operating system. Meson supports
225 `here <https://mesonbuild.com/Reference-tables.html#compiler-ids>`__.
230 Meson includes upstream logic to wrap llvm-config using its standard
233 As of Meson 0.51.0 Meson can use CMake to find LLVM (the CMake finder
234 was added in Meson 0.49.0, but LLVM cannot be found until 0.51) Due to
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
244 As of Meson 0.49.0 Meson also has the concept of a `"native
245 file" <https://mesonbuild.com/Native-environments.html>`__, these files
248 to find llvm-config:
250 custom-llvm.ini
255 llvm-config = '/usr/local/bin/llvm/llvm-config'
257 Then configure Meson:
259 .. code-block:: console
261 meson builddir/ --native-file custom-llvm.ini
263 Meson < 0.49 doesn't support native files, so to specify a custom
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.
287 Then configure Meson:
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
297 either undesirable or impossible. Meson's solution for this is a
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
308 include_directories, dependencies, and version set)
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:
323 cpp = meson.get_compiler('cpp')
326 _search = join_paths(meson.current_source_dir(), 'lib')
353 version : '6.0.0',
359 It is very important that version is defined and is accurate, if it is
360 not, workarounds for the wrong version of LLVM might be used resulting
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
376 One of the oddities of Meson is that some options are different when
377 passed to the ``meson`` than to ``meson configure``. These options are
378 passed as --option=foo to ``meson``, but -Doption=foo to
379 ``meson configure``. Mesa defined options are always passed as
380 -Doption=foo.
384 ``--buildtype/-Dbuildtype``
388 Note that in Meson this defaults to ``debugoptimized``, and not
389 setting it to ``release`` will yield non-optimal performance and
394 ``plain`` buildtype, which causes Meson to inject no additional
398 ``-Db_ndebug``
399 This option controls assertions in Meson projects. When set to
404 .. _cross-compilation:
406 4. Cross-compilation and 32-bit builds
407 --------------------------------------
409 `Meson supports
410 cross-compilation <https://mesonbuild.com/Cross-compilation.html>`__ by
412 this file to ``meson`` or ``meson configure`` with the ``--cross-file``
416 (without the folder path) if you put it in $XDG_DATA_HOME/meson/cross or
417 ~/.local/share/meson/cross
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'