| 1 |
--- |
| 2 |
title: Release 1.2.0 |
| 3 |
short-description: Release notes for 1.2.0 |
| 4 |
... |
| 5 |
|
| 6 |
# New features |
| 7 |
|
| 8 |
Meson 1.2.0 was released on 17 July 2023 |
| 9 |
## Added Metrowerks C/C++ toolchains |
| 10 |
|
| 11 |
Added support for the Metrowerks Embedded ARM and Metrowerks Embedded PowerPC toolchains (https://www.nxp.com/docs/en/reference-manual/CWMCUKINCMPREF.pdf). |
| 12 |
|
| 13 |
The implementation is somewhat experimental. It has been tested on a few projects and works fairly well, but may have issues. |
| 14 |
|
| 15 |
## Added str.splitlines method |
| 16 |
|
| 17 |
[[str.splitlines]] can now be used to split a string into an array of lines. |
| 18 |
|
| 19 |
## `generator.process(generator.process(...))` |
| 20 |
|
| 21 |
Added support for code like this: |
| 22 |
```meson |
| 23 |
gen1 = generator(...) |
| 24 |
gen2 = generator(...) |
| 25 |
gen2.process(gen1.process('input.txt')) |
| 26 |
``` |
| 27 |
|
| 28 |
## Extra files keyword in `declare_dependency` |
| 29 |
|
| 30 |
`declare_dependency` have a new `extra_files` keyword, |
| 31 |
to add extra files to a target. It is used mostly for IDE integration. |
| 32 |
|
| 33 |
## Added a new '--genvslite' option for use with 'meson setup ...' |
| 34 |
|
| 35 |
To facilitate a more usual visual studio work-flow of supporting and switching between |
| 36 |
multiple build configurations (buildtypes) within the same solution, among other |
| 37 |
[reasons](https://github.com/mesonbuild/meson/pull/11049), use of this new option |
| 38 |
has the effect of setting up multiple ninja back-end-configured build directories, |
| 39 |
named with their respective buildtype suffix. E.g. 'somebuilddir_debug', |
| 40 |
'somebuilddir_release', etc. as well as a '_vs'-suffixed directory that contains the |
| 41 |
generated multi-buildtype solution. Building/cleaning/rebuilding in the solution |
| 42 |
now launches the meson build (compile) of the corresponding buildtype-suffixed build |
| 43 |
directory, instead of using Visual Studio's native engine. |
| 44 |
|
| 45 |
## `gnome.generate_gir()` now supports `env` kwarg |
| 46 |
|
| 47 |
`gnome.generate_gir()` now accepts the `env` kwarg which lets you set environment variables. |
| 48 |
|
| 49 |
## More data in introspection files |
| 50 |
|
| 51 |
- Used compilers are listed in `intro-compilers.json` |
| 52 |
- Information about `host`, `build` and `target` machines |
| 53 |
are lister in `intro-machines.json` |
| 54 |
- `intro-dependencies.json` now includes internal dependencies, |
| 55 |
and relations between dependencies. |
| 56 |
- `intro-targets.json` now includes dependencies, `vs_module_defs`, |
| 57 |
`win_subsystem`, and linker parameters. |
| 58 |
|
| 59 |
## Machine objects get `kernel` and `subsystem` properties |
| 60 |
|
| 61 |
Meson has traditionally provided a `system` property to detect the |
| 62 |
system being run on. However this is not enough to reliably |
| 63 |
differentiate between e.g. an iOS platform from a watchOS one. Two new |
| 64 |
properties, namely `kernel` and `subsystem` have been added so these |
| 65 |
setups can be reliably detected. |
| 66 |
|
| 67 |
These new properties are not necessary in cross files for now, but if |
| 68 |
they are not defined and a build file tries to access them, Meson will |
| 69 |
exit with a hard error. It is expected that at some point in the |
| 70 |
future defining the new properties will become mandatory. |
| 71 |
|
| 72 |
## default_options and override_options may now be dictionaries |
| 73 |
|
| 74 |
Instead of passing them as `default_options : ['key=value']`, they can now be |
| 75 |
passed as `default_options : {'key': 'value'}`, and the same for |
| 76 |
`override_options`. |
| 77 |
|
| 78 |
## New override of `find_program('meson')` |
| 79 |
|
| 80 |
In some cases, it has been useful for build scripts to access the Meson command |
| 81 |
used to invoke the build script. This has led to various ad-hoc solutions that |
| 82 |
can be very brittle and project-specific. |
| 83 |
|
| 84 |
```meson |
| 85 |
meson_prog = find_program('meson') |
| 86 |
``` |
| 87 |
|
| 88 |
This call will supply the build script with an external program pointing at the |
| 89 |
invoked Meson. |
| 90 |
|
| 91 |
Because Meson also uses `find_program` for program lookups internally, this |
| 92 |
override will also be handled in cases similar to the following: |
| 93 |
|
| 94 |
```meson |
| 95 |
custom_target( |
| 96 |
# ... |
| 97 |
command: [ |
| 98 |
'meson', |
| 99 |
], |
| 100 |
# ... |
| 101 |
) |
| 102 |
|
| 103 |
run_command( |
| 104 |
'meson', |
| 105 |
# ... |
| 106 |
) |
| 107 |
|
| 108 |
run_target( |
| 109 |
'tgt', |
| 110 |
command: [ |
| 111 |
'meson', |
| 112 |
# ... |
| 113 |
] |
| 114 |
) |
| 115 |
``` |
| 116 |
|
| 117 |
## Find more specific python version on Windows |
| 118 |
|
| 119 |
You can now use `python3.x`, where `x` is the minor version, |
| 120 |
to find a more specific version of python on Windows, when |
| 121 |
using the python module. On other platforms, it was already |
| 122 |
working as `python3.x` is the executable name. |
| 123 |
|
| 124 |
## Python module can now compile bytecode |
| 125 |
|
| 126 |
A new builtin option is available: `-Dpython.bytecompile=2`. It can be used to |
| 127 |
compile bytecode for all pure python files installed via the python module. |
| 128 |
|
| 129 |
## rust.bindgen allows passing extra arguments to rustc |
| 130 |
|
| 131 |
This may be necessary to pass extra `cfg`s or to change warning levels. |
| 132 |
|
| 133 |
## Support for defining crate names of Rust dependencies in Rust targets |
| 134 |
|
| 135 |
Rust supports defining a different crate name for a dependency than what the |
| 136 |
actual crate name during compilation of that dependency was. |
| 137 |
|
| 138 |
This allows using multiple versions of the same crate at once, or simply using |
| 139 |
a shorter name of the crate for convenience. |
| 140 |
|
| 141 |
```meson |
| 142 |
a_dep = dependency('some-very-long-name') |
| 143 |
|
| 144 |
my_executable = executable('my-executable', 'src/main.rs', |
| 145 |
rust_dependency_map : { |
| 146 |
'some_very_long_name' : 'a', |
| 147 |
}, |
| 148 |
dependencies : [a_dep], |
| 149 |
) |
| 150 |
``` |
| 151 |
|
| 152 |
## A machine file may be used to pass extra arguments to clang in a bindgen call |
| 153 |
|
| 154 |
Because of the way that bindgen proxies arguments to clang the only choice to |
| 155 |
add extra arguments currently is to wrap bindgen in a script, since the |
| 156 |
arguments must come after a `--`. This is inelegant, and not very portable. Now |
| 157 |
a `bindgen_clang_arguments` field may be placed in the machine file for the host |
| 158 |
machine, and these arguments will be added to every bindgen call for clang. This |
| 159 |
is intended to be useful for things like injecting `--target` arguments. |
| 160 |
|
| 161 |
## Add a `link_with` keyword to `rust.test()` |
| 162 |
|
| 163 |
This can already be be worked around by creating `declare_dependency()` objects |
| 164 |
to pass to the `dependencies` keyword, but this cuts out the middle man. |
| 165 |
|
| 166 |
## Rust now supports the b_ndebug option |
| 167 |
|
| 168 |
Which controls the `debug_assertions` cfg, which in turn controls |
| 169 |
`debug_assert!()` macro. This macro is roughly equivalent to C's `assert()`, as |
| 170 |
it can be toggled with command line options, unlike Rust's `assert!()`, which |
| 171 |
cannot be turned off, and is not designed to be. |
| 172 |
|
| 173 |
## Wildcards in list of tests to run |
| 174 |
|
| 175 |
The `meson test` command now accepts wildcards in the list of test names. |
| 176 |
For example `meson test basic*` will run all tests whose name begins |
| 177 |
with "basic". |
| 178 |
|
| 179 |
meson will report an error if the given test name does not match any |
| 180 |
existing test. meson will log a warning if two redundant test names |
| 181 |
are given (for example if you give both "proj:basic" and "proj:"). |
| 182 |
|
| 183 |
## New for the generation of Visual Studio vcxproj projects |
| 184 |
|
| 185 |
When vcxproj is generated, another file vcxproj.filters is generated in parallel. |
| 186 |
It enables to set a hierarchy of the files inside the solution following their place on filesystem. |
| 187 |
|