meson
Fast and user-friendly build system
TLDR
SYNOPSIS
meson command [options]
DESCRIPTION
meson is a build system designed to be fast and user-friendly. It reads meson.build project definitions and generates backend build files (ninja by default) for actual compilation.Meson supports C, C++, Rust, Java, Fortran, and other languages. It features automatic dependency detection, cross-compilation support, and built-in unit test and coverage infrastructure. Used by projects like GNOME, systemd, X.Org, and Mesa.
PARAMETERS
COMMAND
Meson subcommand (see list below).init
Create a minimal meson.build for a new project in the current directory.setup DIR
Configure a build directory (the canonical first step).compile -C DIR
Build the project.test -C DIR
Run the project's test suite.install -C DIR
Install the built project into the configured prefix.configure DIR
Change build options on an existing build directory without wiping it.dist
Create a signed source distribution tarball.introspect
Print a JSON-formatted description of targets, tests, options, etc.subprojects, wrap
Manage meson subprojects and .wrap dependency files.devenv
Spawn a shell with the build environment (e.g. PATH, PKG_CONFIG_PATH) pre-set.rewrite
Programmatically modify meson.build files.env2mfile
Generate a cross- or native-file from current environment variables.format
Auto-format meson.build files (alias fmt).-D OPT=VAL
Set a build option (e.g. -Dbuildtype=release, -Dprefix=/usr).--buildtype TYPE
Build type: plain, debug, debugoptimized, release, minsize, custom.--prefix PATH
Installation prefix (default /usr/local).--backend BACKEND
Backend to generate: ninja (default), vs, vs2017, xcode, etc.--default-library TYPE
Default library type: static, shared, or both.--cross-file FILE
Use a cross-compilation definition file.--native-file FILE
Override native compiler/tool selection on the host.--reconfigure
Re-run configuration using the stored options without wiping the build directory.--wipe
Wipe and reconfigure an existing build directory.--werror, --warnlevel N
Treat warnings as errors, or set compiler warning level (0-3/everything).--optimization LEVEL
Optimization level (0, g, 1, 2, 3, s).--vsenv
Activate a Visual Studio environment before building on Windows.--help
Display help information.
CAVEATS
Requires Python 3 and ninja backend by default. Build directories cannot be reused across different source directories. Out-of-source builds only (cannot build in the source tree). The --wipe flag destroys and recreates the build directory.
HISTORY
Meson was created by Jussi Pakkanen in 2013 as a fast, user-friendly build system.
