If Meson is not already installed on your system, you can typically
install it with your package installer. For example:
-::
+.. code-block:: console
sudo apt-get install meson # Ubuntu
or
-::
+.. code-block:: console
sudo dnf install meson # Fedora
flex, and bison. The easiest way to install everything you need is with
`chocolatey <https://chocolatey.org/>`__.
-::
+.. code-block:: console
choco install python3 winflexbison pkgconfiglite
You can even use chocolatey to install mingw and ninja (ninja can be
used with MSVC as well)
-::
+.. code-block:: console
choco install ninja mingw
Then install meson using pip
-::
+.. code-block:: console
py -3 -m pip install meson mako
Basic configuration is done with:
-::
+.. code-block:: console
meson build/
To review the options which Meson chose, run:
-::
+.. code-block:: console
meson configure build/
options for a previously configured build directory. All options passed
to this command are in the form ``-D "option"="value"``. For example:
-::
+.. code-block:: console
meson configure build/ -Dprefix=/tmp/install -Dglx=true
Once you've run the initial ``meson`` command successfully you can use
your configured backend to build the project in your build directory:
-::
+.. code-block:: console
ninja -C build/
finishes up some final steps of the build process (such as creating
symbolic links for drivers). To install:
-::
+.. code-block:: console
ninja -C build/ install
configuration tool) as part of the build process, Meson does not do
this. Instead, you will need do this:
- ::
+ .. code-block:: console
ninja -C build/ xmlpool-pot xmlpool-update-po xmlpool-gmo
than the system library directory. This can be done with the --prefix
option. For example:
-::
+.. code-block:: console
meson --prefix="${PWD}/build/install" build/
This example sets -fmax-errors for compiling C sources and -DMAGIC=123
for C++ sources:
-::
+.. code-block:: console
meson builddir/ -Dc_args=-fmax-errors=10 -Dcpp_args=-DMAGIC=123
This is an example of specifying the clang compilers and cleaning the
build directory before reconfiguring with an extra C option:
-::
+.. code-block:: console
CC=clang CXX=clang++ meson build-clang
ninja -C build-clang
``-Dcmake_module_path`` option in this meson version, which points to
the root of an alternative installation (the prefix). For example:
-::
+.. code-block:: console
meson builddir -Dcmake_module_path=/home/user/mycmake/prefix
Then configure meson:
-::
+.. code-block:: console
meson builddir/ --native-file custom-llvm.ini
windows), which will be searched for ``llvm-config``,
``llvm-config$version``, and ``llvm-config-$version``:
-::
+.. code-block:: console
PATH=/path/to/folder/with/llvm-config:$PATH meson build
Then configure meson:
-::
+.. code-block:: console
meson builddir/ --cross-file cross-llvm.ini