| 1 |
--- |
| 2 |
title: Release 0.45 |
| 3 |
short-description: Release notes for 0.45 |
| 4 |
... |
| 5 |
|
| 6 |
# New features |
| 7 |
|
| 8 |
## Python minimum version is now 3.5 |
| 9 |
|
| 10 |
Meson will from this version on require Python version 3.5 or newer. |
| 11 |
|
| 12 |
## Config-Tool based dependencies can be specified in a cross file |
| 13 |
|
| 14 |
Tools like LLVM and pcap use a config tool for dependencies, this is a |
| 15 |
script or binary that is run to get configuration information (cflags, |
| 16 |
ldflags, etc) from. |
| 17 |
|
| 18 |
These binaries may now be specified in the `binaries` section of a |
| 19 |
cross file. |
| 20 |
|
| 21 |
```ini |
| 22 |
[binaries] |
| 23 |
cc = ... |
| 24 |
llvm-config = '/usr/bin/llvm-config32' |
| 25 |
``` |
| 26 |
|
| 27 |
## Visual Studio C# compiler support |
| 28 |
|
| 29 |
In addition to the Mono C# compiler we also support Visual Studio's C# |
| 30 |
compiler. Currently this is only supported on the Ninja backend. |
| 31 |
|
| 32 |
## Removed two deprecated features |
| 33 |
|
| 34 |
The standalone `find_library` function has been a no-op for a long |
| 35 |
time. Starting with this version it becomes a hard error. |
| 36 |
|
| 37 |
There used to be a keywordless version of `run_target` which looked |
| 38 |
like this: |
| 39 |
|
| 40 |
```meson |
| 41 |
run_target('targetname', 'command', 'arg1', 'arg2') |
| 42 |
``` |
| 43 |
|
| 44 |
This is now an error. The correct format for this is now: |
| 45 |
|
| 46 |
```meson |
| 47 |
run_target('targetname', |
| 48 |
command : ['command', 'arg1', 'arg2']) |
| 49 |
``` |
| 50 |
|
| 51 |
## Experimental FPGA support |
| 52 |
|
| 53 |
This version adds support for generating, analysing and uploading FPGA |
| 54 |
programs using the [IceStorm |
| 55 |
toolchain](http://www.clifford.at/icestorm/). This support is |
| 56 |
experimental and is currently limited to the `iCE 40` series of FPGA |
| 57 |
chips. |
| 58 |
|
| 59 |
FPGA generation integrates with other parts of Meson seamlessly. As an |
| 60 |
example, [here](https://github.com/jpakkane/lm32) is an example |
| 61 |
project that compiles a simple firmware into Verilog and combines that |
| 62 |
with an lm32 softcore processor. |
| 63 |
|
| 64 |
## Generator outputs can preserve directory structure |
| 65 |
|
| 66 |
Normally when generating files with a generator, Meson flattens the |
| 67 |
input files so they all go in the same directory. Some code |
| 68 |
generators, such as Protocol Buffers, require that the generated files |
| 69 |
have the same directory layout as the input files used to generate |
| 70 |
them. This can now be achieved like this: |
| 71 |
|
| 72 |
```meson |
| 73 |
g = generator(...) # Compiles protobuf sources |
| 74 |
generated = gen.process('com/mesonbuild/one.proto', |
| 75 |
'com/mesonbuild/two.proto', |
| 76 |
preserve_path_from : meson.current_source_dir()) |
| 77 |
``` |
| 78 |
|
| 79 |
This would cause the following files to be generated inside the target |
| 80 |
private directory: |
| 81 |
|
| 82 |
com/mesonbuild/one.pb.h |
| 83 |
com/mesonbuild/one.pb.cc |
| 84 |
com/mesonbuild/two.pb.h |
| 85 |
com/mesonbuild/two.pb.cc |
| 86 |
|
| 87 |
## Hexadecimal string literals |
| 88 |
|
| 89 |
Hexadecimal integer literals can now be used in build and option files. |
| 90 |
|
| 91 |
```meson |
| 92 |
int_255 = 0xFF |
| 93 |
``` |
| 94 |
|
| 95 |
## b_ndebug : if-release |
| 96 |
|
| 97 |
The value `if-release` can be given for the `b_ndebug` project option. |
| 98 |
|
| 99 |
This will make the `NDEBUG` pre-compiler macro to be defined for |
| 100 |
release type builds as if the `b_ndebug` project option had the |
| 101 |
value `true` defined for it. |
| 102 |
|
| 103 |
## `install_data()` defaults to `{datadir}/{projectname}` |
| 104 |
|
| 105 |
If `install_data()` is not given an `install_dir` keyword argument, the |
| 106 |
target directory defaults to `{datadir}/{projectname}` (e.g. |
| 107 |
`/usr/share/myproj`). |
| 108 |
|
| 109 |
## install_subdir() supports strip_directory |
| 110 |
|
| 111 |
If strip_directory=true install_subdir() installs directory contents |
| 112 |
instead of directory itself, stripping basename of the source directory. |
| 113 |
|
| 114 |
## Integer options |
| 115 |
|
| 116 |
There is a new integer option type with optional minimum and maximum |
| 117 |
values. It can be specified like this in the `meson_options.txt` file: |
| 118 |
|
| 119 |
```meson |
| 120 |
option('integer_option', type : 'integer', min : 0, max : 5, value : 3) |
| 121 |
``` |
| 122 |
|
| 123 |
## New method meson.project_license() |
| 124 |
|
| 125 |
The `meson` builtin object now has a `project_license()` method that |
| 126 |
returns a list of all licenses for the project. |
| 127 |
|
| 128 |
## Rust cross-compilation |
| 129 |
|
| 130 |
Cross-compilation is now supported for Rust targets. Like other |
| 131 |
cross-compilers, the Rust binary must be specified in your cross file. |
| 132 |
It should specify a `--target` (as installed by `rustup target`) and a |
| 133 |
custom linker pointing to your C cross-compiler. For example: |
| 134 |
|
| 135 |
```ini |
| 136 |
[binaries] |
| 137 |
c = '/usr/bin/arm-linux-gnueabihf-gcc-7' |
| 138 |
rust = [ |
| 139 |
'rustc', |
| 140 |
'--target', 'arm-unknown-linux-gnueabihf', |
| 141 |
'-C', 'linker=/usr/bin/arm-linux-gnueabihf-gcc-7', |
| 142 |
] |
| 143 |
``` |
| 144 |
|
| 145 |
## Rust compiler-private library disambiguation |
| 146 |
|
| 147 |
When building a Rust target with Rust library dependencies, an |
| 148 |
`--extern` argument is now specified to avoid ambiguity between the |
| 149 |
dependency library, and any crates of the same name in `rustc`'s |
| 150 |
private sysroot. |
| 151 |
|
| 152 |
## Project templates |
| 153 |
|
| 154 |
Meson ships with predefined project templates. To start a new project |
| 155 |
from scratch, simply go to an empty directory and type: |
| 156 |
|
| 157 |
meson init --name=myproject --type=executable --language=c |
| 158 |
|
| 159 |
## Improve test setup selection |
| 160 |
|
| 161 |
Test setups are now identified (also) by the project they belong to |
| 162 |
and it is possible to select the used test setup from a specific |
| 163 |
project. E.g. to use a test setup `some_setup` from project |
| 164 |
`some_project` for all executed tests one can use |
| 165 |
|
| 166 |
meson test --setup some_project:some_setup |
| 167 |
|
| 168 |
Should one rather want test setups to be used from the same project as |
| 169 |
where the current test itself has been defined, one can use just |
| 170 |
|
| 171 |
meson test --setup some_setup |
| 172 |
|
| 173 |
In the latter case every (sub)project must have a test setup `some_setup` |
| 174 |
defined in it. |
| 175 |
|
| 176 |
## Can use custom targets as Windows resource files |
| 177 |
|
| 178 |
The `compile_resources()` function of the `windows` module can now be |
| 179 |
used on custom targets as well as regular files. |
| 180 |
|
| 181 |
## Can promote dependencies with wrap command |
| 182 |
|
| 183 |
The `promote` command makes it easy to copy nested dependencies to the |
| 184 |
top level. |
| 185 |
|
| 186 |
meson wrap promote scommon |
| 187 |
|
| 188 |
This will search the project tree for a subproject called `scommon` |
| 189 |
and copy it to the top level. |
| 190 |
|
| 191 |
If there are many embedded subprojects with the same name, you have to |
| 192 |
specify which one to promote manually like this: |
| 193 |
|
| 194 |
meson wrap promote subprojects/s1/subprojects/scommon |
| 195 |
|
| 196 |
## Yielding subproject option to superproject |
| 197 |
|
| 198 |
Normally project options are specific to the current project. However |
| 199 |
sometimes you want to have an option whose value is the same over all |
| 200 |
projects. This can be achieved with the new `yield` keyword for |
| 201 |
options. When set to `true`, getting the value of this option in |
| 202 |
`meson.build` files gets the value from the option with the same name |
| 203 |
in the master project (if such an option exists). |