| 1 |
--- |
| 2 |
title: Release 0.54.0 |
| 3 |
short-description: Release notes for 0.54.0 |
| 4 |
... |
| 5 |
|
| 6 |
# New features |
| 7 |
|
| 8 |
## Emscripten (emcc) now supports threads |
| 9 |
|
| 10 |
In addition to properly setting the compile and linker arguments, a |
| 11 |
new Meson builtin has been added to control the PTHREAD_POOL_SIZE |
| 12 |
option, `-D<lang>_thread_count`, which may be set to any integer value |
| 13 |
greater than 0. If it set to 0 then the PTHREAD_POOL_SIZE option will |
| 14 |
not be passed. |
| 15 |
|
| 16 |
## Introduce dataonly for the pkgconfig module |
| 17 |
|
| 18 |
This allows users to disable writing out the inbuilt variables to the |
| 19 |
pkg-config file as they might actually not be required. |
| 20 |
|
| 21 |
One reason to have this is for architecture-independent pkg-config |
| 22 |
files in projects which also have architecture-dependent outputs. |
| 23 |
|
| 24 |
``` |
| 25 |
pkgg.generate( |
| 26 |
name : 'libhello_nolib', |
| 27 |
description : 'A minimalistic pkgconfig file.', |
| 28 |
version : libver, |
| 29 |
dataonly: true |
| 30 |
) |
| 31 |
``` |
| 32 |
|
| 33 |
## Consistently report file locations relative to cwd |
| 34 |
|
| 35 |
The paths for filenames in error and warning locations are now |
| 36 |
consistently reported relative to the current working directory (when |
| 37 |
possible), or as absolute paths (when a relative path does not exist, |
| 38 |
e.g. a Windows path starting with a different drive letter to the |
| 39 |
current working directory). |
| 40 |
|
| 41 |
(The previous behaviour was to report a path relative to the source |
| 42 |
root for all warnings and most errors, and relative to cwd for certain |
| 43 |
parser errors) |
| 44 |
|
| 45 |
## `dependency()` consistency |
| 46 |
|
| 47 |
The first time a dependency is found, using `dependency('foo', ...)`, |
| 48 |
the return value is now cached. Any subsequent call will return the |
| 49 |
same value as long as version requested match, otherwise not-found |
| 50 |
dependency is returned. This means that if a system dependency is |
| 51 |
first found, it won't fallback to a subproject in a subsequent call |
| 52 |
any more and will rather return not-found instead if the system |
| 53 |
version does not match. Similarly, if the first call returns the |
| 54 |
subproject fallback dependency, it will also return the subproject |
| 55 |
dependency in a subsequent call even if no fallback is provided. |
| 56 |
|
| 57 |
For example, if the system has `foo` version 1.0: |
| 58 |
```meson |
| 59 |
# d2 is set to foo_dep and not the system dependency, even without fallback argument. |
| 60 |
d1 = dependency('foo', version : '>=2.0', required : false, |
| 61 |
fallback : ['foo', 'foo_dep']) |
| 62 |
d2 = dependency('foo', version : '>=1.0', required : false) |
| 63 |
``` |
| 64 |
```meson |
| 65 |
# d2 is not-found because the first call returned the system dependency, but its version is too old for 2nd call. |
| 66 |
d1 = dependency('foo', version : '>=1.0', required : false) |
| 67 |
d2 = dependency('foo', version : '>=2.0', required : false, |
| 68 |
fallback : ['foo', 'foo_dep']) |
| 69 |
``` |
| 70 |
|
| 71 |
## Override `dependency()` |
| 72 |
|
| 73 |
It is now possible to override the result of `dependency()` to point |
| 74 |
to any dependency object you want. The overriding is global and |
| 75 |
applies to every subproject from there on. |
| 76 |
|
| 77 |
For example, this subproject provides 2 libraries with version 2.0: |
| 78 |
|
| 79 |
```meson |
| 80 |
project(..., version : '2.0') |
| 81 |
|
| 82 |
libfoo = library('foo', ...) |
| 83 |
foo_dep = declare_dependency(link_with : libfoo) |
| 84 |
meson.override_dependency('foo', foo_dep) |
| 85 |
|
| 86 |
libbar = library('bar', ...) |
| 87 |
bar_dep = declare_dependency(link_with : libbar) |
| 88 |
meson.override_dependency('bar', bar_dep) |
| 89 |
``` |
| 90 |
|
| 91 |
Assuming the system has `foo` and `bar` 1.0 installed, and master project does this: |
| 92 |
```meson |
| 93 |
foo_dep = dependency('foo', version : '>=2.0', fallback : ['foo', 'foo_dep']) |
| 94 |
bar_dep = dependency('bar') |
| 95 |
``` |
| 96 |
|
| 97 |
This used to mix system 1.0 version and subproject 2.0 dependencies, |
| 98 |
but thanks to the override `bar_dep` is now set to the subproject's |
| 99 |
version instead. |
| 100 |
|
| 101 |
Another case this can be useful is to force a subproject to use a |
| 102 |
specific dependency. If the subproject does `dependency('foo')` but |
| 103 |
the main project wants to provide its own implementation of `foo`, it |
| 104 |
can for example call `meson.override_dependency('foo', |
| 105 |
declare_dependency(...))` before configuring the subproject. |
| 106 |
|
| 107 |
## Simplified `dependency()` fallback |
| 108 |
|
| 109 |
In the case a subproject `foo` calls |
| 110 |
`meson.override_dependency('foo-2.0', foo_dep)`, the parent project |
| 111 |
can omit the dependency variable name in fallback keyword argument: |
| 112 |
`dependency('foo-2.0', fallback : 'foo')`. |
| 113 |
|
| 114 |
## Backend agnostic compile command |
| 115 |
|
| 116 |
A new `meson compile` command has been added to support backend |
| 117 |
agnostic compilation. It accepts two arguments, `-j` and `-l`, which |
| 118 |
are used if possible (`-l` does nothing with msbuild). A `-j` or `-l` |
| 119 |
value < 1 lets the backend decide how many threads to use. For msbuild |
| 120 |
this means `-m`, for ninja it means passing no arguments. |
| 121 |
|
| 122 |
```console |
| 123 |
meson setup builddir --backend vs |
| 124 |
meson compile -C builddir -j0 # this is the same as `msbuild builddir/my.sln -m` |
| 125 |
``` |
| 126 |
|
| 127 |
```console |
| 128 |
meson setup builddir |
| 129 |
meson compile -C builddir -j3 # this is the same as `ninja -C builddir -j3` |
| 130 |
``` |
| 131 |
|
| 132 |
Additionally `meson compile` provides a `--clean` switch to clean the |
| 133 |
project. |
| 134 |
|
| 135 |
A complete list of arguments is always documented via `meson compile --help` |
| 136 |
|
| 137 |
## Native (build machine) compilers not always required |
| 138 |
|
| 139 |
`add_languages()` gained a `native:` keyword, indicating if a native or cross |
| 140 |
compiler is to be used. |
| 141 |
|
| 142 |
For the benefit of existing simple build definitions which don't |
| 143 |
contain any `native: true` targets, without breaking backwards |
| 144 |
compatibility for build definitions which assume that the native |
| 145 |
compiler is available after `add_languages()`, if the `native:` |
| 146 |
keyword is absent the languages may be used for either the build or |
| 147 |
host machine, but are never required for the build machine. |
| 148 |
|
| 149 |
This changes the behaviour of the following Meson fragment (when |
| 150 |
cross-compiling but a native compiler is not available) from reporting |
| 151 |
an error at `add_language` to reporting an error at `executable`. |
| 152 |
|
| 153 |
``` |
| 154 |
add_language('c') |
| 155 |
executable('main', 'main.c', native: true) |
| 156 |
``` |
| 157 |
|
| 158 |
## Summary improvements |
| 159 |
|
| 160 |
A new `list_sep` keyword argument has been added to `summary()` |
| 161 |
function. If defined and the value is a list, elements will be |
| 162 |
separated by the provided string instead of being aligned on a new |
| 163 |
line. |
| 164 |
|
| 165 |
The automatic `subprojects` section now also print the number of |
| 166 |
warnings encountered during that subproject configuration, or the |
| 167 |
error message if the configuration failed. |
| 168 |
|
| 169 |
## Add a system type dependency for zlib |
| 170 |
|
| 171 |
This allows zlib to be detected on macOS and FreeBSD without the use |
| 172 |
of pkg-config or cmake, neither of which are part of the base install |
| 173 |
on those OSes (but zlib is). |
| 174 |
|
| 175 |
A side effect of this change is that `dependency('zlib')` also works |
| 176 |
with cmake instead of requiring `dependency('ZLIB')`. |
| 177 |
|
| 178 |
## Added 'name' method |
| 179 |
|
| 180 |
Build target objects (as returned by executable(), library(), ...) now |
| 181 |
have a name() method. |
| 182 |
|
| 183 |
## New option `--quiet` to `meson install` |
| 184 |
|
| 185 |
Now you can run `meson install --quiet` and Meson will not verbosely |
| 186 |
print every file as it is being installed. As before, the full log is |
| 187 |
always available inside the builddir in `meson-logs/install-log.txt`. |
| 188 |
|
| 189 |
When this option is passed, install scripts will have the environment |
| 190 |
variable `MESON_INSTALL_QUIET` set. |
| 191 |
|
| 192 |
Numerous speed-ups were also made for the install step, especially on |
| 193 |
Windows where it is now 300% to 1200% faster than before depending on |
| 194 |
your workload. |
| 195 |
|
| 196 |
## Property support emscripten's wasm-ld |
| 197 |
|
| 198 |
Before 0.54.0 we treated emscripten as both compiler and linker, which |
| 199 |
isn't really true. It does have a linker, called wasm-ld (Meson's name |
| 200 |
is ld.wasm). This is a special version of clang's lld. This will now |
| 201 |
be detected properly. |
| 202 |
|
| 203 |
## Skip sanity tests when cross compiling |
| 204 |
|
| 205 |
For certain cross compilation environments it is not possible to |
| 206 |
compile a sanity check application. This can now be disabled by adding |
| 207 |
the following entry to your cross file's `properties` section: |
| 208 |
|
| 209 |
``` |
| 210 |
skip_sanity_check = true |
| 211 |
``` |
| 212 |
|
| 213 |
## Support for overriding the linker with ldc and gdc |
| 214 |
|
| 215 |
LDC (the llvm D compiler) and GDC (The Gnu D Compiler) now honor D_LD |
| 216 |
linker variable (or d_ld in the cross file) and is able to pick |
| 217 |
different linkers. |
| 218 |
|
| 219 |
GDC supports all of the same values as GCC, LDC supports ld.bfd, |
| 220 |
ld.gold, ld.lld, ld64, link, and lld-link. |
| 221 |
|
| 222 |
## Native file properties |
| 223 |
|
| 224 |
As of Meson 0.54.0, the `--native-file nativefile.ini` can contain: |
| 225 |
|
| 226 |
* binaries |
| 227 |
* paths |
| 228 |
* properties |
| 229 |
|
| 230 |
which are defined and used the same way as in cross files. The |
| 231 |
`properties` are new for Meson 0.54.0, and are read like: |
| 232 |
|
| 233 |
```meson |
| 234 |
x = meson.get_external_property('foobar', 'foo') |
| 235 |
``` |
| 236 |
|
| 237 |
where `foobar` is the property name, and the optional `foo` is the |
| 238 |
fallback string value. |
| 239 |
|
| 240 |
For cross-compiled projects, `get_external_property()` reads the |
| 241 |
cross-file unless `native: true` is specified. |
| 242 |
|
| 243 |
## Changed the signal used to terminate a test process (group) |
| 244 |
|
| 245 |
A test process (group) is now terminated via SIGTERM instead of |
| 246 |
SIGKILL allowing the signal to be handled. However, it is now the |
| 247 |
responsibility of the custom signal handler (if any) to ensure that |
| 248 |
any process spawned by the top-level test processes is correctly |
| 249 |
killed. |
| 250 |
|
| 251 |
## Dynamic Linker environment variables actually match docs |
| 252 |
|
| 253 |
The docs have always claimed that the Dynamic Linker environment |
| 254 |
variable should be `${COMPILER_VAR}_LD`, but that's only the case for |
| 255 |
about half of the variables. The other half are different. In 0.54.0 |
| 256 |
the variables match. The old variables are still supported, but are |
| 257 |
deprecated and raise a deprecation warning. |
| 258 |
|
| 259 |
## Per subproject `default_library` and `werror` options |
| 260 |
|
| 261 |
The `default_library` and `werror` built-in options can now be defined |
| 262 |
per subproject. This is useful for example when building shared |
| 263 |
libraries in the main project, but static link a subproject, or when |
| 264 |
the main project must build with no warnings but some subprojects |
| 265 |
cannot. |
| 266 |
|
| 267 |
Most of the time this would be used either by the parent project by |
| 268 |
setting subproject's default_options (e.g. `subproject('foo', |
| 269 |
default_options: 'default_library=static')`), or by the user using the |
| 270 |
command line `-Dfoo:default_library=static`. |
| 271 |
|
| 272 |
The value is overridden in this order: |
| 273 |
- Value from parent project |
| 274 |
- Value from subproject's default_options if set |
| 275 |
- Value from subproject() default_options if set |
| 276 |
- Value from command line if set |
| 277 |
|
| 278 |
## Environment Variables with Cross Builds |
| 279 |
|
| 280 |
Previously in Meson, variables like `CC` effected both the host and |
| 281 |
build platforms for native builds, but the just the build platform for |
| 282 |
cross builds. Now `CC_FOR_BUILD` is used for the build platform in |
| 283 |
cross builds. |
| 284 |
|
| 285 |
This old behavior is inconsistent with the way Autotools works, which |
| 286 |
undermines the purpose of distro-integration that is the only reason |
| 287 |
environment variables are supported at all in Meson. The new behavior |
| 288 |
is not quite the same, but doesn't conflict: Meson doesn't always |
| 289 |
respond to an environment when Autoconf would, but when it does it |
| 290 |
interprets it as Autotools would. |
| 291 |
|
| 292 |
## Added 'pkg_config_libdir' property |
| 293 |
|
| 294 |
Allows to define a list of folders used by pkg-config for a cross |
| 295 |
build and avoid a system directories use. |
| 296 |
|
| 297 |
## More new sample Meson templates for (`Java`, `Cuda`, and more) |
| 298 |
|
| 299 |
Meson now ships with predefined project templates for `Java`, `Cuda`, |
| 300 |
`Objective-C++`, and `C#`, we provided with associated values for |
| 301 |
corresponding languages, available for both library, and executable. |
| 302 |
|
| 303 |
## Ninja version requirement bumped to 1.7 |
| 304 |
|
| 305 |
Meson now uses the [Implicit |
| 306 |
outputs](https://ninja-build.org/manual.html#ref_outputs) feature of |
| 307 |
Ninja for some types of targets that have multiple outputs which may |
| 308 |
not be listed on the command-line. This feature requires Ninja 1.7+. |
| 309 |
|
| 310 |
Note that the latest version of [Ninja available in Ubuntu |
| 311 |
16.04](https://packages.ubuntu.com/search?keywords=ninja-build&searchon=names&suite=xenial-backports§ion=all) |
| 312 |
(the oldest Ubuntu LTS at the time of writing) is 1.7.1. If your |
| 313 |
distro does not ship with a new-enough Ninja, you can download the |
| 314 |
latest release from Ninja's GitHub page: |
| 315 |
https://github.com/ninja-build/ninja/releases |
| 316 |
|
| 317 |
## Added `-C` argument to `meson init` command |
| 318 |
|
| 319 |
The Meson init assumes that it is run inside the project root |
| 320 |
directory. If this isn't the case, you can now use `-C` to specify the |
| 321 |
actual project source directory. |
| 322 |
|
| 323 |
## More than one argument to `message()` and `warning()` |
| 324 |
|
| 325 |
Arguments passed to `message()` and `warning()` will be printed |
| 326 |
separated by space. |
| 327 |
|
| 328 |
## Added `has_tools` method to qt module |
| 329 |
|
| 330 |
It should be used to compile optional Qt code: |
| 331 |
```meson |
| 332 |
qt5 = import('qt5') |
| 333 |
if qt5.has_tools(required: get_option('qt_feature')) |
| 334 |
moc_files = qt5.preprocess(...) |
| 335 |
... |
| 336 |
endif |
| 337 |
``` |
| 338 |
|
| 339 |
## The MSI installer is only available in 64 bit version |
| 340 |
|
| 341 |
Microsoft ended support for Windows 7, so only 64 bit Windows OSs are |
| 342 |
officially supported. Thus only a 64 bit MSI installer will be |
| 343 |
provided going forward. People needing a 32 bit version can build |
| 344 |
their own with the `msi/createmsi.py` script in Meson's source |
| 345 |
repository. |
| 346 |
|
| 347 |
## Uninstalled pkg-config files |
| 348 |
|
| 349 |
**Note**: the functionality of this module is governed by [Meson's |
| 350 |
rules on mixing build systems](Mixing-build-systems.md). |
| 351 |
|
| 352 |
The `pkgconfig` module now generates uninstalled pc files as well. For |
| 353 |
any generated `foo.pc` file, an extra `foo-uninstalled.pc` file is |
| 354 |
placed into `<builddir>/meson-uninstalled`. They can be used to build |
| 355 |
applications against libraries built by Meson without installing them, |
| 356 |
by pointing `PKG_CONFIG_PATH` to that directory. This is an |
| 357 |
experimental feature provided on a best-effort basis, it might not |
| 358 |
work in all use-cases. |
| 359 |
|
| 360 |
## CMake find_package COMPONENTS support |
| 361 |
|
| 362 |
It is now possible to pass components to the CMake dependency backend |
| 363 |
via the new `components` kwarg in the `dependency` function. |
| 364 |
|
| 365 |
## Added Microchip XC16 C compiler support |
| 366 |
|
| 367 |
Make sure compiler executables are setup correctly in your path |
| 368 |
Compiler is available from the Microchip website for free |
| 369 |
|
| 370 |
|
| 371 |
## Added Texas Instruments C2000 C/C++ compiler support |
| 372 |
|
| 373 |
Make sure compiler executables are setup correctly in your path |
| 374 |
Compiler is available from Texas Instruments website for free |
| 375 |
|
| 376 |
## Unity file block size is configurable |
| 377 |
|
| 378 |
Traditionally the unity files that Meson autogenerates contain all |
| 379 |
source files that belong to a single target. This is the most |
| 380 |
efficient setting for full builds but makes incremental builds slow. |
| 381 |
This release adds a new option `unity_size` which specifies how many |
| 382 |
source files should be put in each unity file. |
| 383 |
|
| 384 |
The default value for block size is 4. This means that if you have a |
| 385 |
target that has eight source files, Meson will generate two unity |
| 386 |
files each of which includes four source files. The old behaviour can |
| 387 |
be replicated by setting `unity_size` to a large value, such as 10000. |
| 388 |
|
| 389 |
## Verbose mode for `meson compile` |
| 390 |
|
| 391 |
The new option `--verbose` has been added to `meson compile` that will |
| 392 |
enable more verbose compilation logs. Note that for VS backend it |
| 393 |
means that logs will be less verbose by default (without `--verbose` |
| 394 |
option). |