| 1 |
--- |
| 2 |
title: Release 0.50.0 |
| 3 |
short-description: Release notes for 0.50.0 |
| 4 |
... |
| 5 |
|
| 6 |
# New features |
| 7 |
|
| 8 |
## Added `cmake_module_path` and `cmake_args` to dependency |
| 9 |
|
| 10 |
The CMake dependency backend can now make use of existing |
| 11 |
`Find<name>.cmake` files by setting the `CMAKE_MODULE_PATH` with the |
| 12 |
new `dependency()` property `cmake_module_path`. The paths given to |
| 13 |
`cmake_module_path` should be relative to the project source |
| 14 |
directory. |
| 15 |
|
| 16 |
Furthermore the property `cmake_args` was added to give CMake |
| 17 |
additional parameters. |
| 18 |
|
| 19 |
## Added PGI compiler support |
| 20 |
|
| 21 |
Nvidia / PGI C, C++ and Fortran |
| 22 |
[no-cost](https://www.pgroup.com/products/community.htm) compilers are |
| 23 |
now supported. They have been tested on Linux so far. |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
## Fortran Coarray |
| 28 |
|
| 29 |
Fortran 2008 / 2018 coarray support was added via `dependency('coarray')` |
| 30 |
|
| 31 |
## Libdir defaults to `lib` when cross compiling |
| 32 |
|
| 33 |
Previously `libdir` defaulted to the value of the build machine such |
| 34 |
as `lib/x86_64-linux-gnu`, which is almost always incorrect when cross |
| 35 |
compiling. It now defaults to plain `lib` when cross compiling. Native |
| 36 |
builds remain unchanged and will point to the current system's library |
| 37 |
dir. |
| 38 |
|
| 39 |
## Native and Cross File Paths and Directories |
| 40 |
|
| 41 |
A new `[paths]` section has been added to native and cross files. This |
| 42 |
can be used to set paths such a prefix and libdir in a persistent way. |
| 43 |
|
| 44 |
## Add warning_level 0 option |
| 45 |
|
| 46 |
Adds support for a warning level 0 which does not enable any static |
| 47 |
analysis checks from the compiler |
| 48 |
|
| 49 |
## A builtin target to run clang-format |
| 50 |
|
| 51 |
If you have `clang-format` installed and there is a `.clang-format` |
| 52 |
file in the root of your master project, Meson will generate a run |
| 53 |
target called `clang-format` so you can reformat all files with one |
| 54 |
command: |
| 55 |
|
| 56 |
```meson |
| 57 |
ninja clang-format |
| 58 |
``` |
| 59 |
|
| 60 |
|
| 61 |
## Added `.path()` method to object returned by `python.find_installation()` |
| 62 |
|
| 63 |
`ExternalProgram` objects as well as the object returned by the |
| 64 |
`python3` module provide this method, but the new `python` module did |
| 65 |
not. |
| 66 |
|
| 67 |
## Fix ninja console log from generators with multiple output nodes |
| 68 |
|
| 69 |
This resolves [issue |
| 70 |
#4760](https://github.com/mesonbuild/meson/issues/4760) where a |
| 71 |
generator with multiple output nodes printed an empty string to the |
| 72 |
console |
| 73 |
|
| 74 |
## `introspect --buildoptions` can now be used without configured build directory |
| 75 |
|
| 76 |
It is now possible to run `meson introspect --buildoptions /path/to/meson.build` |
| 77 |
without a configured build directory. |
| 78 |
|
| 79 |
Running `--buildoptions` without a build directory produces the same |
| 80 |
output as running it with a freshly configured build directory. |
| 81 |
|
| 82 |
However, this behavior is not guaranteed if subprojects are |
| 83 |
present. Due to internal limitations all subprojects are processed |
| 84 |
even if they are never used in a real Meson run. Because of this |
| 85 |
options for the subprojects can differ. |
| 86 |
|
| 87 |
## `include_directories` accepts a string |
| 88 |
|
| 89 |
The `include_directories` keyword argument now accepts plain strings |
| 90 |
rather than an include directory object. Meson will transparently |
| 91 |
expand it so that a declaration like this: |
| 92 |
|
| 93 |
```meson |
| 94 |
executable(..., include_directories: 'foo') |
| 95 |
``` |
| 96 |
|
| 97 |
Is equivalent to this: |
| 98 |
|
| 99 |
```meson |
| 100 |
foo_inc = include_directories('foo') |
| 101 |
executable(..., include_directories: foo_inc) |
| 102 |
``` |
| 103 |
|
| 104 |
## Fortran submodule support |
| 105 |
|
| 106 |
Initial support for Fortran `submodule` was added, where the submodule |
| 107 |
is in the same or different file than the parent `module`. The |
| 108 |
submodule hierarchy specified in the source Fortran code `submodule` |
| 109 |
statements are used by Meson to resolve source file dependencies. For |
| 110 |
example: |
| 111 |
|
| 112 |
```fortran |
| 113 |
submodule (ancestor:parent) child |
| 114 |
``` |
| 115 |
|
| 116 |
|
| 117 |
## Add `subproject_dir` to `--projectinfo` introspection output |
| 118 |
|
| 119 |
This allows applications interfacing with Meson (such as IDEs) to know |
| 120 |
about an overridden subproject directory. |
| 121 |
|
| 122 |
## Find library with its headers |
| 123 |
|
| 124 |
The `find_library()` method can now also verify if the library's |
| 125 |
headers are found in a single call, using the `has_header()` method |
| 126 |
internally. |
| 127 |
|
| 128 |
```meson |
| 129 |
# Aborts if the 'z' library is found but not its header file |
| 130 |
zlib = find_library('z', has_headers : 'zlib.h') |
| 131 |
# Returns not-found if the 'z' library is found but not its header file |
| 132 |
zlib = find_library('z', has_headers : 'zlib.h', required : false) |
| 133 |
``` |
| 134 |
|
| 135 |
Any keyword argument with the `header_` prefix passed to |
| 136 |
`find_library()` will be passed to the `has_header()` method with the |
| 137 |
prefix removed. |
| 138 |
|
| 139 |
```meson |
| 140 |
libfoo = find_library('foo', |
| 141 |
has_headers : ['foo.h', 'bar.h'], |
| 142 |
header_prefix : '#include <baz.h>', |
| 143 |
header_include_directories : include_directories('.')) |
| 144 |
``` |
| 145 |
|
| 146 |
## NetCDF |
| 147 |
|
| 148 |
NetCDF support for C, C++ and Fortran is added via pkg-config. |
| 149 |
|
| 150 |
## Added the Flang compiler |
| 151 |
|
| 152 |
[Flang](https://github.com/flang-compiler/flang/releases) Fortran |
| 153 |
compiler support was added. As with other Fortran compilers, flang is |
| 154 |
specified using `FC=flang meson ..` or similar. |
| 155 |
|
| 156 |
## New `not_found_message` for `dependency()` |
| 157 |
|
| 158 |
You can now specify a `not_found_message` that will be printed if the |
| 159 |
specified dependency was not found. The point is to convert constructs |
| 160 |
that look like this: |
| 161 |
|
| 162 |
```meson |
| 163 |
d = dependency('something', required: false) |
| 164 |
if not d.found() |
| 165 |
message('Will not be able to do something.') |
| 166 |
endif |
| 167 |
``` |
| 168 |
|
| 169 |
Into this: |
| 170 |
|
| 171 |
```meson |
| 172 |
d = dependency('something', |
| 173 |
required: false, |
| 174 |
not_found_message: 'Will not be able to do something.') |
| 175 |
``` |
| 176 |
|
| 177 |
Or constructs like this: |
| 178 |
|
| 179 |
```meson |
| 180 |
d = dependency('something', required: false) |
| 181 |
if not d.found() |
| 182 |
error('Install something by doing XYZ.') |
| 183 |
endif |
| 184 |
``` |
| 185 |
|
| 186 |
into this: |
| 187 |
|
| 188 |
```meson |
| 189 |
d = dependency('something', |
| 190 |
not_found_message: 'Install something by doing XYZ.') |
| 191 |
``` |
| 192 |
|
| 193 |
Which works, because the default value of `required` is `true`. |
| 194 |
|
| 195 |
## Cuda support |
| 196 |
|
| 197 |
Compiling Cuda source code is now supported, though only with the |
| 198 |
Ninja backend. This has been tested only on Linux for now. |
| 199 |
|
| 200 |
Because NVidia's Cuda compiler does not produce `.d` dependency files, |
| 201 |
dependency tracking does not work. |
| 202 |
|
| 203 |
## `run_command()` accepts `env` kwarg |
| 204 |
|
| 205 |
You can pass [[@env]] |
| 206 |
object to [[run_command]], just |
| 207 |
like to `test`: |
| 208 |
|
| 209 |
```meson |
| 210 |
env = environment() |
| 211 |
env.set('FOO', 'bar') |
| 212 |
run_command('command', 'arg1', 'arg2', env: env) |
| 213 |
``` |
| 214 |
|
| 215 |
## `extract_objects:` accepts `File` arguments |
| 216 |
|
| 217 |
The `extract_objects` function now supports File objects to tell it |
| 218 |
what to extract. Previously, file paths could only be passed as strings. |
| 219 |
|
| 220 |
## Changed the JSON format of the introspection |
| 221 |
|
| 222 |
All paths used in the Meson introspection JSON format are now |
| 223 |
absolute. This affects the `filename` key in the targets introspection |
| 224 |
and the output of `--buildsystem-files`. |
| 225 |
|
| 226 |
Furthermore, the `filename` and `install_filename` keys in the targets |
| 227 |
introspection are now lists of strings with identical length. |
| 228 |
|
| 229 |
The `--target-files` option is now deprecated, since the same information |
| 230 |
can be acquired from the `--targets` introspection API. |
| 231 |
|
| 232 |
## Meson file rewriter |
| 233 |
|
| 234 |
This release adds the functionality to perform some basic modification |
| 235 |
on the `meson.build` files from the command line. The currently |
| 236 |
supported operations are: |
| 237 |
|
| 238 |
- For build targets: |
| 239 |
- Add/Remove source files |
| 240 |
- Add/Remove targets |
| 241 |
- Modify a select set of kwargs |
| 242 |
- Print some JSON information |
| 243 |
- For dependencies: |
| 244 |
- Modify a select set of kwargs |
| 245 |
- For the project function: |
| 246 |
- Modify a select set of kwargs |
| 247 |
- Modify the default options list |
| 248 |
|
| 249 |
For more information see the rewriter documentation. |
| 250 |
|
| 251 |
## `introspect --scan-dependencies` can now be used to scan for dependencies used in a project |
| 252 |
|
| 253 |
It is now possible to run `meson introspect --scan-dependencies |
| 254 |
/path/to/meson.build` without a configured build directory to scan for |
| 255 |
dependencies. |
| 256 |
|
| 257 |
The output format is as follows: |
| 258 |
|
| 259 |
```json |
| 260 |
[ |
| 261 |
{ |
| 262 |
"name": "The name of the dependency", |
| 263 |
"required": true, |
| 264 |
"conditional": false, |
| 265 |
"has_fallback": false |
| 266 |
} |
| 267 |
] |
| 268 |
``` |
| 269 |
|
| 270 |
The `required` keyword specifies whether the dependency is marked as |
| 271 |
required in the `meson.build` (all dependencies are required by |
| 272 |
default). The `conditional` key indicates whether the `dependency()` |
| 273 |
function was called inside a conditional block. In a real Meson run |
| 274 |
these dependencies might not be used, thus they _may_ not be required, |
| 275 |
even if the `required` key is set. The `has_fallback` key just |
| 276 |
indicates whether a fallback was directly set in the `dependency()` |
| 277 |
function. |
| 278 |
|
| 279 |
## `introspect --targets` can now be used without configured build directory |
| 280 |
|
| 281 |
It is now possible to run `meson introspect --targets |
| 282 |
/path/to/meson.build` without a configured build directory. |
| 283 |
|
| 284 |
The generated output is similar to running the introspection with a |
| 285 |
build directory. However, there are some key differences: |
| 286 |
|
| 287 |
- The paths in `filename` now are _relative_ to the future build directory |
| 288 |
- The `install_filename` key is completely missing |
| 289 |
- There is only one entry in `target_sources`: |
| 290 |
- With the language set to `unknown` |
| 291 |
- Empty lists for `compiler` and `parameters` and `generated_sources` |
| 292 |
- The `sources` list _should_ contain all sources of the target |
| 293 |
|
| 294 |
There is no guarantee that the sources list in `target_sources` is |
| 295 |
correct. There might be differences, due to internal limitations. It |
| 296 |
is also not guaranteed that all targets will be listed in the output. |
| 297 |
It might even be possible that targets are listed, which won't exist |
| 298 |
when Meson is run normally. This can happen if a target is defined |
| 299 |
inside an if statement. Use this feature with care. |
| 300 |
|
| 301 |
## Added option to introspect multiple parameters at once |
| 302 |
|
| 303 |
Meson introspect can now print the results of multiple introspection |
| 304 |
commands in a single call. The results are then printed as a single |
| 305 |
JSON object. |
| 306 |
|
| 307 |
The format for a single command was not changed to keep backward |
| 308 |
compatibility. |
| 309 |
|
| 310 |
Furthermore the option `-a,--all`, `-i,--indent` and |
| 311 |
`-f,--force-object-output` were added to print all introspection |
| 312 |
information in one go, format the JSON output (the default is still |
| 313 |
compact JSON) and force use the new output format, even if only one |
| 314 |
introspection command was given. |
| 315 |
|
| 316 |
A complete introspection dump is also stored in the `meson-info` |
| 317 |
directory. This dump will be (re)generated each time meson updates the |
| 318 |
configuration of the build directory. |
| 319 |
|
| 320 |
Additionally the format of `meson introspect target` was changed: |
| 321 |
|
| 322 |
- New: the `sources` key. It stores the source files of a target and their compiler parameters. |
| 323 |
- New: the `defined_in` key. It stores the Meson file where a target is defined |
| 324 |
- New: the `subproject` key. It stores the name of the subproject where a target is defined. |
| 325 |
- Added new target types (`jar`, `shared module`). |
| 326 |
|
| 327 |
## `meson configure` can now print the default options of an unconfigured project |
| 328 |
|
| 329 |
With this release, it is also possible to get a list of all build |
| 330 |
options by invoking `meson configure` with the project source |
| 331 |
directory or the path to the root `meson.build`. In this case, Meson |
| 332 |
will print the default values of all options. |
| 333 |
|
| 334 |
## HDF5 |
| 335 |
|
| 336 |
HDF5 support is added via pkg-config. |
| 337 |
|
| 338 |
## Added the `meson-info.json` introspection file |
| 339 |
|
| 340 |
Meson now generates a `meson-info.json` file in the `meson-info` |
| 341 |
directory to provide introspection information about the latest Meson |
| 342 |
run. This file is updated when the build configuration is changed and |
| 343 |
the build files are (re)generated. |
| 344 |
|
| 345 |
## New kwarg `install:` for `configure_file()` |
| 346 |
|
| 347 |
Previously when using `configure_file()`, you could install the |
| 348 |
outputted file by setting the `install_dir:` keyword argument. Now, |
| 349 |
there is an explicit kwarg `install:` to enable/disable it. Omitting |
| 350 |
it will maintain the old behaviour. |