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