Branch with the meson build-system (#8467)

* Branch with the meson build-system

* Fix build_environment for dual loads and add create code

* Add documentation

* Fixed option list

* Update build_system_guess for meson

* Fixed documentation errors

* Added meson to build and configure and updated documentation

* fix typos
This commit is contained in:
Tom Merrick
2018-08-10 12:52:09 -05:00
committed by Adam J. Stewart
parent 2a94d59433
commit b1182741d4
9 changed files with 309 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ on these ideas for each distinct build system that Spack supports:
build_systems/autotoolspackage
build_systems/cmakepackage
build_systems/mesonpackage
build_systems/qmakepackage
.. toctree::

View File

@@ -0,0 +1,85 @@
.. _mesonpackage:
------------
MesonPackage
------------
Much like Autotools and CMake, Meson is a build system. But it is
meant to be both fast and as user friendly as possible. GNOME's goal
is to port modules to use the Meson build system.
^^^^^^
Phases
^^^^^^
The ``MesonPackage`` base class comes with the following phases:
#. ``meson`` - generate ninja files
#. ``build`` - build the project
#. ``install`` - install the project
By default, these phases run:
.. code-block:: console
$ mkdir spack-build
$ cd spack-build
$ meson .. --prefix=/path/to/installation/prefix
$ ninja
$ ninja test # optional
$ ninja install
Any of these phases can be overridden in your package as necessary.
There is also a ``check`` method that looks for a ``test`` target
in the build file. If a ``test`` target exists and the user runs:
.. code-block:: console
$ spack install --test=root <meson-package>
Spack will run ``ninja test`` after the build phase.
^^^^^^^^^^^^^^^
Important files
^^^^^^^^^^^^^^^
Packages that use the Meson build system can be identified by the
presence of a ``meson.build`` file. This file declares things
like build instructions and dependencies.
^^^^^^^^^^^^^^^^^^^^^^^^^
Build system dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^
At the bare minimum, packages that use the Meson build system need
``meson`` and ```ninja``` dependencies. Since this is always the case,
the ``MesonPackage`` base class already contains:
.. code-block:: python
depends_on('meson', type='build')
depends_on('ninja', type='build')
^^^^^^^^^^^^^^^^^^^^^^^^^^
Passing arguments to meson
^^^^^^^^^^^^^^^^^^^^^^^^^^
If you need to pass any arguments to the ``meson`` call, you can
override the ``meson_args`` method like so:
.. code-block:: python
def meson_args(self):
return ['--default-library=both']
This method can be used to pass flags as well as variables.
^^^^^^^^^^^^^^^^^^^^^^
External documentation
^^^^^^^^^^^^^^^^^^^^^^
For more information on the Meson build system, see:
https://mesonbuild.com/index.html