Meson (software)
   HOME

TheInfoList



OR:

Meson () is a software
build automation Build automation is the practice of building software systems in a relatively unattended fashion. The build is configured to run with minimized or no software developer interaction and without using a developer's personal computer. Build automati ...
tool A tool is an Physical object, object that can extend an individual's ability to modify features of the surrounding environment or help them accomplish a particular task. Although many Tool use by animals, animals use simple tools, only human bei ...
for building a
codebase In software development, a codebase (or code base) is a collection of source code used to build a particular software system, application, or software component. Typically, a codebase includes only human-written source code system files; thu ...
. Meson adopts a
convention over configuration Convention over configuration (also known as coding by convention) is a software design paradigm used by software frameworks that attempts to decrease the number of decisions that a developer using the framework is required to make without nec ...
approach to minimize the data required to configure the most common operations. Meson is
free and open-source software Free and open-source software (FOSS) is software available under a license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term encompassing free ...
under the Apache License 2.0. Meson is written in
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
and runs on
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
-like (including
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
and
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
),
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and other operating systems. It supports building C, C++, C#,
CUDA In computing, CUDA (Compute Unified Device Architecture) is a proprietary parallel computing platform and application programming interface (API) that allows software to use certain types of graphics processing units (GPUs) for accelerated gene ...
,
Objective-C Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was ...
, D, Fortran,
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
,
Rust Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH) ...
, and
Vala Vala or VALA may refer to: Religion and mythology * Vala (Vedic), a demon or a stone cavern in the Hindu scriptures * Völva, also spelled Vala, a priestess in Norse mythology and Norse paganism Fiction * Vala (Middle-earth), an angelic being in ...
. It handles dependencies via a mechanism named ''Wrap''. It supports
GNU Compiler Collection The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
(gcc),
Clang Clang () is a compiler front end for the programming languages C, C++, Objective-C, Objective-C++, and the software frameworks OpenMP, OpenCL, RenderScript, CUDA, SYCL, and HIP. It acts as a drop-in replacement for the GNU Compiler ...
,
Visual C++ Microsoft Visual C++ (MSVC) is a compiler for the C, C++, C++/CLI and C++/CX programming languages by Microsoft. MSVC is proprietary software; it was originally a standalone product but later became a part of Visual Studio and made available ...
and other compilers, including non-traditional compilers such as
Emscripten Emscripten is an LLVM/Clang-based compiler that compiles C and C++ source code to WebAssembly, primarily for execution in web browsers. Emscripten allows applications and libraries written in C or C++ to be compiled ahead of time and run effi ...
and
Cython Cython () is a superset of the programming language Python, which allows developers to write Python code (with optional, C-inspired syntax extensions) that yields performance comparable to that of C. Cython is a compiled language that is ty ...
. The project uses
ninja A , or was a spy and infiltrator in pre-modern Japan. The functions of a ninja included siege and infiltration, ambush, reconnaissance, espionage, deception, and later bodyguarding.Kawakami, pp. 21–22 Antecedents may have existed as ear ...
as the primary backend buildsystem, but can also use
Visual Studio Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development ...
or
Xcode Xcode is a suite of developer tools for building apps on Apple devices. It includes an integrated development environment (IDE) of the same name for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, tvOS, and visionOS. It w ...
backends. Meson's support for Fortran and
Cython Cython () is a superset of the programming language Python, which allows developers to write Python code (with optional, C-inspired syntax extensions) that yields performance comparable to that of C. Cython is a compiled language that is ty ...
was improved to help various scientific projects in their switch from to Meson, for example
SciPy SciPy (pronounced "sigh pie") is a free and open-source Python library used for scientific computing and technical computing. SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, fast Fourier ...
. Meson can be used as a PEP517 backend to build Python ''wheels'', via the package.


Language

The syntax of Meson's build description files, the Meson language, borrows from
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
, but is not Python. It is designed such that it can be reimplemented in any other language; for example, muon is a C implementation, and Meson++ is a C++ implementation. The dependency on Python is an implementation detail. The Meson language is intentionally not
Turing-complete In computability theory, a system of data-manipulation rules (such as a model of computation, a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing-complete or computationally universal if it can be ...
, and can therefore not express an arbitrary program. Instead, arbitrary build steps beyond compiling supported languages can be represented as custom targets. The Meson language is strongly typed, such that builtin types like library, executable, string, and lists thereof, are non-interchangeable. In particular, unlike Make, the list type does not split strings on whitespace. Thus, whitespace and other characters in filenames and program arguments are handled cleanly.


Speed and correctness

As with any typical buildsystem, correct incremental builds are the most significant speed feature (because all incremental progress is discarded whenever the user is forced to do a clean build). Unlike bare Make, the separate configure step ensures that changes to arguments, environment variables and command output are not partially applied in subsequent builds, which would lead to a stale build. Like Ninja, Meson does not support globbing of source files. By requiring all source files to be listed in the build definition files, the build definition file timestamps are sufficient to determine whether the set of source files has changed, thereby ensuring that removed source files are detected.
CMake CMake is a free, cross-platform, software development tool for building applications via compiler-independent instructions. It also can automate testing, packaging and installation. It runs on a variety of platforms and supports many program ...
supports globbing, but recommends against it for the same reason. Meson uses ccache automatically if installed. It also detects changes to
symbol table In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier, symbol, constant, procedure and function in a program's source code is associated with information ...
s of
shared libraries In computing, a library is a collection of resources that can be leveraged during software development to implement a computer program. Commonly, a library consists of executable code such as compiled functions and classes, or a library can ...
to skip relinking executables against the library when there are no ABI changes. Precompiled headers are supported, but require configuration. Debug builds are without optimization by default.


Features

A stated goal of Meson is to facilitate modern development practices. As such, Meson knows how to do unity builds, build with test coverage etc. without the programmer having to write support for this.


Subprojects

Meson can automatically find and use external dependencies installed on the user's system via
pkg-config pkg-config is a software development tool that queries information about libraries from a local, file-based database for the purpose of building a codebase that depends on them. It allows for sharing a codebase in a cross-platform way by using ...
, CMake, and project-specific lookups. Alternatively, or as a fallback, a dependency can be provided as a ''subproject'' – a Meson project within another, either contained or as a download link, possibly with patches. This lets Meson resolve
dependency hell Dependency hell is a colloquial term for the frustration of some software users who have installed software packages which have dependencies on specific versions of other software packages. The dependency issue arises when several packages ha ...
for the convenience of casual users who want to compile the project, but may contribute to
software bloat Software bloat is a process whereby successive versions of a computer program become perceptibly slower, use more memory, disk space or processing power, or have higher hardware requirements than the previous version, while making only dubious ...
if a common installed dependency could have been used instead. The mode favored by Linux packagers is therefore fallback. Meson supports Meson and CMake subprojects. A Meson build file may also refer to the WrapDB service.


Cross compilation

Cross compilation requires extra configuration, which Meson supports in the form of a separate ''cross file'', which can be external to the Meson project.


Installation directory setup

Setting the library installation directory on x86_64 Unix is handled automatically by Meson, but not by other tools such as Autotools.


Adopters

GNOME A gnome () is a mythological creature and diminutive spirit in Renaissance magic and alchemy, introduced by Paracelsus in the 16th century and widely adopted by authors, including those of modern fantasy literature. They are typically depict ...
has made it a goal to port its projects to Meson. As of late 2017,
GNOME Shell GNOME Shell is the graphical shell of the GNOME desktop environment starting with version 3, which was released on April 6, 2011. It provides basic functions like launching applications and switching between windows. GNOME Shell replaced GN ...
itself exclusively requires Meson after abandoning
Autotools The GNU Autotools, also known as the GNU Build System, is a suite of build automation tools designed to support building source code and packaging the resulting binaries. It supports building a codebase for multiple target systems without custom ...
, and central components like
GTK+ GTK (formerly GIMP ToolKit and GTK+) is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and proprietary s ...
, Clutter-GTK,
GLib GLib is a bundle of three (formerly five) low-level system libraries written in C and developed mainly by GNOME. GLib's code was separated from GTK, so it can be used by software other than GNOME and has been developed in parallel ever since ...
and
GStreamer GStreamer is a Pipeline (computing), pipeline-based multimedia framework that links together a wide variety of media processing systems to complete complex workflows. For instance, GStreamer can be used to build a system that reads files in one f ...
can be built with Meson. Many
freedesktop.org freedesktop.org (fd.o), formerly X Desktop Group (XDG), is a project to work on interoperability and shared base technology for free-software desktop environments for the X Window System (X11) and Wayland on Linux and other Unix-like operatin ...
projects have switched to Meson.
Systemd systemd is a software suite that provides an array of system components for Linux operating systems. The main aim is to unify service configuration and behavior across Linux distributions. Its primary component is a "system and service manage ...
relies on Meson since dropping Autotools in version 234, and also X.Org and
Mesa A mesa is an isolated, flat-topped elevation, ridge, or hill, bounded from all sides by steep escarpments and standing distinctly above a surrounding plain. Mesas consist of flat-lying soft sedimentary rocks, such as shales, capped by a ...
were ported to Meson.


Feature comparison

Feature comparison with
CMake CMake is a free, cross-platform, software development tool for building applications via compiler-independent instructions. It also can automate testing, packaging and installation. It runs on a variety of platforms and supports many program ...
and Make.


See also

*


References


External links

* {{DEFAULTSORT:Meson Build automation Compiling tools Free software programmed in Python Meson build system Software using the Apache license