Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Meson (software)

From Wikipedia, the free encyclopedia
Build automation tool

Meson
Logo since 2019
Meson configuringdav1d
DeveloperJussi Pakkanen
Initial release2 March 2013; 12 years ago (2013-03-02)
Stable release
1.10.0[1] Edit this on Wikidata / 8 December 2025; 2 months ago (8 December 2025)
Written inPython
Operating systemCross-platform
TypeSoftware development tools
LicenseApache License 2.0
Websitemesonbuild.com Edit this on Wikidata
Repository

Meson (/ˈmɛ.sɒn/)[2] is a softwarebuild automationtool for building acodebase. Meson adopts aconvention over configuration approach to minimize the data required to configure the most common operations.[3] Meson isfree and open-source software under theApache License 2.0.[4]

Meson is written inPython and runs onUnix-like (includingLinux andmacOS),Windows and other operating systems. It supports buildingC,C++,C#,CUDA,Objective-C,D,Fortran,Java,Rust, andVala.[5] It handles dependencies via a mechanism namedWrap. It supportsGNU Compiler Collection (gcc),Clang,Visual C++ and other compilers, including non-traditional compilers such asEmscripten andCython.[6] The project usesninja as the primary backend buildsystem, but can also useVisual Studio orXcode backends.

Meson's support forFortran andCython was improved to help various scientific projects in their switch fromsetuptools to Meson, for exampleSciPy.[7] Meson can be used as a PEP517 backend to build Pythonwheels, via themeson-python package.[8]

Language

[edit]

The syntax of Meson's build description files, the Meson language, borrows fromPython, but is not Python. It is designed such that it can be reimplemented in any other language;[9] for example, muon[10] is a C implementation, and Meson++[11] is a C++ implementation. The dependency on Python is an implementation detail.

The Meson language is intentionally notTuring-complete, and therefore can not express an arbitrary program.[9] Instead, arbitrary build steps beyond compiling supported languages can be represented as custom targets.

The Meson language isstrongly typed, such that builtin types like library, executable, string, and lists thereof, are non-interchangeable.[12] In particular, unlikeMake, the list type does not split strings on whitespace.[9] Thus, whitespace and other characters in filenames and program arguments are handled cleanly.

Speed and correctness

[edit]

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 supportglobbing of source files.[9] 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 supports globbing, but recommends against it for the same reason.[13]

Meson usesccache automatically if installed.[14] It also detects changes tosymbol tables ofshared libraries to skip relinking executables against the library when there are noABI changes.Precompiled headers are supported, but require configuration.[15] Debug builds are without optimization by default.

icon
This sectionneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources in this section. Unsourced material may be challenged and removed.(March 2024) (Learn how and when to remove this message)
This sectionmay containoriginal research. Pleaseimprove it byverifying the claims made and addinginline citations. Statements consisting only of original research should be removed.(March 2024) (Learn how and when to remove this message)

Features

[edit]

A stated goal of Meson is to facilitate modern development practices. As such, Meson knows how to dounity builds,[16] build withtest coverage[17] etc. without the programmer having to write support for this.

Subprojects

[edit]

Meson can automatically find and use external dependencies installed on the user's system viapkg-config, CMake, and project-specific lookups.[18]Alternatively, or as a fallback, a dependency can be provided as asubproject – a Meson project within another, either contained or as a download link, possibly with patches.[19] This lets Meson resolvedependency hell for the convenience of casual users who want to compile the project, but may contribute tosoftware bloat if a common installed dependency could have been used instead. The mode favored byLinux packagers is therefore fallback.[20]

Meson supports Meson and CMake subprojects. A Meson build file may also refer to the WrapDB service.[19]

Cross compilation

[edit]

Cross compilation requires extra configuration, which Meson supports in the form of a separatecross file, which can be external to the Meson project.[21]

Installation directory setup

[edit]

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

Adopters

[edit]
Main page:Category:Software that uses Meson

GNOME has made it a goal to port its projects to Meson.[22] As of late 2017,GNOME Shell itself exclusively requires Meson after abandoningAutotools,[23] and central components likeGTK+, Clutter-GTK,GLib andGStreamer can be built with Meson.[22]

Manyfreedesktop.org projects have switched to Meson.Systemd relies on Meson since dropping Autotools in version 234,[24] and alsoX.Org[25] andMesa[26] were ported to Meson.

Feature comparison

[edit]

Feature comparison withCMake andMake.

FeatureMesonCMakeMake
DatatypesYesNoNo
List datatypeYessemicolon-delimited stringwhitespace-delimited string
Dictionary datatypesince 0.47.0NoNo
File globbingNoYesnon-standard extension on some variants
Extensible via custom functionsNoYesNo
Can read output of arbitrary commands (at configure time)run_commandYesYes
Can run arbitrary commands at build time as recipes of custom targetsYesYesYes
Prohibits stale builds (partial rebuild against input change)Yes (unless there are bugs)[contradictory]If not globbing source files[citation needed]Recursive Make (an idiomatic pattern) is broken in this respect[27]
The target that runs tests depends on the tests being built (e.g.test depends onall)Yes[citation needed]No, andadd_dependencies(test all) is forbidden, because thetest target is reserved.[28]Trivial to add[citation needed]
CcacheAutomaticTrivial to add[citation needed]Trivial to add[citation needed]
DistccTrivial to add[citation needed]Trivial to add[citation needed]Trivial to add[citation needed]
Symbol-table-aware relinkingYes[citation needed]Do it yourself[citation needed]Do it yourself[citation needed]
Precompiled headersOptionalCMake ≥ 3.16[29][2]Do it yourself[citation needed]
Finding installed dependenciespkg-config, CMake packagesCMake module, pkg-config
Downloading dependencies automaticallysubprojectFetchContent[30]
Finding installed dependencies, with download fallbackpkg-config + subprojectCMake module/pkg-config +FetchContent
pkg-config file generatorYesNo
Facilitate use as an auto-downloadable dependencyCan be used as a Meson subprojectNo

See also

[edit]

References

[edit]
  1. ^"Release 1.10.0". 8 December 2025. Retrieved10 December 2025.
  2. ^ab"Making build systems not suck (linux.conf.au video)".YouTube. 16 January 2015.
  3. ^"High productivity build system". 30 January 2025.Meson aims to optimize programmer productivity by providing simple, out-of-the-box support for modern software development tools and practices, such as unit tests, coverage reports, Valgrind, CCache and the like.
  4. ^"mesonbuild/meson: The Meson Build System".GitHub. Retrieved13 April 2016.
  5. ^"Reference manual".
  6. ^"Compiler IDs".
  7. ^"How to build SciPy with Meson".
  8. ^"meson-python package on PyPI".
  9. ^abcd"Meson Frequently Asked Questions".
  10. ^"muon.build". Retrieved27 January 2023.
  11. ^Baker, Dylan (28 May 2021)."dcbaker/meson-plus-plus".GitHub. Retrieved28 May 2021.
  12. ^"Meson Syntax".
  13. ^"CMake FILE command".Note: We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is added or removed, the generated build system cannot know when to ask CMake to regenerate.
  14. ^"Feature Autodetection".
  15. ^"Precompiled headers".
  16. ^"Unity builds".
  17. ^"Unit-tests".
  18. ^"Dependencies with custom lookup functionality — Meson documentation".
  19. ^ab"Wrap dependency system manual".
  20. ^"Meson and 3rd party dependencies. Only one correct way".
  21. ^"Cross compilation".
  22. ^ab"GNOME Goal: Port modules to use Meson build system".
  23. ^"GNOME 3.26 Beta Debuts: More Meson Porting, Wayland Action".
  24. ^"Drop support for autotools".GitHub.
  25. ^"Meson Support Has Landed In The X.Org Server".
  26. ^"Mesa Developers Move Closer To Dropping Autotools Build System In Favor Of Meson".
  27. ^"Non-recursive Make Considered Harmful"(PDF).Microsoft.Recursive Make is considered harmful for very good reasons (Miller 1998); it is not possible to accurately track dependencies when the build system is constructed of separate components that invoke each other.
  28. ^"Make test does not depend on make all".Kitware issue tracker. 23 June 2016. Retrieved3 September 2020.
  29. ^"CMake support for precompiled headers". Retrieved13 March 2018.
  30. ^"FetchContent — CMake 3.15.7 Documentation".

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Meson_(software)&oldid=1313636399"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp