tests: Convert sdl2 to use a matrix option

pull/6816/head
Dylan Baker 5 years ago
parent ea34c666ac
commit eb45ce6189
  1. 20
      test cases/frameworks/16 sdl2/meson.build
  2. 6
      test cases/frameworks/16 sdl2/meson_options.txt
  3. 13
      test cases/frameworks/16 sdl2/test.json

@ -1,6 +1,8 @@
project('sdl2 test', 'c') project('sdl2 test', 'c')
sdl2_dep = dependency('sdl2', version : '>=2.0.0', required: false) method = get_option('method')
sdl2_dep = dependency('sdl2', version : '>=2.0.0', required : false, method : method)
if not sdl2_dep.found() if not sdl2_dep.found()
error('MESON_SKIP_TEST sdl2 not found.') error('MESON_SKIP_TEST sdl2 not found.')
@ -9,19 +11,3 @@ endif
e = executable('sdl2prog', 'sdl2prog.c', dependencies : sdl2_dep) e = executable('sdl2prog', 'sdl2prog.c', dependencies : sdl2_dep)
test('sdl2test', e) test('sdl2test', e)
if sdl2_dep.type_name() == 'extraframeworks'
# The SDL OSX framework does not ship with detection executables
# so skip the remaining tests.
subdir_done()
endif
# Ensure that we can find it with sdl2-config too, using the legacy method name
configdep = dependency('sdl2', method : 'sdlconfig')
# And the modern method name
configdep = dependency('sdl2', method : 'config-tool')
# Check we can apply a version constraint
dependency('sdl2', version: '>=@0@'.format(sdl2_dep.version()), method: 'pkg-config')
dependency('sdl2', version: '>=@0@'.format(sdl2_dep.version()), method: 'config-tool')

@ -0,0 +1,6 @@
option(
'method',
type : 'combo',
choices : ['auto', 'pkg-config', 'config-tool', 'sdlconfig', 'extraframework'],
value : 'auto',
)

@ -0,0 +1,13 @@
{
"matrix": {
"options": {
"method": [
{ "val": "auto" },
{ "val": "pkg-config" },
{ "val": "config-tool" },
{ "val": "sdlconfig" },
{ "val": "extraframework" }
]
}
}
}
Loading…
Cancel
Save