1MESON(1) User Commands MESON(1)
2
3
4
6 meson - a high productivity build system
7
9 Meson is a build system designed to optimize programmer productivity.
10 It aims to do this by providing simple, out-of-the-box support for mod‐
11 ern software development tools and practices, such as unit tests, cov‐
12 erage reports, Valgrind, Ccache and the like.
13
14 The main Meson executable provides many subcommands to access all the
15 functionality.
16
17
19 Using Meson is simple and follows the common two-phase process of most
20 build systems. First you run Meson to configure your build:
21
22 meson setup [ options ] [ build directory ] [ source directory ]
23
24 Note that the build directory must be different from the source direc‐
25 tory. Meson does not support building inside the source directory and
26 attempting to do that leads to an error.
27
28 After a successful configuration step you can build the source by run‐
29 ning the actual build command in the build directory. The default back‐
30 end of Meson is Ninja, which can be invoked like this.
31
32 ninja [ target ]
33
34 You only need to run the Meson command once: when you first configure
35 your build dir. After that you just run the build command. Meson will
36 autodetect changes in your source tree and regenerate all files needed
37 to build the project.
38
39 The setup command is the default operation. If no actual command is
40 specified, Meson will assume you meant to do a setup. That means that
41 you can set up a build directory without the setup command like this:
42
43 meson [ options ] [ build directory ] [ source directory ]
44
45
46 options:
47 --version
48 print version number
49
50 --help print command line help
51
52
54 meson configure provides a way to configure a Meson project from the
55 command line. Its usage is simple:
56
57 meson configure [ build directory ] [ options to set ]
58
59 If build directory is omitted, the current directory is used instead.
60
61 If no parameters are set, meson configure will print the value of all
62 build options to the console.
63
64 To set values, use the -D command line argument like this.
65
66 meson configure -Dopt1=value1 -Dopt2=value2
67
68
70 Meson introspect is a command designed to make it simple to integrate
71 with other tools, such as IDEs. The output of this command is in JSON.
72
73 meson introspect [ build directory ] [ option ]
74
75 If build directory is omitted, the current directory is used instead.
76
77
78 options:
79 --targets
80 print all top level targets (executables, libraries, etc)
81
82 --target-files
83 print the source files of the given target
84
85 --buildsystem-files
86 print all files that make up the build system (meson.build, me‐
87 son_options.txt etc)
88
89 --tests
90 print all unit tests
91
92 --help print command line help
93
94
96 meson test is a helper tool for running test suites of projects using
97 Meson. The default way of running tests is to invoke the default build
98 command:
99
100 ninja [ test ]
101
102 meson test provides a richer set of tools for invoking tests.
103
104 meson test automatically rebuilds the necessary targets to run tests
105 when used with the Ninja backend. Upon build failure, meson test will
106 return an exit code of 125. This return code tells git bisect run to
107 skip the current commit. Thus bisecting using git can be done conve‐
108 niently like this.
109
110 git bisect run meson test -C build_dir
111
112
113 options:
114 --repeat
115 run tests as many times as specified
116
117 --gdb run tests under gdb
118
119 --list list all available tests
120
121 --wrapper
122 invoke all tests via the given wrapper (e.g. valgrind)
123
124 -C Change into the given directory before running tests (must be
125 root of build directory).
126
127 --suite
128 run tests in this suite
129
130 --no-suite
131 do not run tests in this suite
132
133 --no-stdsplit
134 do not split stderr and stdout in test logs
135
136 --benchmark
137 run benchmarks instead of tests
138
139 --logbase
140 base of file name to use for writing test logs
141
142 --num-processes
143 how many parallel processes to use to run tests
144
145 --verbose
146 do not redirect stdout and stderr
147
148 -t a multiplier to use for test timeout values (usually something
149 like 100 for Valgrind)
150
151 --setup
152 use the specified test setup
153
154
156 Wraptool is a helper utility to manage source dependencies using the
157 online wrapdb service.
158
159 meson wrap < command > [ options ]
160
161 You should run this command in the top level source directory of your
162 project.
163
164
165 Commands:
166 list list all available projects
167
168 search search projects by name
169
170 install
171 install a project with the given name
172
173 update update the specified project to latest available version
174
175 info show available versions of the specified project
176
177 status show installed and available versions of currently used subpro‐
178 jects
179
180
182 0 Successful.
183
184 1 Usage error, or an error parsing or executing meson.build.
185
186 2 Internal error.
187
188 125 meson test could not rebuild the required targets.
189
190
191
192 SEE ALSO
193
194 http://mesonbuild.com/
195
196 https://wrapdb.mesonbuild.com/
197
198
199
200meson 0.56.2 January 2021 MESON(1)