summary()
This function is used to summarize build configuration at the end of the build process. This function provides a way for projects (and subprojects) to report this information in a clear way.
The content is a series of key/value pairs grouped into sections. If
the section keyword argument is omitted, those key/value pairs are
implicitly grouped into a section with no title. key/value pairs can
optionally be grouped into a dictionary, but keep in mind that
dictionaries do not guarantee ordering. key must be string,
value can be:
- an integer, boolean or string
- since 0.57.0 an external program or a dependency
- since 0.58.0 a feature option
- an array of those.
Instead of calling summary as summary(key, value), it is also possible to
directly pass a dictionary to the summary() function, as seen in the example
below.
summary() can be called multiple times as long as the same
section/key pair doesn't appear twice. All sections will be collected
and printed at the end of the configuration in the same order as they
have been called.
Signature
(since 0.53.0)
# This function is used to summarize build configuration at the end of the build
void summary(
str | dict[str | bool | int | dep | external_program | array[str | bool | int | dep | external_program]] key_or_dict, # The name of the new entry, or a dict containing multiple entries
str | bool | int | dep | external_program | array[str | bool | int | dep | external_program] [value], # The value to print for the `key`
# Keyword arguments:
bool_yn : bool # Convert bool values to yes and no
list_sep : str # The separator to use when printing array values in this summary
section : str # The section to put this summary information under
)
Example
Example meson.build:
project('My Project', version : '1.0')
summary({'bindir': get_option('bindir'),
'libdir': get_option('libdir'),
'datadir': get_option('datadir'),
}, section: 'Directories')
summary({'Some boolean': false,
'Another boolean': true,
'Some string': 'Hello World',
'An array': ['string', 1, true],
}, section: 'Configuration')
Output:
My Project 1.0
Directories
prefix : /opt/gnome
bindir : bin
libdir : lib/x86_64-linux-gnu
datadir : share
Configuration
Some boolean : False
Another boolean: True
Some string : Hello World
An array : string
1
True
Arguments
Argument flattening is NOT SUPPORTED by this function.
The function summary() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
key_or_dict |
str | dict[str | bool | int | dep | external_program | array[str | bool | int | dep | external_program]] |
The name of the new entry, or a dict containing multiple entries. If a dict is passed it is equivalent to calling summary() once for each key-value pair. Keep in mind that dictionaries do not guarantee ordering. |
|
value |
str | bool | int | dep | external_program | array[str | bool | int | dep | external_program] |
The value to print for the |
[optional] |
Finally, summary()
accepts the following keyword arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
bool_yn |
bool |
Convert bool values to yes and no |
|
list_sep |
str |
The separator to use when printing array values in this summary. If no separator is given, each array item will be printed on its own line. |
(since 0.54.0) |
section |
str |
The section to put this summary information under. If the section keyword argument is omitted, key/value pairs are implicitly grouped into a section with no title. |
|
The results of the search are