Meson, a build system for C/C++/Fortran/D will reach 1.0 in the next release

5 points by germandiago ↗ HN
Yesterday took a look and looking at the docs and to my surprise! https://mesonbuild.com/Release-notes-for-1-0-0.html

After 10 years of development, at last, Meson seems it will reach 1.0 status in the next release :)

As it has been a long time and this is my personal favorite build system, I would like to share here what makes Meson worth a try in my opinion.

For whoever does not know Meson, Meson is a build system generator just like CMake and it is becoming the standard for many uses in the Linux world but it also plays well in Windows, unlike Autotools or Make, which are quite hard to handle in non-unix systems.

It supports C, C++, Vala (for Gnome), Fortran, D and limited support for Rust and Java. It can mix and match native binaries as well when compiling and it comes with the usual tweaks for flags, etc, per binary, project, etc. It has its own package system, wraps, and a very well-thought subprojects model (dependencies) but it is also compatible with Conan via pkg-config.

Some of the features that make Meson a good alternative to CMake:

    the DSL is much easier to grasp

    it has an integrated subprojects system, wraps

    the DSL has types, so it catches many errors at the time of generation. No more empty interpolation or guess-how-to-make-your-if-condition-work. Unsurprising dictionaries, lists, ints and powerful string manipulation with a Python flavor (but it is not Python).

    easy to mix and match binaries from different build systems

    zero-code switch dependencies for subprojects or system dependencies (a feature usually useful for packagers in Linux distros)

    way better typed options: combo, booleans, features, ints, lists

    unsurprising and predictable project layout: by default, subprojects go always into subprojects and options into meson_options.txt files. Build files are called meson.build. No tricks, just everything where you would expect for any project.

    Consume your CMake subprojects from Meson (subject to non-guaranteed working, but never had a problem in practice, even with Capnproto, though someone in comments claims problems with gRPC). As a fallback you can have wraps (needs meson.build) and Conan.

    superior cross-compilation model. Easy to grasp files without a lot of extra programming and (native: true|false) flag.
On the side of criticism that usually comes for Meson:

    you cannot extend it with your own functions

    it does not provide anything similar to macros

    files must be called meson.build and there are no equivalent of include, etc. for meson files, so sometimes they can get somewhat bigger (even if they are easier to read than CMake in general terms)
You can get a hand out of it in here:

    https://www.youtube.com/watch?v=SCZLnopmYBM

    https://www.youtube.com/watch?v=NUxgbXEXAoU
Here it is an incomplete (and outdated I think?) short list of projects using Meson:

https://mesonbuild.com/Users.html

3 comments

[ 3.4 ms ] story [ 14.9 ms ] thread
I wonder if it is now possible to "get" an object file "out of a library" so I can link it into a test program.
As far as I know, yes. But I do not recall where in the docs it is specified.
Meson is great! It's the best way to build software using the only true way, the way the Meson developer likes. If you like to build software the way the Meson developer prefers (which is the one and only way to build software), Meson is the best build tool.

If you like having a say in how you actually build your own fucking software you can always use a more primitive and obsolete tool like CMake.