Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. The Mesa project would like to use this feature for passing lists of drivers to be be built.
- Loading branch information
Showing
6 changed files
with
70 additions
and
11 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,17 @@ | ||
# An array type for user options | ||
|
||
Previously to have an option that took more than one value a string value would | ||
have to be created and split, but validating this was difficult. A new array type | ||
has been added to the meson_options.txt for this case. It works like a 'combo', but | ||
allows more than one option to be passed. When used on the command line (with -D), | ||
values are passed as a comma separated list. | ||
|
||
```meson | ||
option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : 'one') | ||
``` | ||
|
||
These can be overwritten on the command line, | ||
|
||
```meson | ||
meson _build -Darray_opt=two,three | ||
``` |
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
option('testoption', type : 'string', value : 'optval', description : 'An option to do something') | ||
option('other_one', type : 'boolean', value : false) | ||
option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo') | ||
option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two']) | ||
option('array_opt2', type : 'array', choices : ['one', 'two', 'three'], value : 'one') |