-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for name_prefix, name_suffix and lan_args dictionaries
- Loading branch information
Showing
2 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Dictionary for `name_prefix`, `name_suffix` and `<lang>_args` | ||
|
||
`name_prefix`, `name_suffix` and `<lang>_args` keyword arguments of functions | ||
like `library()` and `build_target()` now accept a dictionary mapping the target | ||
type to the value. This is used when for example different c_args must be passed | ||
to the static and shared library built by `both_libraries()`. | ||
|
||
```meson | ||
cargs = { | ||
'static_library': '-DSTATIC', | ||
'shared_library': '-DSHARED', | ||
'executable': ['-DEXECUTABLE', '-DMY_APP'], | ||
} | ||
namesuffix = { | ||
'static_library': 'a', | ||
'shared_library': 'so', | ||
} | ||
# sources will be built twice with different cflags, the static library will | ||
# have .a extension on all platforms and the shared library will have the .so | ||
# extension on all platforms | ||
both_libraries('foo', sources, c_args: cargs, name_suffix: namesuffix) | ||
# EXECUTABLE and MY_APP will be defined when building sources, and it will use | ||
# the default extension on the current platform because 'executable' is not in | ||
# the namesuffix dictionary | ||
executable('app', c_args: cargs, name_suffix: namesuffix) | ||
``` |