New features (in development)
Added a values() method for dictionaries
Mesons built-in dict type now supports the dict.values() method
to retrieve the dictionary values as an array, analogous to the
dict.keys() method.
dict = { 'b': 'world', 'a': 'hello' }
dict.keys() # Returns ['a', 'b']
dict.values() # Returns ['hello', 'world']
Android cross file generator
The env2mfile command now supports a --android argument. When
specified, it tells the cross file generator to create cross files for
all Android toolchains located on the current machines.
This typically creates many files, so the -o argument specifies the
output directory. A typical use case goes like this:
meson env2mfile --android -o androidcross
meson setup --cross-file \
androidcross/android-29.0.14033849-android35-aarch64-cross.txt \
builddir
-Db_msvcrt on clang
-Db_msvcrt will now link the appropriate runtime library, and set
the appropriate preprocessor symbols, also when the compiler is clang.
This is only supported when using link.exe or lld-link.exe as the
linker.
Support for Cargo workspaces
When parsing Cargo.toml files, Meson now recognizes workspaces
and will process all the required members and any requested optional
members of the workspace.
For the time being it is recommended to regroup all Cargo dependencies inside a single workspace invoked from the main Meson project. When invoking multiple different Cargo subprojects from Meson, feature resolution of common dependencies might be wrong.
Experimental Codegen module
A new module wrapping some common code generators has been added. Currently it supports lex/flex and yacc/bison.
Methods from compiler object now accept strings for include_directories
The various compiler methods with a include_directories keyword argument
now accept stings or array of strings, in addition to inc objects
generated from include_directories() function, as it was already the case for
build_target() family of functions.
meson format has a new --check-diff option
When using meson format --check-only to verify formatting in CI, it would
previously silently exit with an error code if the code was not formatted
correctly.
A new --check-diff option has been added which will instead print a diff of
the required changes and then exit with an error code.
Common Cargo.lock for all Cargo subprojects
Whenever Meson finds a Cargo.lock file in the toplevel directory
of the project, it will use it to resolve the versions of Cargo
subprojects in preference to per-subproject Cargo.lock files.
Per-subproject lock files are only used if the invoking project
did not have a Cargo.lock file itself.
If you wish to experiment with Cargo subprojects, it is recommended
to use cargo to set up Cargo.lock and Cargo.toml files,
encompassing all Rust targets, in the toplevel source directory.
Cargo subprojects remain unstable and subject to change.
Added new namingscheme option
Traditionally Meson has named output targets so that they don't clash
with each other. This has meant, among other things, that on Windows
Meson uses a nonstandard .a suffix for static libraries because both
static libraries and import libraries have the suffix .lib.
There is now an option namingscheme that can be set to
platform. This new platform native naming scheme that replicates
what Rust does. That is, shared libraries on Windows get a suffix
.dll, static libraries get .lib and import libraries have the name
.dll.lib.
We expect to change the default value of this option to platform in
a future major version. Until that happens we reserve the right to
alter how platform actually names its output files.
Vala BuildTarget dependency enhancements
A BuildTarget that has Vala sources can now get a File dependency for its generated header, vapi, and gir files.
lib = library('foo', 'foo.vala')
lib_h = lib.vala_header()
lib_s = static_lib('static', 'static.c', lib_h)
lib_vapi = lib.vala_vapi()
custom_target(
'foo-typelib',
command : ['g-ir-compiler', '--output', '@OUTPUT@', '@INPUT@'],
input : lib.vala_gir(),
output : 'Foo-1.0.typelib'
)
static.c will not start compilation until lib.h is generated.
windows.compile_resources now detects header changes with rc.exe
The rc.exe resource compiler neither provides depfile support nor
allows showing includes, as is possible with C or C++ compilers.
Therefore, changes to files included by the .rc file did not trigger
recompilation of the resource file.
A workaround was added to meson by calling the preprocessor on the
.rc file to detect the included headers and adding the result as a
dependency to the resource compilation.
i18n.xgettext now accepts CustomTarget and CustomTargetIndex as sources
Previously, custom_tgt were accepted but silently ignored, and
custom_idx were not accepted.
Now, they both can be used, and the generated outputs will be scanned to extract translation strings.
The results of the search are