• Home
  • Raw
  • Download

Lines Matching +full:meson +full:- +full:version

1 Compilation and Installation Using Meson
5 ---------------
7 For general information about Meson see the `Meson
12 Mesa requires Meson >= 0.60.0 to build.
16 <https://mesonbuild.com/Getting-meson.html>`__ to install the
17 current version of Meson.
19 The Meson build of Mesa is tested on Linux, macOS, Windows, Cygwin,
22 Unix-like OSes
25 If Meson is not already installed on your system, you can typically
28 .. code-block:: sh
30 sudo apt-get install meson # Ubuntu
34 .. code-block:: sh
36 sudo dnf install meson # Fedora
38 Some older versions of Meson do not check that they are too old and will
41 You'll also need `Ninja <https://ninja-build.org/>`__. If it's not
42 already installed, use apt-get or dnf to install the *ninja-build*
48 You will need to install Python 3 and Meson as a module using pip. This
50 modules (Mako). You also need pkg-config (a hard dependency of Meson),
54 .. code-block:: sh
61 .. code-block:: sh
65 Then install Meson using pip
67 .. code-block:: sh
69 py -3 -m pip install meson packaging mako
72 Meson.
75 --------------
77 The Meson program is used to configure the source directory and
79 latter must be enabled via the ``--backend`` switch, as Ninja is the
82 Meson only supports out-of-tree builds, and must be passed a directory
85 directory <https://mesonbuild.com/Using-multiple-build-directories.html>`__
90 .. code-block:: sh
92 meson setup build/
95 you can install them, or try to remove the dependency with a Meson
96 configuration option (see below). Meson will print a summary of the
99 To review the options which Meson chose, run:
101 .. code-block:: sh
103 meson configure build/
105 Recent version of Meson can print the available options and their
106 default values by running ``meson configure`` in the source directory.
107 If your Meson version is too old, you can always look in the
108 `meson_options.txt <https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/meson_options.txt>`__
111 With additional arguments ``meson configure`` can be used to change
113 to this command are in the form ``-D "option"="value"``. For example:
115 .. code-block:: sh
117 meson configure build/ -Dprefix=/tmp/install -Dglx=true
120 complicated <https://mesonbuild.com/Build-options.html#using-build-options>`__,
122 separate values (``-D platforms=drm,wayland``) and brackets to represent
123 an empty list (``-D platforms=[]``).
125 Once you've run the initial ``meson`` command successfully you can use
128 .. code-block:: sh
130 ninja -C build/
136 .. code-block:: sh
138 ninja -C build/ install
146 clang-cl, or ICL (the Intel Compiler), read on.
149 Meson with these it to open a shell. For clang-cl you will need to open
151 file <https://mesonbuild.com/Native-environments.html>`__, or with the
156 ``--backend=vs`` to Meson will generate a Visual Studio solution.
159 -----------------
164 Meson default to installing :file:`libGL.so` in your system's main
168 than the system library directory. This can be done with the --prefix
171 .. code-block:: sh
173 meson --prefix="${PWD}/build/install" build/
179 Meson also honors ``DESTDIR`` for installs.
184 Meson supports the common CFLAGS, CXXFLAGS, etc. environment variables
187 Instead, it is recommended to use ``-D${lang}_args`` and
188 ``-D${lang}_link_args``. Among the benefits of these options is that
191 This example sets -fmax-errors for compiling C sources and -DMAGIC=123
194 .. code-block:: sh
196 meson setup builddir/ -Dc_args=-fmax-errors=10 -Dcpp_args=-DMAGIC=123
201 Meson supports the standard CC and CXX environment variables for
202 changing the default compiler. Note that Meson does not allow changing
209 .. code-block:: sh
211 CC=clang CXX=clang++ meson setup build-clang
212 ninja -C build-clang
213 ninja -C build-clang clean
214 meson configure build -Dc_args="-Wno-typedef-redefinition"
215 ninja -C build-clang
217 The default compilers depends on your operating system. Meson supports
219 `here <https://mesonbuild.com/Reference-tables.html#compiler-ids>`__.
224 Meson includes upstream logic to wrap llvm-config using its standard
227 Meson can use CMake to find LLVM. But due to the way LLVM implements its
229 :file:`libllvm.so`. There is also a ``-Dcmake_module_path`` option,
233 .. code-block:: sh
235 meson setup builddir -Dcmake_module_path=/home/user/mycmake/prefix
237 As of Meson 0.49.0 Meson also has the concept of a `"native
238 file" <https://mesonbuild.com/Native-environments.html>`__, these files
241 to find llvm-config:
243 .. code-block:: ini
244 :caption: custom-llvm.ini
247 llvm-config = '/usr/local/bin/llvm/llvm-config'
249 Then configure Meson:
251 .. code-block:: sh
253 meson setup builddir/ --native-file custom-llvm.ini
255 For selecting llvm-config for cross compiling a `"cross
256 file" <https://mesonbuild.com/Cross-compilation.html#defining-the-environment>`__
259 .. code-block:: ini
260 :caption: cross-llvm.ini
264 llvm-config = '/usr/lib/llvm-config-32'
265 cmake = '/usr/bin/cmake-for-my-arch'
267 Obviously, only CMake or llvm-config is required.
269 Then configure Meson:
271 .. code-block:: sh
273 meson setup builddir/ --cross-file cross-llvm.ini
275 See the :ref:`Cross Compilation <cross-compilation>` section for more
278 On Windows (and in other cases), using llvm-config or CMake may be
279 either undesirable or impossible. Meson's solution for this is a
280 `wrap <https://mesonbuild.com/Wrap-dependency-system-manual.html>`__, in
283 - Install the binaries and headers into the
285 - Add a :file:`meson.build` file to that directory (more on that later)
289 - ``dep_llvm``: a ``declare_dependency()`` object with
290 include_directories, dependencies, and version set)
294 - ``irbuilder_h``: a ``files()`` object pointing to llvm/IR/IRBuilder.h
295 - ``has_rtti``: a ``bool`` that declares whether LLVM was built with
298 such a :file:`meson.build` file might look like:
304 cpp = meson.get_compiler('cpp')
307 _search = join_paths(meson.current_source_dir(), 'lib')
334 version : '6.0.0',
340 It is very important that version is defined and is accurate, if it is
341 not, workarounds for the wrong version of LLVM might be used resulting
347 The ``pkg-config`` utility is a hard requirement for configuring and
348 building Mesa on Unix-like systems. It is used to search for external
350 the search path for ``pkg-config``. For instance, setting
357 One of the oddities of Meson is that some options are different when
358 passed to :program:`meson` than to ``meson configure``. These options are
359 passed as --option=foo to :program:`meson`, but -Doption=foo to
360 ``meson configure``. Mesa defined options are always passed as
361 -Doption=foo.
365 ``--buildtype/-Dbuildtype``
369 Note that in Meson this defaults to ``debugoptimized``, and not
370 setting it to ``release`` will yield non-optimal performance and
375 ``plain`` buildtype, which causes Meson to inject no additional
379 ``-Db_ndebug``
380 This option controls assertions in Meson projects. When set to
385 .. _cross-compilation:
387 4. Cross-compilation and 32-bit builds
388 --------------------------------------
390 `Meson supports
391 cross-compilation <https://mesonbuild.com/Cross-compilation.html>`__ by
393 this file to ``meson`` or ``meson configure`` with the ``--cross-file``
398 :file:`$XDG_DATA_HOME/meson/cross` or :file:`~/.local/share/meson/cross`
403 Those running on Arch Linux can use the AUR-maintained packages for some
406 - `meson-cross-x86-linux-gnu <https://aur.archlinux.org/packages/meson-cross-x86-linux-gnu>`__
407 - `meson-cross-aarch64-linux-gnu <https://github.com/dcbaker/archlinux-meson-cross-aarch64-linux-g…
409 32-bit build on x86 linux:
411 .. code-block:: ini
416 ar = '/usr/bin/gcc-ar'
418 pkgconfig = '/usr/bin/pkg-config-32'
419 llvm-config = '/usr/bin/llvm-config32'
422 c_args = ['-m32']
423 c_link_args = ['-m32']
424 cpp_args = ['-m32']
425 cpp_link_args = ['-m32']
433 64-bit build on ARM linux:
435 .. code-block:: ini
438 c = '/usr/bin/aarch64-linux-gnu-gcc'
439 cpp = '/usr/bin/aarch64-linux-gnu-g++'
440 ar = '/usr/bin/aarch64-linux-gnu-gcc-ar'
441 strip = '/usr/bin/aarch64-linux-gnu-strip'
442 pkgconfig = '/usr/bin/aarch64-linux-gnu-pkg-config'
443 exe_wrapper = '/usr/bin/qemu-aarch64-static'
451 64-bit build on x86 Windows:
453 .. code-block:: ini
456 c = '/usr/bin/x86_64-w64-mingw32-gcc'
457 cpp = '/usr/bin/x86_64-w64-mingw32-g++'
458 ar = '/usr/bin/x86_64-w64-mingw32-ar'
459 strip = '/usr/bin/x86_64-w64-mingw32-strip'
460 pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'