diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-09-29 10:07:29 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-11-29 14:14:41 -0800 |
commit | c9351ce30c03d107279090da7825096951a705d3 (patch) | |
tree | a9bf94236755986b2f69d2ef297e339c3c898561 /docs/markdown/Build-options.md | |
parent | 7c779a76df9b8a4dd466b120f817b50f857081fa (diff) | |
download | meson-c9351ce30c03d107279090da7825096951a705d3.zip meson-c9351ce30c03d107279090da7825096951a705d3.tar.gz meson-c9351ce30c03d107279090da7825096951a705d3.tar.bz2 |
Add new array type option
This exposes the already existing UserStringArrayOption class through
the meson_options.txt. The intention is to provide a way for projects to
take list/array type arguments and validate that all of the elements in
that array are valid without using complex looping constructrs.
Diffstat (limited to 'docs/markdown/Build-options.md')
-rw-r--r-- | docs/markdown/Build-options.md | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/docs/markdown/Build-options.md b/docs/markdown/Build-options.md index cb7b19e..f05eb7b 100644 --- a/docs/markdown/Build-options.md +++ b/docs/markdown/Build-options.md @@ -16,18 +16,37 @@ Here is a simple option file. option('someoption', type : 'string', value : 'optval', description : 'An option') option('other_one', type : 'boolean', value : false) option('combo_opt', type : 'combo', choices : ['one', 'two', 'three'], value : 'three') +option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two']) ``` -This demonstrates the three basic option types and their usage. String -option is just a free form string and a boolean option is, -unsurprisingly, true or false. The combo option can have any value -from the strings listed in argument `choices`. If `value` is not set, -it defaults to empty string for strings, `true` for booleans or the -first element in a combo. You can specify `description`, which is a -free form piece of text describing the option. It defaults to option -name. +All types allow a `description` value to be set describing the option, if no +option is set then the name of the option will be used instead. -These options are accessed in Meson code with the `get_option` function. +### Strings + +The string type is a free form string. If the default value is not set then an +empty string will be used as the default. + +### Booleans + +Booleans may have values of either `true` or `false`. If not default value is +supplied then `true` will be used as the default. + +### Combos + +A combo allows any one of the values in the `choices` parameter to be selected. +If no default value is set then the first value will be the default. + +### Arrays + +Arrays allow one or more of the values in the `choices` parameter to be selected. +If the `value` parameter is unset then the values of `choices` will be used as +the default. + +This type is new in version 0.44.0 + + +## Using build options ```meson optval = get_option('opt_name') |