Debian Codegraph @

subprojects/meson-docs/docs/markdown/Overview.md

raw
1 ---
2 short-description: Overview of the Meson build system
3 ...
4
5 # Overview
6
7 Meson is a build system that is designed to be as user-friendly as
8 possible without sacrificing performance. The main tool for this is a
9 custom language that the user uses to describe the structure of his
10 build. The main design goals of this language has been simplicity,
11 clarity and conciseness. Much inspiration was drawn from the Python
12 programming language, which is considered very readable, even to
13 people who have not programmed in Python before.
14
15 Another main idea has been to provide first class support for modern
16 programming tools and best practices. These include features as varied
17 as unit testing, code coverage reporting, precompiled headers and the
18 like. All of these features should be immediately available to any
19 project using Meson. The user should not need to hunt for third party
20 macros or write shell scripts to get these features. They should just
21 work out of the box.
22
23 This power should not come at the expense of limited usability. Many
24 software builds require unorthodox steps. A common example is that you
25 first need to build a custom tool and then use that tool to generate
26 more source code to build. This functionality needs to be supported
27 and be as easy to use as other parts of the system.
28
29 Terminology
30 --
31
32 Meson follows the overall structure of other popular build systems,
33 such as CMake and GNU Autotools. This means that the build is divided
34 into two discrete steps: *configure step* and *build step*. The first
35 step inspects the system, checks for dependencies and does all other
36 steps necessary to configure the build. It then generates the actual
37 build system. The second step is simply executing this generated build
38 system. The end result is a bunch of *build targets*, which are
39 usually executables and shared and static libraries.
40
41 The directory that contains the source code is called the *source
42 directory*. Correspondingly the directory where the output is written
43 is called the *build directory*. In other build systems it is common
44 to have these two be the same directory. This is called an *in-source
45 build*. The case where the build directory is separate is called an
46 *out-of-source build*.
47
48 What sets Meson apart from most build systems is that it enforces a
49 separate build directory. All files created by the build system are
50 put in the build directory. It is actually impossible to do an
51 in-source build. For people used to building inside their source tree,
52 this may seem like a needless complication. However there are several
53 benefits to doing only out-of-source builds. These will be explained
54 in the next chapter.
55
56 When the source code is built, a set of *unit tests* is usually
57 run. They ensure that the program is working as it should. If it does,
58 the build result can be *installed* after which it is ready for use.