Meson Build System

1.10.2 · active · verified Sun Apr 05

Meson is a high-performance, cross-platform build system designed to be both extremely fast and user-friendly. It supports numerous programming languages (C, C++, Rust, Fortran, Java, Python, etc.) and compilers, using a simple, non-Turing complete domain-specific language (DSL) for defining builds. The project aims for a major release approximately every 3-4 months, with bugfix releases in between.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple C 'Hello World' project with Meson. It involves defining the project and an executable in `meson.build`, configuring the build directory, compiling the project, running the executable, and finally installing it. Meson enforces out-of-source builds, meaning all build artifacts are placed in a separate build directory (e.g., `builddir`).

mkdir myproject
cd myproject
echo '#include <stdio.h>\nint main() { printf("Hello from Meson!\n"); return 0; }' > main.c
echo "project('hello_meson', 'c')\nexecutable('hello', 'main.c', install: true)" > meson.build

meson setup builddir
meson compile -C builddir
./builddir/hello
meson install -C builddir

view raw JSON →