| 1 |
project('get prop') |
| 2 |
|
| 3 |
x = meson.get_external_property('astring') |
| 4 |
ref = meson.is_cross_build() ? 'cross' : 'mystring' |
| 5 |
assert(x==ref, 'did not get native property string. did you use "meson setup --native-file native.txt"') |
| 6 |
|
| 7 |
x = meson.get_external_property('astring', native: true) |
| 8 |
assert(x=='mystring', 'did not get native property with native:true and non-cross build.') |
| 9 |
|
| 10 |
x = meson.get_external_property('astring', 'fallback', native: false) |
| 11 |
assert(x==ref, 'did not get native property with native:false and non-cross build.') |
| 12 |
|
| 13 |
|
| 14 |
x = meson.get_external_property('nonexistent', 'fallback') |
| 15 |
assert(x=='fallback', 'fallback did not work') |
| 16 |
|
| 17 |
x = meson.get_external_property('nonexistent', 'fallback', native: true) |
| 18 |
assert(x=='fallback', 'fallback native:true did not work') |
| 19 |
|
| 20 |
x = meson.get_external_property('nonexistent', 'fallback', native: false) |
| 21 |
assert(x=='fallback', 'fallback native:false did not work') |
| 22 |
|
| 23 |
|
| 24 |
x = meson.get_external_property('anarray') |
| 25 |
assert(x==['one', 'two'], 'array did not work') |
| 26 |
|
| 27 |
assert(meson.has_external_property('anarray'), 'expected property "anarray" to exist') |
| 28 |
assert(meson.has_external_property('astring'), 'expected property "astring" to exist') |
| 29 |
assert(not meson.has_external_property('abool'), 'did not expect property "abool" to exist') |
| 30 |
|
| 31 |
# These exist in both |
| 32 |
assert(meson.has_external_property('anarray', native: false), 'FIXME') |
| 33 |
assert(meson.has_external_property('anarray', native: true), 'FIXME') |
| 34 |
assert(meson.has_external_property('astring', native: false), 'FIXME') |
| 35 |
assert(meson.has_external_property('astring', native: true), 'FIXME') |
| 36 |
|
| 37 |
if meson.is_cross_build() |
| 38 |
# This property only exists in the cross file |
| 39 |
assert(meson.has_external_property('red'), 'expected property "red" to exist in cross file') |
| 40 |
assert(meson.has_external_property('red', native: false), 'expected property "red" to exist in cross file') |
| 41 |
assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') |
| 42 |
|
| 43 |
assert(not meson.has_external_property('abool', native: false), 'FIXME') |
| 44 |
assert(not meson.has_external_property('abool', native: false), 'FIXME') |
| 45 |
else |
| 46 |
assert(not meson.has_external_property('red'), 'did not expect property "red" to exist in native file') |
| 47 |
assert(not meson.has_external_property('red', native: false), 'did not expect property "red" to exist in cross file because we are not doing a cross build') |
| 48 |
assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') |
| 49 |
endif |