-
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.
This is a special type of option to be passed to most 'required' keyword arguments. It adds a 3rd state to the traditional boolean value to cause those methods to always return not-found even if the dependency could be found. Since integrators doesn't want enabled features to be a surprise there is a global option "feature_options" to enable or disable all automatic features.
- Loading branch information
Showing
10 changed files
with
239 additions
and
29 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
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
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,47 @@ | ||
project('feature user option', 'c') | ||
|
||
feature_opts = get_option('feature_options') | ||
required_opt = get_option('required') | ||
optional_opt = get_option('optional') | ||
disabled_opt = get_option('disabled') | ||
|
||
assert(not feature_opts.enabled(), 'Should be auto option') | ||
assert(not feature_opts.disabled(), 'Should be auto option') | ||
assert(feature_opts.auto(), 'Should be auto option') | ||
|
||
assert(required_opt.enabled(), 'Should be enabled option') | ||
assert(not required_opt.disabled(), 'Should be enabled option') | ||
assert(not required_opt.auto(), 'Should be enabled option') | ||
|
||
assert(not optional_opt.enabled(), 'Should be auto option') | ||
assert(not optional_opt.disabled(), 'Should be auto option') | ||
assert(optional_opt.auto(), 'Should be auto option') | ||
|
||
assert(not disabled_opt.enabled(), 'Should be disabled option') | ||
assert(disabled_opt.disabled(), 'Should be disabled option') | ||
assert(not disabled_opt.auto(), 'Should be disabled option') | ||
|
||
dep = dependency('threads', required : required_opt) | ||
assert(dep.found(), 'Should find required "threads" dep') | ||
|
||
dep = dependency('threads', required : optional_opt) | ||
assert(dep.found(), 'Should find optional "threads" dep') | ||
|
||
dep = dependency('threads', required : disabled_opt) | ||
assert(not dep.found(), 'Should not find disabled "threads" dep') | ||
|
||
dep = dependency('notfounddep', required : optional_opt) | ||
assert(not dep.found(), 'Should not find optional "notfounddep" dep') | ||
|
||
dep = dependency('notfounddep', required : disabled_opt) | ||
assert(not dep.found(), 'Should not find disabled "notfounddep" dep') | ||
|
||
cc = meson.get_compiler('c') | ||
lib = cc.find_library('m', required : disabled_opt) | ||
assert(not lib.found(), 'Should not find "m" library') | ||
|
||
cp = find_program('cp', required : disabled_opt) | ||
assert(not cp.found(), 'Should not find "cp" program') | ||
|
||
found = add_languages('cpp', required : disabled_opt) | ||
assert(not found, 'Should not find "cpp" language') |
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,3 @@ | ||
option('required', type : 'feature', value : 'enabled', description : 'An required feature') | ||
option('optional', type : 'feature', value : 'auto', description : 'An optional feature') | ||
option('disabled', type : 'feature', value : 'disabled', description : 'A disabled feature') |
Oops, something went wrong.