docs: Improve code snippets in release notes

pull/2457/head
TingPing 7 years ago committed by GitHub
parent b4fa4e37b9
commit b5eb77ddff
  1. 14
      docs/markdown/Release-notes-for-0.43.0.md

@ -26,7 +26,8 @@ object can be used as a source file for other Targets, this will create a
dependency on the original `CustomTarget`, but will only insert the generated dependency on the original `CustomTarget`, but will only insert the generated
file corresponding to the index value of the `CustomTarget`'s `output` keyword. file corresponding to the index value of the `CustomTarget`'s `output` keyword.
c = CustomTarget( ```meson
c = custom_target(
... ...
output : ['out.h', 'out.c'], output : ['out.h', 'out.c'],
) )
@ -40,6 +41,7 @@ file corresponding to the index value of the `CustomTarget`'s `output` keyword.
c[1], c[1],
link_with : lib1, link_with : lib1,
) )
```
# Can override executables in the cross file # Can override executables in the cross file
@ -47,21 +49,26 @@ The cross file can now be used for overriding the result of
`find_program`. As an example if you want to find the `objdump` `find_program`. As an example if you want to find the `objdump`
command and have the following definition in your cross file: command and have the following definition in your cross file:
```ini
[binaries] [binaries]
... ...
objdump = '/usr/bin/arm-linux-gnueabihf-objdump-6' objdump = '/usr/bin/arm-linux-gnueabihf-objdump-6'
```
Then issuing the command `find_program('objdump')` will return the Then issuing the command `find_program('objdump')` will return the
version specified in the cross file. If you need the build machine's version specified in the cross file. If you need the build machine's
objdump, you can specify the `native` keyword like this: objdump, you can specify the `native` keyword like this:
```meson
native_objdump = find_program('objdump', native : true) native_objdump = find_program('objdump', native : true)
```
# Easier handling of supported compiler arguments # Easier handling of supported compiler arguments
A common pattern for handling multiple desired compiler arguments, was to A common pattern for handling multiple desired compiler arguments, was to
test their presence and add them to an array one-by-one, e.g.: test their presence and add them to an array one-by-one, e.g.:
```meson
warning_flags_maybe = [ warning_flags_maybe = [
'-Wsomething', '-Wsomething',
'-Wanother-thing', '-Wanother-thing',
@ -74,12 +81,15 @@ test their presence and add them to an array one-by-one, e.g.:
endif endif
endforeach endforeach
cc.add_project_argument(warning_flags) cc.add_project_argument(warning_flags)
```
A helper has been added for the foreach/has_argument pattern, so you can A helper has been added for the foreach/has_argument pattern, so you can
now simply do: now simply do:
```meson
warning_flags = [ ... ] warning_flags = [ ... ]
flags = cc.get_supported_flags(warning_flags) flags = cc.get_supported_flags(warning_flags)
```
# Better support for shared libraries in non-system paths # Better support for shared libraries in non-system paths
@ -93,12 +103,14 @@ This means that e.g. supporting prebuilt libraries shipped with your
source or provided by subprojects or wrap definitions by writing a source or provided by subprojects or wrap definitions by writing a
build file like this: build file like this:
```meson
project('myprebuiltlibrary', 'c') project('myprebuiltlibrary', 'c')
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
prebuilt = cc.find_library('mylib', dirs : meson.current_source_dir()) prebuilt = cc.find_library('mylib', dirs : meson.current_source_dir())
mydep = declare_dependency(include_directories : include_directories('.'), mydep = declare_dependency(include_directories : include_directories('.'),
dependencies : prebuilt) dependencies : prebuilt)
```
Then you can use the dependency object in the same way as any other. Then you can use the dependency object in the same way as any other.

Loading…
Cancel
Save