Meson is a software tool to automate the construction of software. It is free and open source written in Python.
The release of the new version of the Meson 1.4 build system was recently announced . This version comes with improved support for certain functions of the FS module, as well as compatibility improvements, new features, and more.
For those unfamiliar with Meson, it's a build system used by prominent projects such as X.Org Server, Mesa, Lighttpd, systemd, GStreamer, Wayland, GNOME, and GTK. Its primary goal is to provide a fast and user-friendly build process. It uses the Ninja toolkit by default but is also compatible with other backends like Xcode and Visual Studio.
This system features an integrated cross-platform dependency manager that simplifies the creation of packages for distributions. Compilation rules are defined in a specific, readable language, minimizing the time required to write them.
Meson supports building projects in multiple languages ​​such as C, C++, Fortran, Java, and Rust, and offers an incremental build mode that rebuilds only components affected by changes since the last build. Additionally, Meson can generate repeatable builds, ensuring that running the build in different environments produces completely identical executables.
Main novelties of Meson 1.4
This new version of Meson 1.4 highlights the added support for the FS module, which now supports build_tgt and custom_tgt compilation target objects, as well as a compilation target index (custom_idx) in the fs.name, fs.parent, fs.replace_suffix and fs.stem functions.
Another notable change in this new version is that Meson can now read the project version from CMake-based subprojects. This ensures that version constraints are correctly verified when accessing a CMake subproject.
In addition, the `preserve_paths` argument has now been added to the `compile_ui`, `compile_moc`, and preprocessing functions of the `qt4`, `qt5`, and `qt6` modules to select the option to build the directory structure for the files being written.
Also of note is that Clang support was added to stldebug when debugstl is enabled, the unset() method was introduced to the env object, and the full_path() method was added to the File object to get the full path to the file.
Support for the numpy-config tool and pkg-config has been added as new custom dependencies. This is available starting with NumPy 2.0.0. Support for numpy-config will work automatically once NumPy is installed. However, the pkg-config file is located within the Python site packages, meaning it cannot be used immediately without configuring PKG_CONFIG_PATH.
Other notable changes in this new version include:
- Ability to control assertion checks (GLIBCXX_ASSERTIONS) in C++ stdlib via ndebug configuration.
- Added preserve_pathsun keyword argument to qt module functions
- It is now possible to specify dependent targets with depends: for compiler.preprocess(). These targets must be constructed before preprocessing begins.
- The bindgen binding generator now supports Meson heuristics for determining C++ header files.
- Added the ability to override language settings for bindgen.
- Tests now fail by default after encountering errors when running sanitizers like MemorySanitizer.
- Added support for the Texas Instruments C/C++ compiler for the C6000 CPU family.
Finally, if you are interested in learning more, you can find the details at the following link.
How to install Meson on Linux?
For those who are interested in being able to install this build system on their system, they can do so by following the instructions we share below.
They should know that Meson is available on PyPi, so it can be installed with the command:
pip3 install meson
As a note, you should know that the exact command to type to install pip can vary between systems, so it is recommended that you use the Python 3 version of pip.